Jakub Jelinek [Fri, 20 Dec 2019 17:30:38 +0000 (18:30 +0100)]
backport: re PR c++/60228 (ICE using lambda in #pragma omp declare reduction)
Backported from mainline
2019-11-29 Jakub Jelinek <jakub@redhat.com>
PR c++/60228
* parser.c (cp_parser_omp_declare_reduction_exprs): If
processing_template_decl, wrap the combiner or initializer
into EXPR_STMT.
* decl.c (start_preparsed_function): Don't start a lambda scope
for DECL_OMP_DECLARE_REDUCTION_P functions.
(finish_function): Don't finish a lambda scope for
DECL_OMP_DECLARE_REDUCTION_P functions, nor cp_fold_function
them nor cp_genericize them.
* mangle.c (decl_mangling_context): Look through
DECL_OMP_DECLARE_REDUCTION_P functions.
* semantics.c (expand_or_defer_fn_1): For DECL_OMP_DECLARE_REDUCTION_P
functions, use tentative linkage, don't keep their bodies with
-fkeep-inline-functions and return false at the end.
* g++.dg/gomp/openmp-simd-2.C: Don't expect bodies for
DECL_OMP_DECLARE_REDUCTION_P functions.
* testsuite/libgomp.c++/udr-20.C: New test.
* testsuite/libgomp.c++/udr-21.C: New test.
Jakub Jelinek [Fri, 20 Dec 2019 16:57:21 +0000 (17:57 +0100)]
backport: re PR inline-asm/92615 (ICE in extract_insn)
Backported from mainline
2019-11-23 Jakub Jelinek <jakub@redhat.com>
PR target/92615
* config/i386/i386.c (ix86_md_asm_adjust): If dest_mode is
GET_MODE (dest), is not QImode, using ZERO_EXTEND and dest is not
register_operand, force x into register before storing it into dest.
Formatting fix.
Jakub Jelinek [Fri, 20 Dec 2019 16:56:30 +0000 (17:56 +0100)]
backport: re PR c/90677 (gcc-9.1.0 fails to build __gcc_diag__ souce: error: 'cgraph_node' is not defined as a type)
Backported from mainline
2019-11-22 Jakub Jelinek <jakub@redhat.com>
PR c/90677
* c-common.h (identifier_global_tag): Declare.
* c-format.c (get_pointer_to_named_type): Renamed to ...
(get_named_type): ... this. Use identifier_global_tag instead of
identifier_global_value, handle the return value being a TYPE_P.
(init_dynamic_diag_info): Adjust get_pointer_to_named_type callers
to call get_named_type instead. Formatting fixes.
Jakub Jelinek [Fri, 20 Dec 2019 16:55:06 +0000 (17:55 +0100)]
backport: re PR c++/90842 (ICE in poplevel, at cp/decl.c:585)
Backported from mainline
2019-11-21 Jakub Jelinek <jakub@redhat.com>
Jason Merrill <jason@redhat.com>
PR c++/90842
* parser.c (cp_parser_decl_specifier_seq): For concept or typedef
break early if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR.
For type specifiers, set CP_PARSER_FLAGS_NO_TYPE_DEFINITIONS
if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR is set.
Jason Merrill [Fri, 13 Dec 2019 05:10:11 +0000 (00:10 -0500)]
PR c++/57082 - new X{} and private destructor.
build_new_1 already passes tf_no_cleanup to build_value_init, but in this
testcase we end up calling build_value_init by way of
build_special_member_call, so we need to pass it to that function as well.
* init.c (build_new_1): Also pass tf_no_cleanup to
build_special_member_call.
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).