Kewen Lin [Tue, 10 Dec 2019 12:54:21 +0000 (12:54 +0000)]
[PATCH] Fix PR91790 by considering different first_stmt_info for realign
As PR91790 exposed, when we have one slp node whose first_stmt_info_for_drptr
is different from first_stmt_info, it's possible that the first_stmt DR isn't
initialized yet before stmt SLP_TREE_SCALAR_STMTS[0] of slp node. So we
shouldn't use first_stmt_info for vect_setup_realignment, instead we can use
the one based on first_stmt_info_for_drptr DR with additional adjustment by
bumping the distance from first_stmt DR.
2019-12-10 Kewen Lin <linkw@gcc.gnu.org>
Backport from mainline
2019-11-27 Kewen Lin <linkw@gcc.gnu.org>
PR tree-optimization/91790
* gcc/tree-vect-stmts.c (vectorizable_load): Use the adjusted DR for
vect_setup_realignment when first_stmt_info is different from
first_stmt_info_for_drptr.
Eric Botcazou [Mon, 9 Dec 2019 16:43:52 +0000 (16:43 +0000)]
tree.c (build_array_type_1): Add SET_CANONICAL parameter and compute TYPE_CANONICAL from the element type...
* tree.c (build_array_type_1): Add SET_CANONICAL parameter and compute
TYPE_CANONICAL from the element type only if it is true. Remove a few
obsolete lines and adjust recursive call.
(fld_process_array_type): Adjust call to build_array_type_1.
(build_array_type): Likewise.
(build_nonshared_array_type): Likewise.
Jonathan Wakely [Mon, 9 Dec 2019 11:16:29 +0000 (11:16 +0000)]
libstdc++: fix buffer overflow in path::operator+= (PR92853)
When concatenating a path ending in a root-directory onto another path,
we added an empty filename to the end of the path twice, but only
reserved space for one. That meant the second write went past the end of
the allocated buffer.
PR libstdc++/92853
* src/c++17/fs_path.cc (filesystem::path::operator+=(const path&)):
Do not process a trailing directory separator twice.
* testsuite/27_io/filesystem/path/concat/92853.cc: New test.
* testsuite/27_io/filesystem/path/concat/path.cc: Test more cases.
* testsuite/27_io/filesystem/path/concat/strings.cc: Test more cases.
Fix bugs relating to flexibly-sized objects in nios2 backend.
PR target/92499
gcc/c/
* c-decl.c (flexible_array_type_p): Move to common code.
gcc/
* config/nios2/nios2.c (nios2_in_small_data_p): Do not consider
objects of flexible types to be small if they have internal linkage
or are declared extern.
* config/nios2/nios2.h (ASM_OUTPUT_ALIGNED_LOCAL): Replace with...
(ASM_OUTPUT_ALIGNED_DECL_LOCAL): ...this. Use targetm.in_small_data_p
instead of the size of the object initializer.
* tree.c (flexible_array_type_p): Move from C front end, and
generalize to handle fields in non-C structures.
* tree.h (flexible_array_type_p): Declare.
Li Jia He [Mon, 2 Dec 2019 06:23:56 +0000 (06:23 +0000)]
[rs6000]Fix PR92098 by backporting vec_cmp and vcond_mask supports to gcc-9-branch
As PR92132 added vec_cmp_* and vcond_mask_* supports on trunk. This is a
partial backport of vec_{cmp,cmpu}<mode><mode> interface and related expand
to gcc-9-branch to fix PR92098.
gcc/ChangeLog
2019-12-02 Li Jia He <helijia@linux.ibm.com>
Partial backport from mainline
PR target/92098
2019-11-08 Kewen Lin <linkw@gcc.gnu.org>
PR target/92132
* config/rs6000/predicates.md
(signed_or_equality_comparison_operator): New predicate.
(unsigned_or_equality_comparison_operator): Likewise.
* config/rs6000/rs6000.md (one_cmpl<mode>2): Remove expand.
(one_cmpl<mode>3_internal): Rename to one_cmpl<mode>2.
* config/rs6000/vector.md
(vcond_mask_<mode><mode> for VEC_I and VEC_I): New expand.
(vec_cmp<mode><mode> for VEC_I and VEC_I): Likewise.
(vec_cmpu<mode><mode> for VEC_I and VEC_I): Likewise.
gcc/testsuite/ChangeLog
2019-12-02 Li Jia He <helijia@linux.ibm.com>
Partial backport from trunk
PR target/92098
2019-11-08 Kewen Lin <linkw@gcc.gnu.org>
PR target/92132
* gcc.target/powerpc/pr92132-fp-1.c: New test.
* gcc.target/powerpc/pr92132-fp-2.c: New test.
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.