Backport from mainline
PR target/84168
2017-09-28 Joseph Myers <joseph@codesourcery.com>
* config/aarch64/aarch64.c (aarch64_elf_asm_constructor)
(aarch64_elf_asm_destructor): Pass SECTION_NOTYPE to get_section
when creating .init_array and .fini_array sections with priority
specified.
Kelvin Nilsen [Tue, 26 Jun 2018 17:24:54 +0000 (17:24 +0000)]
backport: rs6000-c.c (altivec_overloaded_builtins): Change behavior of vec_packsu (vector unsigned long long...
gcc/ChangeLog:
2018-06-26 Kelvin Nilsen <kelvin@gcc.gnu.org>
Backported from mainline
2018-06-20 Kelvin Nilsen <kelvin@gcc.gnu.org>
* config/rs6000/rs6000-c.c (altivec_overloaded_builtins): Change
behavior of vec_packsu (vector unsigned long long, vector unsigned
long long) to match behavior of vec_packs with same signature.
gcc/testsuite/ChangeLog:
2018-06-26 Kelvin Nilsen <kelvin@gcc.gnu.org>
Backported from mainline
2018-06-20 Kelvin Nilsen <kelvin@gcc.gnu.org>
* gcc.target/powerpc/builtins-1.c: Add dg directive to scan
for vpkudus.
Jakub Jelinek [Mon, 25 Jun 2018 17:55:15 +0000 (19:55 +0200)]
re PR target/84786 ([miscompilation] vunpcklpd accessing xmm16-22 targeting KNL)
PR target/84786
* config/i386/sse.md (vshift_count): New mode attr.
(<shift_insn><mode>3<mask_name>): Use <vshift_count>N instead of vN
as last operand's constraint for VI2_AVX2_AVX512BW shifts. Use YvN
instead of vN as last operand's constraint for VI48_AVX2 shifts.
Jakub Jelinek [Mon, 25 Jun 2018 17:53:50 +0000 (19:53 +0200)]
backport: re PR tree-optimization/86231 (vrp_meet causes wrong-code)
Backported from mainline
2018-06-20 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/86231
* tree-vrp.c (union_ranges): For ( [ ) ] or ( )[ ] range and
anti-range don't overwrite *vr0min before using it to compute *vr0max.
* gcc.dg/tree-ssa/vrp119.c: New test.
* gcc.c-torture/execute/pr86231.c: New test.
Jakub Jelinek [Mon, 25 Jun 2018 17:48:47 +0000 (19:48 +0200)]
backport: re PR rtl-optimization/85431 (UBSAN: ../../gcc/dse.c:303:15: runtime error: shift exponent 64 is too large for 64-bit type 'long unsigned int')
Backported from mainline
2018-04-17 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/85431
* dse.c (record_store): Ignore zero width stores.
Jakub Jelinek [Mon, 25 Jun 2018 17:47:56 +0000 (19:47 +0200)]
backport: re PR rtl-optimization/85300 (ICE in exact_int_to_float_conversion_p, at simplify-rtx.c:895)
Backported from mainline
2018-04-10 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/85300
* combine.c (subst): Handle subst of CONST_SCALAR_INT_P new_rtx also
into FLOAT and UNSIGNED_FLOAT like ZERO_EXTEND, return a CLOBBER if
simplify_unary_operation fails.
Jakub Jelinek [Mon, 25 Jun 2018 17:45:48 +0000 (19:45 +0200)]
backport: re PR tree-optimization/85257 (wrong code with -O -fno-tree-ccp and reading zeroed vector member)
Backported from mainline
2018-04-07 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/85257
* fold-const.c (native_encode_vector): If not all elts could fit
and off is -1, return 0 rather than offset.
* tree-ssa-sccvn.c (vn_reference_lookup_3): Pass
(offset - offset2) / BITS_PER_UNIT as 4th argument to
native_encode_expr. Verify len * BITS_PER_UNIT >= maxsizei. Don't
adjust buffer in native_interpret_expr call.
Jakub Jelinek [Mon, 25 Jun 2018 17:41:34 +0000 (19:41 +0200)]
backport: re PR c++/84791 (ICE with broken OpenMP reduction clause)
Backported from mainline
2018-03-30 Jakub Jelinek <jakub@redhat.com>
PR c++/84791
* semantics.c (finish_omp_reduction_clause): If
OMP_CLAUSE_REDUCTION_PLACEHOLDER is error_mark_node, return true
even if processing_template_decl.
Jakub Jelinek [Mon, 25 Jun 2018 17:37:02 +0000 (19:37 +0200)]
backport: re PR inline-asm/84941 (internal compiler error: in reg_overlap_mentioned_p, at rtlanal.c:1870 (reg_overlap_mentioned_p()/match_asm_constraints_1()))
Backported from mainline
2018-03-22 Jakub Jelinek <jakub@redhat.com>
PR inline-asm/84941
* function.c (match_asm_constraints_1): Don't do the optimization
if input isn't a REG, SUBREG, MEM or constant.
Jakub Jelinek [Mon, 25 Jun 2018 17:34:55 +0000 (19:34 +0200)]
backport: re PR target/84899 (ICE: in final_scan_insn_1, at final.c:3139 (error: could not split insn))
Backported from mainline
2018-03-16 Jakub Jelinek <jakub@redhat.com>
PR target/84899
* postreload.c (reload_combine_recognize_pattern): Perform
INTVAL addition in unsigned HOST_WIDE_INT type to avoid UB and
truncate_int_for_mode the result for the destination's mode.
Jakub Jelinek [Mon, 25 Jun 2018 17:32:10 +0000 (19:32 +0200)]
backport: re PR c++/84222 ([[deprecated]] class complains about internal class usage)
Backported from mainline
2018-03-15 Jakub Jelinek <jakub@redhat.com>
PR c++/84222
* cp-tree.h (cp_warn_deprecated_use): Declare.
* tree.c (cp_warn_deprecated_use): New function.
* typeck2.c (build_functional_cast): Use it.
* decl.c (grokparms): Likewise.
(grokdeclarator): Likewise. Temporarily push nested class scope
around grokparms call for out of class member definitions.
* g++.dg/warn/deprecated.C (T::member3): Change dg-warning to dg-bogus.
* g++.dg/warn/deprecated-6.C (T::member3): Likewise.
* g++.dg/warn/deprecated-13.C: New test.
Jakub Jelinek [Mon, 25 Jun 2018 17:31:23 +0000 (19:31 +0200)]
backport: re PR target/84772 (powerpc-spe: Spurious "is used uninitialized" warning, or possibly incorrect codegen for va_arg(long double))
Backported from mainline
2018-03-09 Jakub Jelinek <jakub@redhat.com>
PR target/84772
* config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Mark va_arg_tmp
temporary TREE_ADDRESSABLE before gimplification of BUILT_IN_MEMCPY.
Jakub Jelinek [Mon, 25 Jun 2018 17:30:03 +0000 (19:30 +0200)]
backport: re PR c++/84076 (Warning about objects through POD mistakenly claims the object is a pointer)
Backported from mainline
2018-03-09 Jason Merrill <jason@redhat.com>
Jakub Jelinek <jakub@redhat.com>
PR c++/84076
* call.c (convert_arg_to_ellipsis): Instead of cp_build_addr_expr
build ADDR_EXPR with REFERENCE_TYPE.
(build_over_call): For purposes of check_function_arguments, if
argarray[j] is ADDR_EXPR with REFERENCE_TYPE created above, use
its operand rather than the argument itself.
Jakub Jelinek [Mon, 25 Jun 2018 17:28:32 +0000 (19:28 +0200)]
backport: re PR tree-optimization/84739 (ICE in get_value_for_expr, at tree-ssa-ccp.c:649)
Backported from mainline
2018-03-08 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/84739
* tree-tailcall.c (find_tail_calls): Check call arguments against
DECL_ARGUMENTS (current_function_decl) rather than
DECL_ARGUMENTS (func) when checking for tail recursion.
Jakub Jelinek [Mon, 25 Jun 2018 17:27:47 +0000 (19:27 +0200)]
backport: re PR target/84700 (ICE on 32-bit BE powerpc targets w/ -misel -O1)
Backported from mainline
2018-03-05 Jakub Jelinek <jakub@redhat.com>
PR target/84700
* combine.c (combine_simplify_rtx): Don't try to simplify if
if_then_else_cond returned non-NULL, but either true_rtx or false_rtx
are equal to x.
Jakub Jelinek [Mon, 25 Jun 2018 17:26:53 +0000 (19:26 +0200)]
backport: re PR c++/84662 (internal compiler error: tree check: expected class 'type', have 'exceptional' (error_mark) in is_bitfield_expr_with_lowered_type, at cp/typeck.c:1944)
Backported from mainline
2018-03-02 Jakub Jelinek <jakub@redhat.com>
PR c++/84662
* pt.c (tsubst_copy_and_build) <case TEMPLATE_ID_EXPR>: Use
RETURN instead of return.
<case POINTER_PLUS_EXPR>: Likewise.
<case CONVERT_EXPR>: If op0 is error_mark_node, just return
it instead of wrapping it into CONVERT_EXPR.
Jakub Jelinek [Mon, 25 Jun 2018 17:25:41 +0000 (19:25 +0200)]
backport: re PR inline-asm/84625 (ICE with empty constraint and vector constant)
Backported from mainline
2018-03-02 Jakub Jelinek <jakub@redhat.com>
PR inline-asm/84625
* config/i386/i386.c (ix86_print_operand): Use conditional
output_operand_lossage instead of gcc_assert if CONST_VECTOR is not
zero vector.
Jakub Jelinek [Mon, 25 Jun 2018 17:23:21 +0000 (19:23 +0200)]
backport: re PR c++/84448 (ICE with broken condition in parallel for loop)
Backported from mainline
2018-02-19 Jakub Jelinek <jakub@redhat.com>
PR c++/84448
* parser.c (cp_parser_binary_expression): For no_toplevel_fold_p, if
either operand is error_mark_node, set current.lhs to that instead of
creating a binary op with error_mark_node operands.
Jakub Jelinek [Mon, 25 Jun 2018 17:21:47 +0000 (19:21 +0200)]
backport: re PR c/82210 (Having _Alignas in a struct with VLAs causes writing to one array to overwrite another)
Backported from mainline
2018-02-13 Jakub Jelinek <jakub@redhat.com>
PR c/82210
* stor-layout.c (place_field): For variable length fields, adjust
offset_align afterwards not just based on the field's alignment,
but also on the size.
Jakub Jelinek [Mon, 25 Jun 2018 17:19:13 +0000 (19:19 +0200)]
backport: re PR target/83986 (ICE in maybe_record_trace_start, at dwarf2cfi.c:2348)
Backported from mainline
2018-01-30 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/83986
* sched-deps.c (sched_analyze_insn): For frame related insns, add anti
dependence against last_pending_memory_flush in addition to
pending_jump_insns.
Jakub Jelinek [Mon, 25 Jun 2018 17:11:36 +0000 (19:11 +0200)]
backport: re PR preprocessor/83722 (the ICE dumper doesn't comment-out some error messages)
Backported from mainline
2018-01-09 Jakub Jelinek <jakub@redhat.com>
PR preprocessor/83722
* gcc.c (try_generate_repro): Pass
&temp_stderr_files[RETRY_ICE_ATTEMPTS - 1] rather than
&temp_stdout_files[RETRY_ICE_ATTEMPTS - 1] as last argument to
do_report_bug.
Jakub Jelinek [Mon, 25 Jun 2018 17:11:05 +0000 (19:11 +0200)]
backport: re PR tree-optimization/83605 (ICE: verify_gimple failed (error: dead STMT in EH table))
Backported from mainline
2018-01-05 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/83605
* gimple-ssa-strength-reduction.c: Include tree-eh.h.
(find_candidates_dom_walker::before_dom_children): Ignore stmts that
can throw.
Jakub Jelinek [Mon, 25 Jun 2018 17:10:18 +0000 (19:10 +0200)]
backport: re PR c++/83553 (compiler removes body of the for-loop, although there is a case label inside)
Backported from mainline
2017-12-23 Jakub Jelinek <jakub@redhat.com>
PR c++/83553
* fold-const.c (struct contains_label_data): New type.
(contains_label_1): Return non-NULL even for CASE_LABEL_EXPR, unless
inside of a SWITCH_BODY seen during the walk.
(contains_label_p): Use walk_tree instead of
walk_tree_without_duplicates, prepare data for contains_label_1 and
provide own pset.
Jakub Jelinek [Mon, 25 Jun 2018 17:08:02 +0000 (19:08 +0200)]
backport: re PR debug/83550 (Bad location of DW_TAG_structure_type with forward declaration since r224161)
Backported from mainline
2017-12-22 Jakub Jelinek <jakub@redhat.com>
PR debug/83550
* c-decl.c (finish_struct): Set DECL_SOURCE_LOCATION on
TYPE_STUB_DECL and call rest_of_type_compilation before processing
incomplete vars rather than after it.
Jakub Jelinek [Mon, 25 Jun 2018 17:05:01 +0000 (19:05 +0200)]
backport: re PR rtl-optimization/80747 (gcc.dg/tree-ssa/tailrecursion-4.c fails with ICE when compiled with options "-fprofile-use -freorder-blocks-and-partition")
Backported from mainline
2017-12-21 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/80747
PR rtl-optimization/83512
* cfgrtl.c (force_nonfallthru_and_redirect): When splitting
succ edge from ENTRY, copy partition from e->dest to the newly
created bb.
* bb-reorder.c (reorder_basic_blocks_simple): If last_tail is
ENTRY, use BB_PARTITION of its successor block as current_partition.
Don't copy partition when splitting succ edge from ENTRY.
* gcc.dg/pr80747.c: New test.
* gcc.dg/pr83512.c: New test.
Jakub Jelinek [Mon, 25 Jun 2018 17:03:26 +0000 (19:03 +0200)]
backport: re PR tree-optimization/83521 (ICE: verify_gimple failed (error: invalid operand in unary operation))
Backported from mainline
2017-12-21 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/83521
* tree-ssa-phiopt.c (factor_out_conditional_conversion): Use
gimple_build_assign without code on result of
fold_build1 (VIEW_CONVERT_EXPR, ...), as it might not create
a VIEW_CONVERT_EXPR.
Jakub Jelinek [Mon, 25 Jun 2018 17:02:47 +0000 (19:02 +0200)]
backport: re PR ipa/82801 (Internal compiler error with Eigen and __attribute__((always_inline, flatten)))
Backported from mainline
2017-12-19 Jakub Jelinek <jakub@redhat.com>
PR ipa/82801
PR ipa/83346
* ipa-inline.c (flatten_remove_node_hook): New function.
(ipa_inline): Keep only nodes with flatten attribute at the end of
the array in the order from ipa_reverse_postorder, only walk that
portion of array for flattening, if there is more than one such
node, temporarily register a removal hook and ignore removed nodes.
Jakub Jelinek [Mon, 25 Jun 2018 16:57:13 +0000 (18:57 +0200)]
backport: re PR target/78643 (ICE in convert_move, at expr.c:230)
Backported from mainline
2017-12-02 Jakub Jelinek <jakub@redhat.com>
PR target/78643
PR target/80583
* expr.c (get_inner_reference): If DECL_MODE of a non-bitfield
is BLKmode for vector field with vector raw mode, use TYPE_MODE
instead of DECL_MODE.