Thomas Koenig [Sat, 30 Nov 2019 15:08:32 +0000 (15:08 +0000)]
backport: re PR fortran/91783 (ICE in gfc_dep_resolver, at fortran/dependency.c:2111)
Backport from trunk as an insurance policy.
2019-11-30 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/91783
* gfortran.dg/dependency_56.f90: New test. Backport from trunk on
the off-chance that somebody backports something that will break
this test case.
Eric Botcazou [Fri, 29 Nov 2019 09:07:53 +0000 (09:07 +0000)]
re PR ada/92489 (internal error on Invalid_Value Attribute attribute)
PR ada/92489
Backport from mainline
2019-07-01 Ed Schonberg <schonberg@adacore.com>
* exp_attr.adb (Expand_Attribute_Reference, case Invalid_Value):
Resolve result of call to Get_Simple_Init_Val, which may be a
conversion of a literal.
Richard Biener [Wed, 27 Nov 2019 12:09:36 +0000 (12:09 +0000)]
backport: re PR tree-optimization/92222 (ice in useless_type_conversion_p, at gimple-expr.c:86)
2019-11-27 Richard Biener <rguenther@suse.de>
Backport from mainline
2019-10-25 Richard Biener <rguenther@suse.de>
PR tree-optimization/92222
* tree-vect-slp.c (_slp_oprnd_info::first_pattern): Remove.
(_slp_oprnd_info::second_pattern): Likewise.
(_slp_oprnd_info::any_pattern): New.
(vect_create_oprnd_info): Adjust.
(vect_get_and_check_slp_defs): Compute whether any stmt is
in a pattern.
(vect_build_slp_tree_2): Avoid building up a node from scalars
if any of the operand defs, not just the first, is in a pattern.
Jerry DeLisle [Tue, 26 Nov 2019 22:56:24 +0000 (22:56 +0000)]
backport: re PR libfortran/92100 (Formatted stream IO irreproducible read with binary data in file)
2019-11-26 Jerry DeLisle <jvdelisle@gcc.ngu.org>
Backport from mainline
PR fortran/92100
io/transfer.c (data_transfer_init_worker): Use fbuf_reset
instead of fbuf_flush before the seek. Note that fbuf_reset
calls fbuf_flush and adjusts fbuf pointers.
Eric Botcazou [Mon, 25 Nov 2019 10:52:33 +0000 (10:52 +0000)]
re PR ada/92362 (double elaboration of expression in Address aspect)
PR ada/92362
* gcc-interface/trans.c (gnat_to_gnu) <N_Attribute_Definition_Clause>:
Use a temporary instead of clobbering the result with a freeze node.
Jonathan Wakely [Fri, 22 Nov 2019 12:36:18 +0000 (12:36 +0000)]
PR libstdc++/92267 fix ABI change in deque iterators
Defaulting the copy constructor on its first declaration made it change
from user-provided (and non-trivial) to implicitly-defined (and
trivial). This caused an ABI incompatibility between GCC 8 and GCC 9,
where functions taking a deque iterator disagree on the argument passing
convention.
Backport from mainline
2019-10-29 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/92267
* include/bits/stl_deque.h (_Deque_iterator(const _Deque_iterator&)):
Do not define as defaulted.
* testsuite/23_containers/deque/types/92267.cc: New test.
Michael Matz [Wed, 20 Nov 2019 16:51:10 +0000 (16:51 +0000)]
re PR middle-end/90796 (GCC: O2 vs O3 output differs on simple test)
Fix PR90796
PR middle-end/90796
* gimple-loop-jam.c (any_access_function_variant_p): New function.
(adjust_unroll_factor): Use it to constrain safety, new parameter.
(tree_loop_unroll_and_jam): Adjust call and profitable unroll factor.
testsuite/
Backport from mainline
PR middle-end/90796
* gcc.dg/unroll-and-jam.c: Disable loop-invariant motion and adjust.
PR middle-end/90796
* gcc.dg/unroll-and-jam.c: Add three invalid and one valid case.
Joseph Myers [Wed, 20 Nov 2019 16:43:14 +0000 (16:43 +0000)]
Document -Wc11-c2x-compat.
My patch that added initial C2X support and associated command-line
options missed documenting -Wc11-c2x-compat although the other options
were properly documented. This patch adds the missing documentation.
Jakub Jelinek [Wed, 20 Nov 2019 09:55:56 +0000 (10:55 +0100)]
re PR c++/90767 (jumbled error message with this and const)
PR c++/90767
* call.c (complain_about_no_candidates_for_method_call): If
conv->from is not a type, pass to complain_about_bad_argument
lvalue_type of conv->from.
* g++.dg/diagnostic/pr90767-1.C: New test.
* g++.dg/diagnostic/pr90767-2.C: New test.
Jakub Jelinek [Wed, 20 Nov 2019 09:55:01 +0000 (10:55 +0100)]
re PR middle-end/90840 (ICE in simplify_subreg, at simplify-rtx.c:6441)
PR middle-end/90840
* expmed.c (store_bit_field_1): Handle the case where op0 is not a MEM
and has a mode that doesn't have corresponding integral type.
Jakub Jelinek [Wed, 20 Nov 2019 09:54:02 +0000 (10:54 +0100)]
re PR target/90867 (Multiplication or typecast of integer and double always zero when...)
PR target/90867
* config/i386/i386.c (ix86_valid_target_attribute_tree): Don't
clear opts->x_ix86_isa_flags{,2} here...
(ix86_valid_target_attribute_inner_p): ... but here when seeing
arch=. Also clear opts->x_ix86_isa_flags{,2}_explicit.
Jakub Jelinek [Wed, 20 Nov 2019 09:52:27 +0000 (10:52 +0100)]
backport: re PR c++/92504 (ICE on gcc-9 -fopenmp: internal compiler error: tree check: expected tree that contains 'decl common' structure, have 'baselink' in get_inner_reference, at expr.c:7238)
Backported from mainline
2019-11-19 Jakub Jelinek <jakub@redhat.com>
PR c++/92504
* semantics.c (handle_omp_for_class_iterator): Don't call
cp_fully_fold on cond.
Jakub Jelinek [Tue, 19 Nov 2019 09:26:23 +0000 (10:26 +0100)]
re PR middle-end/91450 (__builtin_mul_overflow(A,B,R) wrong code if product < 0, *R is unsigned, and !(A&B))
PR middle-end/91450
* internal-fn.c (expand_mul_overflow): For s1 * s2 -> ur, if one
operand is negative and one non-negative, compare the non-negative
one against 0 rather than comparing s1 & s2 against 0. Otherwise,
don't compare (s1 & s2) == 0, but compare separately both s1 == 0
and s2 == 0, unless one of them is known to be negative. Remove
tem2 variable, use tem where tem2 has been used before.
* gcc.c-torture/execute/pr91450-1.c: New test.
* gcc.c-torture/execute/pr91450-2.c: New test.
Ilya Leoshkevich [Fri, 15 Nov 2019 12:55:05 +0000 (12:55 +0000)]
Free dominance info at the beginning of pass_jump_after_combine
try_forward_edges does not update dominance info, and merge_blocks
relies on it being up-to-date. In PR92430 stale dominance info makes
merge_blocks produce a loop in the dominator tree, which in turn makes
delete_basic_block loop forever.
Fix by freeing dominance info at the beginning of cleanup_cfg.
Also, since the whole point of this pass is to perform jump threading
(other cleanups are not valuable at this point), skip it completely when
flag_thread_jumps is not set.
gcc/ChangeLog:
2019-11-15 Ilya Leoshkevich <iii@linux.ibm.com>
Backport from mainline
PR rtl-optimization/92430
* cfgcleanup.c (pass_jump_after_combine::gate): New function.
(pass_jump_after_combine::execute): Free
dominance info at the beginning.
gcc/testsuite/ChangeLog:
2019-11-15 Ilya Leoshkevich <iii@linux.ibm.com>
Backport from mainline
PR rtl-optimization/92430
* gcc.dg/pr92430.c: New test (from Arseny Solokha).
This was dormant for quite some time, but it started happening for me
on gcc.c-torture/compile/pr65153.c sometime after r276645 for -mabi=32 linux runs.
The pattern accepts any SMALL_OPERAND constant value while it asserts during the final
that the value is in the mode size range. I this case it happens that combine_and_move_insns
during ira makes a pattern with negative "shift count" which fails at final stage.
This simple fix just truncates the constant operand to mode size the same as shift patterns.
Eric Botcazou [Wed, 13 Nov 2019 11:59:20 +0000 (11:59 +0000)]
c-ada-spec.c (get_underlying_decl): Do not look through typedefs.
* c-ada-spec.c (get_underlying_decl): Do not look through typedefs.
(dump_forward_type): Do not generate a declaration for function types.
(dump_nested_type) <ARRAY_TYPE>: Do not generate a nested declaration
of the component type if it is declared in another file.
Thomas Schwinge [Mon, 11 Nov 2019 08:06:25 +0000 (09:06 +0100)]
[build] Properly track GCC language configure fragments
The 'gcc/configure' script sources all 'gcc/*/config-lang.in' files, but fails
to emit such dependency information into the build machinery. That means,
currently, when something gets changed in a 'gcc/*/config-lang.in' file, this
is not noticed, and doesn't propagate through the build machinery.
Handling of configure fragments is modelled in the same way as it already
exists for Makefile fragments.
gcc/
* Makefile.in (LANG_CONFIGUREFRAGS): Define.
(config.status): Use/depend on it.
* configure.ac (all_lang_configurefrags): Track, 'AC_SUBST'.
* configure: Regenerate.
backport: pa.md (memory_barrier): Revise to use ldcw barriers.
Backport from mainline
2019-11-07 John David Anglin <danglin@gcc.gnu.org>
* config/pa/pa.md (memory_barrier): Revise to use ldcw barriers.
Enhance comment.
(memory_barrier_coherent, memory_barrier_64, memory_barrier_32): New
insn patterns using ldcw instruction.
(memory_barrier): Remove insn pattern using sync instruction.
* config/pa/pa.opt (coherent-ldcw): New option.
(ordered): New option.
Jakub Jelinek [Fri, 8 Nov 2019 19:02:24 +0000 (20:02 +0100)]
re PR middle-end/92384 (Empty class instances have different equal testing result among GCC versions)
PR c++/92384
* function.c (assign_parm_setup_block, assign_parm_setup_stack): Don't
copy TYPE_EMPTY_P arguments from data->entry_parm to data->stack_parm
slot.
(assign_parms): For TREE_ADDRESSABLE parms with TYPE_EMPTY_P type
force creation of a unique data.stack_parm slot.
Jakub Jelinek [Fri, 8 Nov 2019 18:58:14 +0000 (19:58 +0100)]
backport: re PR middle-end/92231 (ICE in gimple_fold_stmt_to_constant_1)
Backported from mainline
2019-10-31 Jakub Jelinek <jakub@redhat.com>
PR middle-end/92231
* tree.h (fndecl_built_in_p): Use fndecl_built_in_p instead of
DECL_BUILT_IN in comment. Remove redundant ()s around return
argument.
* tree.c (free_lang_data_in_decl): Check if var is FUNCTION_DECL
before calling fndecl_built_in_p.
* gimple-fold.c (gimple_fold_stmt_to_constant_1): Check if
TREE_OPERAND (fn, 0) is a FUNCTION_DECL before calling
fndecl_built_in_p on it.
* lto-lang.c (handle_const_attribute): Don't call fndecl_built_in_p
on *node that is not FUNCTION_DECL.
Eric Botcazou [Fri, 8 Nov 2019 12:33:48 +0000 (12:33 +0000)]
re PR target/92095 (internal error with -O1 -mcpu=niagara2 -fPIE)
PR target/92095
* config/sparc/sparc-protos.h (output_load_pcrel_sym): Declare.
* config/sparc/sparc.c (sparc_cannot_force_const_mem): Revert latest
change.
(got_helper_needed): New static variable.
(output_load_pcrel_sym): New function.
(get_pc_thunk_name): Remove after inlining...
(load_got_register): ...here. Rework the initialization of the GOT
register and of the GOT helper.
(save_local_or_in_reg_p): Test the REGNO of the GOT register.
(sparc_file_end): Test got_helper_needed to decide whether the GOT
helper must be emitted. Use output_asm_insn instead of fprintf.
(sparc_init_pic_reg): In PIC mode, always initialize the PIC register
if optimization is enabled.
* config/sparc/sparc.md (load_pcrel_sym<P:mode>): Emit the assembly
by calling output_load_pcrel_sym.
S/390: Fix failing RTL check in s390_canonicalize_comparison
The new sigfpe-eh.c fails with
internal compiler error: RTL check: expected elt 0 type 'e' or 'u', have 'w' (rtx const_int)
This is most likely due to a typo: XEXP (*op1, 0) was used, when
XEXP (*op0, 1) was intended. This did not cause any user-visible
problems, because reversed_comparison_code_parts ignores the
respective argument, and the release compiler is built without RTL
checks.
gcc/ChangeLog:
2019-11-06 Ilya Leoshkevich <iii@linux.ibm.com>
* config/s390/s390.c (s390_canonicalize_comparison): Use XEXP
(*op0, 1) instead of XEXP (*op1, 0).
Backport from trunk
2019-10-26 Segher Boessenkool <segher@kernel.crashing.org>
PR target/91289
* config/rs6000/rs6000.c (rs6000_emit_allocate_stack): Don't add an
immediate to r0; use r11 instead. Save and restore r11 to r0 around
this.
Andreas Krebbel [Tue, 5 Nov 2019 15:27:59 +0000 (15:27 +0000)]
IBM Z: gen-vect-26/28: Vectorizing without peeling is ok for Z
These tests check if loop peeling has been applied to avoid
having to vectorize unaligned loops. On Z we do not have any
alignment requirements for vectorization so we also don't need want
the loop peeling here.
2019-11-05 Andreas Krebbel <krebbel@linux.ibm.com>
Backport from mainline
2019-11-05 Andreas Krebbel <krebbel@linux.ibm.com>
* gcc.dg/tree-ssa/gen-vect-26.c: Disable loop peeling check for
IBM Z.
* gcc.dg/tree-ssa/gen-vect-28.c: Likewise.
Andreas Krebbel [Tue, 5 Nov 2019 15:26:19 +0000 (15:26 +0000)]
IBM Z: gen-vect-11/32: Set min-vect-loop-bound param back to default
In the Z backend we still set min-vect-loop-bound to 2 to work around
corner cases where awkward epilogue code gets generated in the
vectorizer. This has a particular bad impact when vectorizing loops
with a low iteration count. Due to this we do not vectorize the loop
in gen-vect-11/32 - what actually is a pity.
The patch sets min-vect-loop-bound back to the default value of 0 in
order to enable vectorization.
2019-11-05 Andreas Krebbel <krebbel@linux.ibm.com>
Backport from mainline
2019-11-05 Andreas Krebbel <krebbel@linux.ibm.com>
* gcc.dg/tree-ssa/gen-vect-11.c: Add --param min-vect-loop-bound=0
for IBM Z.
* gcc.dg/tree-ssa/gen-vect-11.c: Likewise.
Andreas Krebbel [Tue, 5 Nov 2019 15:25:26 +0000 (15:25 +0000)]
IBM Z: Fix testsuite useable_hw check
This fixes various issues with the useable_hw check in s390.exp. The
check is supposed to verify whether a testcase can be run on the
current hardware.
- the test never returned true for -m31 because vzero is not available
in ESA mode and -m31 defaults to -mesa
- the missing v0 clobber on the vzero instruction made the check fail
if the stack pointer got saved in f0
- the lcbb instruction used for checking whether we are on a z13
also requires vx. Replace it with an instruction from the generic
instruction set extensions.
- no support for z14 and z15 so far
gcc/testsuite/ChangeLog:
2019-11-05 Andreas Krebbel <krebbel@linux.ibm.com>
Backport from mainline
2019-11-05 Andreas Krebbel <krebbel@linux.ibm.com>
* gcc.target/s390/s390.exp
(check_effective_target_s390_useable_hw): Add inline asm for z14
and z15. Replace instruction for z13 with lochiz. Add register
clobbers. Check also for __zarch__ when doing the __VX__ test.
Iain Sandoe [Mon, 4 Nov 2019 23:06:21 +0000 (23:06 +0000)]
[objective-c/c++, testsuite] Fix stubify tests for -fnext-runtime.
Fixed to work for x86 as well as powerpc (use the final assembler output
instead of the jump rtl which varies between X86 and PPC). Amended the
options to reflect this change.
gcc/testsuite/
Backport from mainline.
2019-06-20 Iain Sandoe <iain@sandoe.co.uk>
Iain Sandoe [Wed, 30 Oct 2019 20:54:16 +0000 (20:54 +0000)]
[testsuite] Make the Wnonnull test independent of system headers.
This backports two patches that fix failure of Wnonnull test on some targets.
277280 To avoid the result of this test depending on the implementation of
the system 'string.h', provide prototypes for the two functions used
in the test. This generalises the fix from 277202.
277202 was the initial fix for Wnonnull on Darwin.
gcc/testsuite/
2019-10-30 Iain Sandoe <iain@sandoe.co.uk>
Backport from mainline.
2019-10-22 Iain Sandoe <iain@sandoe.co.uk>
* gcc.dg/Wnonnull.c: Provide prototypes for strlen and memcpy.
Use __SIZE_TYPE__ instead of size_t.
Backport from mainline.
2019-10-19 Iain Sandoe <iain@sandoe.co.uk>
* gcc.dg/Wnonnull.c: Add attributed function declarations for
memcpy and strlen for Darwin.