Commit Graph

29466 Commits

Author SHA1 Message Date
Nathan Sidwell 2c65d990eb re PR c++/79091 (ICE in write_unnamed_type)
PR c++/79091
	* mangle.c (write_exception_spec): Check nothrow explicitly.
	(write_encoding): Don't increment processing_template_decl around
	encoding.

	PR c++/79091
	* g++.dg/pr79091.C: New.

From-SVN: r244575
2017-01-18 12:51:28 +00:00
Joe Seymour 4701fba31c t-msp430 (LIB2ADD): Remove mpy.c
libgcc/
	* config/msp430/t-msp430 (LIB2ADD): Remove mpy.c
	(mpy.o): New rule.
	(libmul_none.a): Add mpy.o

	gcc/testsuite/
	* gcc.target/msp430/mul_f5_muldef.c: New test.

From-SVN: r244564
2017-01-17 22:56:10 -05:00
Michael Meissner ac4dc08d72 re PR target/79004 (ICE in gcc.dg/torture/fp-int-convert-float128-ieee.c with -mcpu=power9)
2017-01-17  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/79004
	* gcc.target/powerpc/pr79004.c: Add -mfloat128 to the test
	options.  Fix up the syntax for using \m and \M.

From-SVN: r244561
2017-01-18 00:35:29 +00:00
Segher Boessenkool 1b3254e4bb -mstack-protector-guard and friends (PR78875)
Currently, on PowerPC, code compiled with -fstack-protector will load
the canary from -0x7010(13) (for -m64) or from -0x7008(2) (for -m32)
if GCC was compiled against GNU libc 2.4 or newer or some other libc
that supports -fstack-protector, and from the global variable
__stack_chk_guard otherwise.

This does not work well for Linux and other OS kernels and similar.
For such non-standard applications, this patch creates a few new
command-line options.  The relevant new use cases are:

-mstack-protector-guard=global
Use the __stack_chk_guard variable, no matter how this GCC was
configured.

-mstack-protector-guard=tls
Use the canary from TLS.  This will error out if this GCC was built
with a C library that does not support it.

-mstack-protector-guard=tls -mstack-protector-register=<reg>
-mstack-protector-offset=<offset>
Load the canary from offset <off> from base register <reg>.


	PR target/78875
	* config/rs6000/rs6000-opts.h (stack_protector_guard): New enum.
	* config/rs6000/rs6000.c (rs6000_option_override_internal): Handle
	the new options.
	* config/rs6000/rs6000.md (stack_protect_set): Handle the new more
	flexible settings.
	(stack_protect_test): Ditto.
	* config/rs6000/rs6000.opt (mstack-protector-guard=,
	mstack-protector-guard-reg=, mstack-protector-guard-offset=): New
	options.
	* doc/invoke.texi (Option Summary) [RS/6000 and PowerPC Options]:
	Add -mstack-protector-guard=, -mstack-protector-guard-reg=, and
	-mstack-protector-guard-offset=.
	(RS/6000 and PowerPC Options): Ditto.

gcc/testsuite/
	* gcc.target/powerpc/ssp-1.c: New testcase.
	* gcc.target/powerpc/ssp-2.c: New testcase.

From-SVN: r244556
2017-01-17 23:02:42 +01:00
Wilco Dijkstra 8144a493dd This patch simplifies the handling of EH return.
This patch simplifies the handling of EH return.  We force the use of the
frame pointer so the return location is always at FP + 8.  This means we
can emit a simple volatile access in EH_RETURN_HANDLER_RTX without needing md
patterns, splitters and frame offset calculations.  The new implementation also
fixes various bugs in aarch64_final_eh_return_addr, which does not work with
-fomit-frame-pointer, alloca or outgoing arguments.

    gcc/
	* config/aarch64/aarch64.md (eh_return): Remove pattern and splitter.
	* config/aarch64/aarch64.h (AARCH64_EH_STACKADJ_REGNUM): Remove.
	(EH_RETURN_HANDLER_RTX): New define.
	* config/aarch64/aarch64.c (aarch64_frame_pointer_required):
	Force frame pointer in EH return functions.
	(aarch64_expand_epilogue): Add barrier for eh_return.
	(aarch64_final_eh_return_addr): Remove.
	(aarch64_eh_return_handler_rtx): New function.
	* config/aarch64/aarch64-protos.h (aarch64_final_eh_return_addr):
	Remove.
	(aarch64_eh_return_handler_rtx): New prototype.

    testsuite/
	* gcc.target/aarch64/eh_return.c: New test.

From-SVN: r244547
2017-01-17 19:34:26 +00:00
Bill Schmidt a660777486 altivec.h (vec_rlmi): New #define.
[gcc]

2017-01-17  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	* config/rs6000/altivec.h (vec_rlmi): New #define.
	(vec_vrlnm): Likewise.
	(vec_rlnm): Likewise.
	* config/rs6000/altivec.md (UNSPEC_VRLMI): New UNSPEC enum value.
	(UNSPEC_VRLNM): Likewise.
	(VIlong): New mode iterator.
	(altivec_vrl<VI_char>mi): New define_insn.
	(altivec_vrl<VI_char>nm): Likewise.
	* config/rs6000/rs6000-builtin.def (VRLWNM): New monomorphic
	function entry.
	(VRLDNM): Likewise.
	(RLNM): New polymorphic function entry.
	(VRLWMI): New monomorphic function entry.
	(VRLDMI): Likewise.
	(RLMI): New polymorphic function entry.
	* config/rs6000/r6000-c.c (altivec_overloaded_builtin_table): Add
	new entries for P9V_BUILTIN_VEC_RLMI and P9V_BUILTIN_VEC_RLNM.
	* doc/extend.texi: Add description of vec_rlmi, vec_rlnm, and
	vec_vrlnm.

[gcc/testsuite]

2017-01-17  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	* vec-rlmi-rlnm.c: New file.

From-SVN: r244546
2017-01-17 19:14:09 +00:00
Nathan Sidwell 8ddfdbc265 re PR c++/61636 (generic lambda: segfault / "cannot call member function without object")
PR c++/61636
	* cp-tree.h (maybe_generic_this_capture): Declare.
	* lambda.c (resolvable_dummy_lambda): New, broken out of ...
	(maybe_resolve_dummy): ... here.  Call it.
	(maybe_generic_this_capture): New.
	* parser.c (cp_parser_postfix_expression): Speculatively capture
	this in generic lambda in unresolved member function call.
	* pt.c (tsubst_copy_and_build): Force hard error from failed
	member function lookup in generic lambda.

	PR c++/61636
	* g++.dg/cpp1y/pr61636-1.C: New.
	* g++.dg/cpp1y/pr61636-2.C: New.
	* g++.dg/cpp1y/pr61636-3.C: New.

From-SVN: r244544
2017-01-17 18:22:34 +00:00
Martin Sebor d365b403e2 PR testsuite/79115 - FAIL: gcc.dg/pr78768.c execution test on arm, aarch64
gcc/testsuite/ChangeLog
	* gcc.dg/pr78768.c: Make it a link-only test.

From-SVN: r244537
2017-01-17 09:36:55 -07:00
David Malcolm 0d80ab91d0 Fix wording of -Wmisleading-indentation (PR c++/71497)
gcc/c-family/ChangeLog:
	PR c++/71497
	* c-indentation.c (warn_for_misleading_indentation): Use the past
	subjunctive in the note.

gcc/testsuite/ChangeLog:
	PR c++/71497
	* c-c++-common/Wmisleading-indentation-3.c: Update wording of
	expected messages.
	* c-c++-common/Wmisleading-indentation.c: Likewise.

From-SVN: r244536
2017-01-17 16:33:44 +00:00
Vladimir Makarov 31b61548d6 re PR target/79058 (ARM: internal compiler error: in extract_constrain_insn, at recog.c:2213)
2017-01-17  Vladimir Makarov  <vmakarov@redhat.com>

	PR target/79058
	* ira-conflicts.c (ira_build_conflicts): Update total conflict
	hard regs for inner regno.

2017-01-17  Vladimir Makarov  <vmakarov@redhat.com>

	PR target/79058
	* gcc.target/arm/pr79058.c: New.

From-SVN: r244535
2017-01-17 16:11:55 +00:00
Jakub Jelinek c549996eed re PR tree-optimization/71854 (ICE at -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu (verify_gimple failed))
PR tree-optimization/71854
	* gcc.dg/vect/pr71854.c: New test.

From-SVN: r244534
2017-01-17 16:50:24 +01:00
Martin Liska 4f197ff9a8 Fix wrong assumption in contains_type_p (PR ipa/71207).
2017-01-17  Martin Liska  <mliska@suse.cz>

	PR ipa/71207
	* g++.dg/ipa/pr71207.C: New test.
2017-01-17  Martin Liska  <mliska@suse.cz>

	PR ipa/71207
	* ipa-polymorphic-call.c (contains_type_p): Fix wrong
	assumption and add comment.

From-SVN: r244530
2017-01-17 15:11:00 +00:00
Jan Hubicka d4193b85ae re PR tree-optimization/77445 (Performance drop after r239219 on coremark test)
PR middle-end/77445
	* tree-ssa-threadupdate.c (remove_ctrl_stmt_and_useless_edges):
	correctly set frequency of oudgoing edge.
	(duplicate_thread_path): Fix profile updating.
	* gcc.dg/tree-ssa/pr77445-2.c: New testcase.
	* gcc.dg/tree-ssa/pr77445.c: New testcase.

From-SVN: r244528
2017-01-17 12:49:41 +00:00
Jakub Jelinek 906e771270 ssa-dse-2.C (size_t): Typedef to __SIZE_TYPE__ rather than long unsigned int.
* g++.dg/tree-ssa/ssa-dse-2.C (size_t): Typedef to __SIZE_TYPE__
	rather than long unsigned int.
	* g++.dg/tree-ssa/ssa-dom.C: Likewise.

From-SVN: r244527
2017-01-17 11:14:40 +01:00
Richard Biener 12314dc989 re PR tree-optimization/71433 (-Warray-bounds false positive with -O2)
2017-01-17  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/71433
	* tree-vrp.c (register_new_assert_for): Merge same asserts
	on all incoming edges.
	(process_assert_insertions_for): Handle insertions at the
	beginning of BBs.

	* gcc.dg/Warray-bounds-20.c: New testcase.

From-SVN: r244520
2017-01-17 08:38:59 +00:00
Richard Biener a23e48df45 re PR testsuite/52563 (FAIL: gcc.dg/tree-ssa/scev-[3,4].c scan-tree-dump-times optimized "&a" 1)
2017-01-17  Richard Biener  <rguenther@suse.de>

	PR testsuite/52563
	PR testsuite/71237
	PR testsuite/77737
	* gcc.dg/tree-ssa/scev-3.c: Re-write to a GIMPLE testcase for IVOPTs.
	* gcc.dg/tree-ssa/scev-4.c: Likewise.
	* gcc.dg/tree-ssa/scev-5.c: Likewise.

From-SVN: r244519
2017-01-17 08:24:26 +00:00
Alan Modra e6750e5ce0 PR79066, non-PIC code generated for powerpc glibc with -fpic
PR target/79066
	* config/rs6000/rs6000.md (elf_high, elf_low): Disable when pic.
	* config/rs6000/rs6000.c (rs6000_emit_allocate_stack): Don't allow
	symbolic stack limit when pic.
testsuite/
	* gcc.target/powerpc/pr79066.c: New.

From-SVN: r244515
2017-01-17 13:24:11 +10:30
Jeff Law a59afbe2fe re PR tree-optimization/79090 (DSE wrongly removes store at variable offset)
2017-01-16  Jeff Law  <law@redhat.com>

	PR tree-optimization/79090
	PR tree-optimization/33562
	PR tree-optimization/61912
	PR tree-optimization/77485
	* tree-ssa-dse.c (compute_trims): Accept STMT argument.  Dump STMT
	and computed trims into the dump file.

	PR tree-optimization/79090
	PR tree-optimization/33562
	PR tree-optimization/61912
	PR tree-optimization/77485
	* tree-ssa-dse.c (compute_trims): Accept STMT argument.  Dump STMT
	and computed trims into the dump file.

From-SVN: r244509
2017-01-16 16:43:05 -07:00
Jakub Jelinek 98e92fb210 re PR middle-end/79089 (error: incorrect sharing of tree nodes)
PR c/79089
	* gimplify.c (gimplify_init_constructor): If want_value and
	object == lhs, unshare lhs to avoid invalid tree sharing.  Formatting
	fix.

	* gcc.c-torture/compile/pr79089.c: New test.

From-SVN: r244507
2017-01-16 22:35:30 +01:00
Jakub Jelinek e1bcfb924a re PR target/79080 (ICE: internal consistency failure (error: invalid rtl sharing found in the insn) (error: shared rtx))
PR target/79080
	* loop-doloop.c (doloop_modify): Call unshare_all_rtl_in_chain on
	sequence.  Formatting fixes.
	(doloop_optimize): Formatting fixes.

	* gcc.dg/pr79080.c: New test.

From-SVN: r244506
2017-01-16 22:34:35 +01:00
David Malcolm 0ef1f9cd8c Fix testcases for PR c/78304
The testcases as written made assumptions about size_t and long
being invalid for use with "%u".

We only need some invalid type, so this patch converts them to
attempt a "const char *" with "%u", which should be invalid for
every target.

gcc/testsuite/ChangeLog:
	PR c/78304
	* gcc.dg/format/pr78304.c: Convert argument from integral type
	to a pointer.
	* gcc.dg/format/pr78304-2.c: Likewise.

From-SVN: r244502
2017-01-16 18:08:45 +00:00
Carl Love 76689ffc1e rs6000-c (altivec_overloaded_builtins): Add support for built-in functions vector signed char vec_nabs (vector signed...
gcc/ChangeLog:

2017-01-16  Carl Love  <cel@us.ibm.com>

	* config/rs6000/rs6000-c (altivec_overloaded_builtins): Add support
	for built-in functions
	vector signed char vec_nabs (vector signed char)
	vector signed short vec_nabs (vector signed short)
	vector signed int vec_nabs (vector signed int)
	vector signed long long vec_nabs (vector signed long long)
	vector float vec_nabs (vector float)
	vector double vec_nabs (vector double)
	* config/rs6000/rs6000-builtin.def: Add definitions for NABS functions
	and NABS overload.
	* config/rs6000/altivec.md: New define_expand nabs<mode>2 types
	* config/rs6000/altivec.h: New define for vec_nabs built-in function.
	* doc/extend.texi: Update the documentation file for the new built-in
	functions.

gcc/testsuite/ChangeLog:

2017-01-16  Carl Love  <cel@us.ibm.com>

	* gcc.target/powerpc/builtins-3.c: New vec_nabs testcase.
	* gcc.target/powerpc/builtins-3-p8.c: New vec_nabs testcase.

From-SVN: r244501
2017-01-16 17:18:05 +00:00
Carl Love ce12ee9e68 builtins-3-p9.c (test_ne_long()): Change arguments and return type to bool long long.
gcc/testsuite/ChangeLog:

2017-01-16 Carl Love  <cel@us.ibm.com>

	* gcc.target/powerpc/builtins-3-p9.c (test_ne_long()):
	Change arguments and return type to bool long long.

From-SVN: r244499
2017-01-16 17:03:14 +00:00
Martin Sebor b336037ddc PR testsuite/79051 - FAIL: gcc.dg/attr-alloc_size-4.c (test for warnings, line 140)
gcc/testsuite/ChangeLog:
	* gcc.dg/attr-alloc_size-4.c: Avoid exercising a test case except
	on x86.

From-SVN: r244497
2017-01-16 08:50:47 -07:00
Paolo Carlini 1ddca3f365 revert: re PR c++/71737 (ICE following 2x pack expansion in non-pack with template alias)
/c-family
2017-01-16  Paolo Carlini  <paolo.carlini@oracle.com>

	Revert:
     	2017-01-16  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/71737
	* c-common.c (set_underlying_type): Always set DECL_ORIGINAL_TYPE.

/testsuite
2017-01-16  Paolo Carlini  <paolo.carlini@oracle.com>

	Revert:
        2017-01-16  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/71737
	* g++.dg/cpp0x/pr71737.C: New.

From-SVN: r244496
2017-01-16 15:43:06 +00:00
Bill Schmidt 290687fb4e rs6000.c (rtx_is_swappable_p): Change UNSPEC_VSX__XXSPLTD to require special splat handling.
[gcc]

2017-01-16  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	* config/rs6000/rs6000.c (rtx_is_swappable_p): Change
	UNSPEC_VSX__XXSPLTD to require special splat handling.

[gcc/testsuite]

2017-01-16  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	* gcc.target/powerpc/swaps-p8-27.c: New.

From-SVN: r244495
2017-01-16 15:05:35 +00:00
Paolo Carlini 7d2f3f1d29 re PR c++/71737 (ICE following 2x pack expansion in non-pack with template alias)
/c-family
2017-01-16  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/71737
	* c-common.c (set_underlying_type): Always set DECL_ORIGINAL_TYPE.

/testsuite
2017-01-16  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/71737
	* g++.dg/cpp0x/pr71737.C: New.

From-SVN: r244486
2017-01-16 09:09:30 +00:00
Eric Botcazou d743728f90 opt62.adb: New test.
* gnat.dg/opt62.adb: New test.
	* gnat.dg/opt62_pkg.ads: New helper.

From-SVN: r244485
2017-01-16 08:46:20 +00:00
Bernd Schmidt 90aead2189 re PR rtl-optimization/78626 (ICE in rtl_verify_bb_insns, at cfgrtl.c:2656 (error: flow control insn inside a basic block))
PR rtl-optimization/78626
	PR rtl-optimization/78727
	* cprop.c (one_cprop_pass): Collect unconditional traps in the middle
	of a block, and split such blocks after everything else is finished.

        PR rtl-optimization/78626
        PR rtl-optimization/78727
	* gcc.dg/torture/pr78626.c: New test.
	* gcc.dg/torture/pr78727.c: New test.

From-SVN: r244467
2017-01-14 09:52:18 -07:00
Alan Modra afaecc23b5 Testcase from pr72749
PR target/72749
	* gcc.c-torture/compile/pr72749.c: New test.

From-SVN: r244466
2017-01-14 23:59:29 +10:30
Janne Blomqvist c1e9bbcc49 Revert r244448
From-SVN: r244454
2017-01-13 21:53:16 +02:00
David Malcolm be4aa83d6f Don't suppress bogus usage of macros from system headers in -Wformat (PR c/78304)
gcc/ChangeLog:
	PR c/78304
	* substring-locations.c (format_warning_va): Strengthen case 1 so
	that both endpoints of the substring must be within the format
	range for just the substring to be printed.

gcc/testsuite/ChangeLog:
	PR c/78304
	* gcc.dg/format/diagnostic-ranges.c (test_macro): Undef INT_FMT.
	(test_macro_2): New test.
	(test_macro_3): New test.
	(test_macro_4): New test.
	(test_non_contiguous_strings): Convert line number to line offset.
	* gcc.dg/format/pr78304-2.c: New test case.
	* gcc.dg/format/pr78304.c: New test case.

From-SVN: r244453
2017-01-13 19:27:43 +00:00
Uros Bizjak 7cdca3ec8a i386.opt (msgx): Use ix86_isa_flags2 variable.
* config/i386/i386.opt (msgx): Use ix86_isa_flags2 variable.
	* config/i386/i386.c (ix86_target_string): Add missing options
	to isa_opts and reorder options by implied ISAs.  Rename isa_opts2 to
	isa2_opts, ix86_flag_opts to flag2_opts, ix86_target_other to
	flags_other and ix86_target_other to flags2_other.  Display unknown
	isa2 options.
	(ix86_valid_target_attribute_inner_p): Add missing options and
	reorder options by implied ISAs, as in ix86_target_string.

testsuite/ChangeLog:

	* gcc.target/i386/funcspec-56.inc: Add missing options and
	reorder options by implied ISAs, as in ix86_target_string.

From-SVN: r244452
2017-01-13 19:32:44 +01:00
Marek Polacek e3017e522a re PR c++/71166 (ICE with nested constexpr/initializer)
PR c++/71166
	* g++.dg/cpp0x/constexpr-array18.C: New test.

From-SVN: r244450
2017-01-13 17:27:54 +00:00
Janne Blomqvist a6ab4e077b PR 78534 Change character length from int to size_t
In order to handle large character lengths on (L)LP64 targets, switch
the GFortran character length from an int to a size_t.

This is an ABI change, as procedures with character arguments take
hidden arguments with the character length.

I also changed the _size member in vtables from int to size_t, as
there were some cases where character lengths and sizes were
apparently mixed up and caused regressions otherwise. Although I
haven't tested, this might enable very large derived types as well.

Also, as there are some places in the frontend were negative character
lengths are used as special flag values, in the frontend the character
length is handled as a signed variable of the same size as a size_t,
although in the runtime library it really is size_t.

I haven't changed the character length variables for the co-array
intrinsics, as this is something that may need to be synchronized with
OpenCoarrays.

This is v4 of the patch. v3 was applied but had to reverted due to
breaking bootstrap. The fix is in resolve.c:resolve_charlen, where
it's necessary to check that an expression is constant before using
mpz_sgn.

Overview of v3 of the patch: All the issues pointed out by FX's review
of v2 have been fixed. In particular, there are now new functions
gfc_mpz_get_hwi and gfc_mpz_set_hwi, similar to the GMP functions
mpz_get_si and mpz_set_si, except that they get/set a HOST_WIDE_INT
instead of a long value. Similarly, gfc_get_int_expr now takes a
HOST_WIDE_INT instead of a long, gfc_extract_long is replaced by
gfc_extract_hwi. Also, the preliminary work to handle
gfc_charlen_type_node being unsigned has been removed.

Regtested on x86_64-pc-linux-gnu and i686-pc-linux-gnu.

frontend:

2017-01-13  Janne Blomqvist  <jb@gcc.gnu.org>

	PR fortran/78534
	PR fortran/66310
	* class.c (gfc_find_derived_vtab): Use gfc_size_kind instead of
	hardcoded kind.
	(find_intrinsic_vtab): Likewise.
	* expr.c (gfc_get_character_expr): Length parameter of type
	gfc_charlen_t.
	(gfc_get_int_expr): Value argument of type HOST_WIDE_INT.
	(gfc_extract_hwi): New function.
	(simplify_const_ref): Make string_len of type gfc_charlen_t.
	(gfc_simplify_expr): Use HOST_WIDE_INT for substring refs.
	* gfortran.h (gfc_mpz_get_hwi): New prototype.
	(gfc_mpz_set_hwi): Likewise.
	(gfc_charlen_t): New typedef.
	(gfc_expr): Use gfc_charlen_t for character lengths.
	(gfc_size_kind): New extern variable.
	(gfc_extract_hwi): New prototype.
	(gfc_get_character_expr): Use gfc_charlen_t for character length.
	(gfc_get_int_expr): Use HOST_WIDE_INT type for value argument.
	* iresolve.c (gfc_resolve_repeat): Pass string length directly without
	temporary, use gfc_charlen_int_kind.
	* match.c (select_intrinsic_set_tmp): Use HOST_WIDE_INT for charlen.
	* misc.c (gfc_mpz_get_hwi): New function.
	(gfc_mpz_set_hwi): New function.
	* module.c (atom_int): Change type from int to HOST_WIDE_INT.
	(parse_integer): Don't complain about large integers.
	(write_atom): Use HOST_WIDE_INT for integers.
	(mio_integer): Handle integer type mismatch.
	(mio_hwi): New function.
	(mio_intrinsic_op): Use HOST_WIDE_INT.
	(mio_array_ref): Likewise.
	(mio_expr): Likewise.
	* resolve.c (resolve_select_type): Use HOST_WIDE_INT for charlen,
	use snprintf.
	(resolve_substring_charlen): Use gfc_charlen_int_kind.
	(resolve_charlen): Use mpz_sgn to determine sign.
	* simplify.c (gfc_simplify_repeat): Use HOST_WIDE_INT/gfc_charlen_t
	instead of long.
	* target-memory.c (size_character): Length argument of type
	gfc_charlen_t.
	(gfc_encode_character): Likewise.
	(gfc_interpret_character): Use gfc_charlen_t.
	* target-memory.h (gfc_encode_character): Modify prototype.
	* trans-array.c (get_array_ctor_var_strlen): Use
	gfc_conv_mpz_to_tree_type.
	* trans-const.c (gfc_conv_mpz_to_tree_type): New function.
	* trans-const.h (gfc_conv_mpz_to_tree_type): New prototype.
	* trans-expr.c (gfc_class_len_or_zero_get): Build const of type
	gfc_charlen_type_node.
	(gfc_conv_intrinsic_to_class): Use gfc_charlen_int_kind instead of
	4, fold_convert to correct type.
	(gfc_conv_class_to_class): Build const of type size_type_node for
	size.
	(gfc_copy_class_to_class): Likewise.
	(gfc_conv_string_length): Use same type in expression.
	(gfc_conv_substring): Likewise, use HOST_WIDE_INT for charlen.
	(gfc_conv_string_tmp): Make sure len is of the right type.
	(gfc_conv_concat_op): Use same type in expression.
	(gfc_conv_procedure_call): Likewise.
	(alloc_scalar_allocatable_for_subcomponent_assignment):
	fold_convert to right type.
	(gfc_trans_subcomponent_assign): Likewise.
	(trans_class_vptr_len_assignment): Build const of correct type.
	(gfc_trans_pointer_assignment): Likewise.
	(alloc_scalar_allocatable_for_assignment): fold_convert to right
	type in expr.
	(trans_class_assignment): Build const of correct type.
	* trans-intrinsic.c (gfc_conv_associated): Likewise.
	(gfc_conv_intrinsic_repeat): Do calculation in sizetype.
	* trans-io.c (gfc_build_io_library_fndecls): Use
	gfc_charlen_type_node for character lengths.
	* trans-stmt.c (gfc_trans_label_assign): Build const of
	gfc_charlen_type_node.
	(gfc_trans_character_select): Likewise.
	(gfc_trans_allocate): Likewise, don't typecast strlen result.
	(gfc_trans_deallocate): Don't typecast strlen result.
	* trans-types.c (gfc_size_kind): New variable.
	(gfc_init_types): Determine gfc_charlen_int_kind and gfc_size_kind
	from size_type_node.

testsuite:

2017-01-13  Janne Blomqvist  <jb@gcc.gnu.org>

	PR fortran/78534
	PR fortran/66310
	* gfortran.dg/repeat_4.f90: Use integers of kind C_SIZE_T.
	* gfortran.dg/repeat_7.f90: New test for PR 66310.
	* gfortran.dg/scan_2.f90: Handle potential cast in assignment.
	* gfortran.dg/string_1.f90: Limit to ilp32 targets.
	* gfortran.dg/string_1_lp64.f90: New test.
	* gfortran.dg/string_3.f90: Limit to ilp32 targets.
	* gfortran.dg/string_3_lp64.f90: New test.

libgfortran:

2017-01-13  Janne Blomqvist  <jb@gcc.gnu.org>

	PR fortran/78534
	* intrinsics/args.c (getarg_i4): Use gfc_charlen_type.
	(get_command_argument_i4): Likewise.
	(get_command_i4): Likewise.
	* intrinsics/chmod.c (chmod_internal): Likewise.
	* intrinsics/env.c (get_environment_variable_i4): Likewise.
	* intrinsics/extends_type_of.c (struct vtype): Use size_t for size
	member.
	* intrinsics/gerror.c (gerror): Use gfc_charlen_type.
	* intrinsics/getlog.c (getlog): Likewise.
	* intrinsics/hostnm.c (hostnm_0): Likewise.
	* intrinsics/string_intrinsics_inc.c (string_len_trim): Rework to
	work if gfc_charlen_type is unsigned.
	(string_scan): Likewise.
	* io/transfer.c (transfer_character): Modify prototype.
	(transfer_character_write): Likewise.
	(transfer_character_wide): Likewise.
	(transfer_character_wide_write): Likewise.
	(transfer_array): Typecast to avoid signed-unsigned comparison.
	* io/unit.c (is_trim_ok): Use gfc_charlen_type.
	* io/write.c (namelist_write): Likewise.
	* libgfortran.h (gfc_charlen_type): Change typedef to size_t.

From-SVN: r244448
2017-01-13 19:05:48 +02:00
Jeff Law 7c9560a578 tree-ssa-dse.c (decrement_count): New function.
* tree-ssa-dse.c (decrement_count): New function.
	(increment_start_addr, maybe_trim_memstar_call): Likewise.
	(dse_dom_walker::optimize_stmt): Call maybe_trim_memstar_call directly
	when we know the partially dead statement is a mem* function.

	* gcc.dg/tree-ssa/ssa-dse-25.c: New test.

From-SVN: r244444
2017-01-13 08:50:11 -07:00
Jeff Law 9e59e99a60 re PR middle-end/61912 (Missed (partial) dead store elimination for structures on GIMPLE)
PR tree-optimization/61912
	PR tree-optimization/77485
	* tree-ssa-dse.c: Include expr.h.
	(maybe_trim_constructor_store): New function.
	(maybe_trim_partially_dead_store): Call maybe_trim_constructor_store.

	PR tree-optimization/61912
	PR tree-optimization/77485
	* g++.dg/tree-ssa/ssa-dse-1.C: New test.
	* gcc.dg/tree-ssa/pr30375: Adjust expected output.
	* gcc.dg/tree-ssa/ssa-dse-24.c: New test.

From-SVN: r244443
2017-01-13 08:46:22 -07:00
Jeff Law d155c6fef0 re PR tree-optimization/33562 (aggregate DSE disabled)
PR tree-optimization/33562
        PR tree-optimization/61912
        PR tree-optimization/77485
	* doc/invoke.texi: Document new dse-max-object-size param.
	* params.def (PARM_DSE_MAX_OBJECT_SIZE): New PARAM.
	* tree-ssa-dse.c: Include params.h.
	(dse_store_status): New enum.
	(initialize_ao_ref_for_dse): New, partially extracted from
	dse_optimize_stmt.
	(valid_ao_ref_for_dse, normalize_ref): New.
	(setup_live_bytes_from_ref, compute_trims): Likewise.
	(clear_bytes_written_by, maybe_trim_complex_store): Likewise.
	(maybe_trim_partially_dead_store): Likewise.
	(maybe_trim_complex_store): Likewise.
	(dse_classify_store): Renamed from dse_possibly_dead_store_p.
	Track what bytes live from the original store.  Return tri-state
	for dead, partially dead or live.
	(dse_dom_walker): Add constructor, destructor and new private members.
	(delete_dead_call, delete_dead_assignment): New extracted from
	dse_optimize_stmt.
	(dse_optimize_stmt): Make a member of dse_dom_walker.
	Use initialize_ao_ref_for_dse.

        PR tree-optimization/33562
        PR tree-optimization/61912
        PR tree-optimization/77485
	* gcc.dg/tree-ssa/complex-4.c: Remove xfail.
	* gcc.dg/tree-ssa/complex-5.c: Likewise.
	* gcc.dg/tree-ssa/ssa-dse-9.c: Likewise.
	* gcc.dg/tree-ssa/ssa-dse-18.c: New test.
	* gcc.dg/tree-ssa/ssa-dse-19.c: Likewise.
	* gcc.dg/tree-ssa/ssa-dse-20.c: Likewise.
	* gcc.dg/tree-ssa/ssa-dse-21.c: Likewise.

From-SVN: r244442
2017-01-13 08:42:08 -07:00
Martin Liska 77719b0675 Reload global options when strict aliasing is dropped (PR ipa/79043).
2017-01-13  Martin Liska  <mliska@suse.cz>

	PR ipa/79043
	* function.c (set_cfun): Add new argument force.
	* function.h (set_cfun): Likewise.
	* ipa-inline-transform.c (inline_call): Use the function when
	strict alising from is dropped for function we inline to.
2017-01-13  Martin Liska  <mliska@suse.cz>

	PR ipa/79043
	* gcc.c-torture/execute/pr79043.c: New test.

From-SVN: r244435
2017-01-13 12:56:54 +00:00
Richard Biener a181b2bcd7 re PR middle-end/78411 (FAIL: gcc.target/i386/pr45685.c scan-assembler-times cmov 6)
2017-01-13  Richard Biener  <rguenther@suse.de>

	PR middle-end/78411
	* gcc.target/i386/pr45685.c: Add -ftree-loop-if-convert.

From-SVN: r244427
2017-01-13 11:34:40 +00:00
Andre Vehreschild eaed322611 re PR fortran/70697 ([Coarray] ICE on EVENT WAIT with array element UNTIL_COUNT argument)
gcc/testsuite/ChangeLog:

2017-01-13  Andre Vehreschild  <vehre@gcc.gnu.org>

	PR fortran/70697
	* gfortran.dg/coarray/event_4.f08: New test.


gcc/fortran/ChangeLog:

2017-01-13  Andre Vehreschild  <vehre@gcc.gnu.org>

	PR fortran/70697
	* resolve.c (resolve_lock_unlock_event): Resolve the expression for
	event's until_count.

From-SVN: r244413
2017-01-13 11:39:52 +01:00
Andre Vehreschild 4ccff88b71 re PR fortran/70696 ([Coarray] ICE on EVENT POST of host-associated EVENT_TYPE coarray)
gcc/testsuite/ChangeLog:

2017-01-13  Andre Vehreschild  <vehre@gcc.gnu.org>

	PR fortran/70696
	* gfortran.dg/coarray/event_3.f08: New test.

gcc/fortran/ChangeLog:

2017-01-13  Andre Vehreschild  <vehre@gcc.gnu.org>

	PR fortran/70696
	* trans-expr.c (gfc_get_tree_for_caf_expr): Ensure the backend_decl
	is valid before accessing it.

libgfortran/ChangeLog:

2017-01-13  Andre Vehreschild  <vehre@gcc.gnu.org>

	PR fortran/70696
	* caf/single.c (_gfortran_caf_register): Allocate enough memory for
	the event counter.

From-SVN: r244407
2017-01-13 11:22:21 +01:00
Richard Biener 3c3b9090f8 re PR tree-optimization/77283 (Revision 238005 disables loop unrolling)
2017-01-13  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/77283
	* gcc.dg/tree-ssa/split-path-9.c: Fix.

From-SVN: r244394
2017-01-13 08:47:57 +00:00
Richard Biener 2532991330 gimple-parser.c (c_parser_gimple_postfix_expression): Parse _Literal ( type-name ) number.
2017-01-13  Richard Biener  <rguenther@suse.de>

	c/
	* gimple-parser.c (c_parser_gimple_postfix_expression): Parse
	_Literal ( type-name ) number.

	* tree-pretty-print.c (dump_generic_node): Dump INTEGER_CSTs
	as _Literal ( type ) number in case usual suffixes do not
	preserve all information.

	* gcc.dg/gimplefe-22.c: New testcase.

From-SVN: r244393
2017-01-13 08:16:59 +00:00
Richard Biener 10b70b8e5e re PR tree-optimization/77283 (Revision 238005 disables loop unrolling)
2017-01-13  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/77283
	* gimple-ssa-split-paths.c: Include gimple-ssa.h, tree-phinodes.h
	and ssa-iterators.h.
	(is_feasible_trace): Implement a cost model based on joiner
	PHI node uses.

	* gcc.dg/tree-ssa/split-path-7.c: Adjust.
	* gcc.dg/tree-ssa/split-path-8.c: New testcase.
	* gcc.dg/tree-ssa/split-path-9.c: Likewise.

From-SVN: r244392
2017-01-13 08:11:01 +00:00
Sandra Loosemore 76a8f82f47 pr77862.c: Require fpic target.
2017-01-12  Sandra Loosemore  <sandra@codesourcery.com>

	gcc/testsuite/
	* gcc.dg/pr77862.c: Require fpic target.

From-SVN: r244387
2017-01-12 17:42:33 -05:00
Michael Meissner 59a505da6b re PR target/79004 (ICE in gcc.dg/torture/fp-int-convert-float128-ieee.c with -mcpu=power9)
[gcc]
2017-01-12  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/79004
	* config/rs6000/rs6000.md (FP_ISA3): Do not optimize converting
	char or short to __float128/_Float128 directly.

[gcc/testsuite]
2017-01-12  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/79004
	* gcc.target/powerpc/pr79004.c: New test.

From-SVN: r244386
2017-01-12 22:02:57 +00:00
Martin Sebor bce6f76013 (-Wformat-overflow): ...to this.
gcc/c-family/ChangeLog:

	(-Wformat-overflow): ...to this.

gcc/ChangeLog:

	to -Wformat-overflow.
	* gimple-ssa-sprintf.c (pass_sprintf_length::gate): Adjust.
	(min_bytes_remaining): Same.
	(get_string_length): Same.
	(format_string): Same.
	(format_directive): Same.
	(add_bytes): Same.
	(pass_sprintf_length::handle_gimple_call): Same.

gcc/testsuite/ChangeLog:

	* gcc.dg/pr78138.c: Adjust.
	* gcc.dg/pr78768.c: Adjust.
	* gcc.dg/tree-ssa/builtin-sprintf-4.c: Adjust.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: Adjust.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-2.c: Adjust.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-3.c: Adjust.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-4.c: Adjust.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-6.c: Adjust.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-7.c: Adjust.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-8.c: Adjust.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-9.c: Adjust.
	* gcc.dg/tree-ssa/pr78605.c: Adjust.
	* gcc.dg/tree-ssa/pr78622.c: Adjust.

From-SVN: r244385
2017-01-12 14:54:41 -07:00
Jakub Jelinek 3eefa646f4 gimple-ssa-sprintf.c (try_substitute_return_value): Remove info.nowrite calls with no lhs that can't throw.
* gimple-ssa-sprintf.c (try_substitute_return_value): Remove
	info.nowrite calls with no lhs that can't throw.  Return bool
	whether gsi_remove has been called or not.
	(pass_sprintf_length::handle_gimple_call): Return bool whether
	try_substitute_return_value called gsi_remove.  Formatting fix.
	(pass_sprintf_length::execute): Don't use gsi_remove if
	handle_gimple_call returned true.

	* gcc.dg/tree-ssa/builtin-snprintf-1.c: New test.

From-SVN: r244384
2017-01-12 22:30:56 +01:00
Martin Sebor 940242cd07 re PR testsuite/79051 (FAIL: gcc.dg/attr-alloc_size-4.c (test for warnings, line 140))
PR testsuite/79051

gcc/testsuite/ChangeLog:
	* gcc.dg/attr-alloc_size-4.c: Work harder to avoid false negatives
	due to bug 79054.

From-SVN: r244382
2017-01-12 11:50:26 -07:00