Jakub Jelinek [Tue, 30 May 2017 08:26:33 +0000 (10:26 +0200)]
backport: re PR rtl-optimization/80385 (Segfault in commutative_operand_precedence() rtlanal.c:3373)
Backported from mainline
2017-04-11 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/80385
* simplify-rtx.c (simplify_unary_operation_1): Don't transform
(not (neg X)) into (plus X -1) for complex or non-integral modes.
Jakub Jelinek [Tue, 30 May 2017 08:23:29 +0000 (10:23 +0200)]
backport: re PR target/80286 (AVX2 _mm_cvtsi128_si32 doesn't return a proper 32bits int)
Backported from mainline
2017-04-04 Jakub Jelinek <jakub@redhat.com>
PR target/80286
* config/i386/i386.c (ix86_expand_args_builtin): If op has scalar
int mode, convert_modes it to mode as unsigned, otherwise use
lowpart_subreg to mode rather than SImode.
* config/i386/sse.md (<mask_codefor>ashr<mode>3<mask_name>,
ashr<mode>3, ashr<mode>3<mask_name>, <shift_insn><mode>3<mask_name>):
Use DImode instead of SImode for the shift count operand.
* config/i386/mmx.md (mmx_ashr<mode>3, mmx_<shift_insn><mode>3):
Likewise.
* gcc.target/i386/avx-pr80286.c: New test.
* gcc.dg/pr80286.c: New test.
Jakub Jelinek [Tue, 30 May 2017 08:22:41 +0000 (10:22 +0200)]
backport: re PR debug/80025 (ICE w/ -O2 (-O3, -Ofast) -g -ftracer (infinite recursion in rtx_equal_for_cselib_1))
Backported from mainline
2017-03-31 Jakub Jelinek <jakub@redhat.com>
PR debug/80025
* cselib.c (cselib_hasher::equal): Pass 0 to rtx_equal_for_cselib_1.
(rtx_equal_for_cselib_1): Add depth argument. If depth
is 128, don't look up VALUE locs and punt. Increment
depth in recursive calls when walking VALUE locs.
Jakub Jelinek [Tue, 30 May 2017 08:20:45 +0000 (10:20 +0200)]
backport: re PR sanitizer/80168 (ICE in make_decl_rtl, at varasm.c:1311 w/ VLA and -fsanitize=address)
Backported from mainline
2017-03-27 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/80168
* asan.c (instrument_derefs): Copy over last operand from
original COMPONENT_REF to the new COMPONENT_REF with
DECL_BIT_FIELD_REPRESENTATIVE.
* ubsan.c (instrument_object_size): Likewise.
Jakub Jelinek [Tue, 30 May 2017 08:17:54 +0000 (10:17 +0200)]
backport: re PR c++/80141 (ICE with pragma omp declare)
Backported from mainline
2017-03-22 Jakub Jelinek <jakub@redhat.com>
PR c++/80141
* semantics.c (finish_omp_clause) <case OMP_CLAUSE_SIMDLEN,
case OMP_CLAUSE_ALIGNED>: Call maybe_constant_value only when not
processing_template_decl.
Jakub Jelinek [Tue, 30 May 2017 08:15:55 +0000 (10:15 +0200)]
backport: re PR c++/79896 (ICE in gimplify_expr, at gimplify.c:11950 on non-int128 target)
Backported from mainline
2017-03-10 Jakub Jelinek <jakub@redhat.com>
PR c++/79896
* decl.c (finish_enum_value_list): If value is error_mark_node,
don't copy it and change its type.
* init.c (constant_value_1): Return error_mark_node if DECL_INITIAL
of CONST_DECL is error_mark_node.
Jakub Jelinek [Tue, 30 May 2017 08:15:05 +0000 (10:15 +0200)]
backport: re PR c++/79896 (ICE in gimplify_expr, at gimplify.c:11950 on non-int128 target)
Backported from mainline
2017-03-10 Jakub Jelinek <jakub@redhat.com>
PR c++/79896
* decl.c (finish_enum_value_list): If value is error_mark_node,
don't copy it and change its type.
* init.c (constant_value_1): Return error_mark_node if DECL_INITIAL
of CONST_DECL is error_mark_node.
Jakub Jelinek [Tue, 30 May 2017 08:13:33 +0000 (10:13 +0200)]
backport: re PR sanitizer/79944 (asan: incorrect instrumentation of atomic operations)
Backported from mainline
2017-03-09 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/79944
* asan.c (get_mem_refs_of_builtin_call): For BUILT_IN_ATOMIC* and
BUILT_IN_SYNC*, determine the access type from the size suffix and
always build a MEM_REF with that type. Handle forgotten
BUILT_IN_SYNC_FETCH_AND_NAND_16 and BUILT_IN_SYNC_NAND_AND_FETCH_16.
Jakub Jelinek [Tue, 30 May 2017 08:07:03 +0000 (10:07 +0200)]
backport: re PR target/79807 (ICE in extract_insn, at recog.c:2311 (error: unrecognizable insn))
Backported from mainline
2017-03-03 Jakub Jelinek <jakub@redhat.com>
PR target/79807
* config/i386/i386.c (ix86_expand_multi_arg_builtin): If target
is a memory operand, increase num_memory.
(ix86_expand_args_builtin): Likewise.
Jakub Jelinek [Tue, 30 May 2017 08:00:48 +0000 (10:00 +0200)]
backport: re PR target/79568 (ICE in extract_insn, at recog.c:2311 for pr70325.c (with -mavx512bw))
Backported from mainline
2017-02-20 Jakub Jelinek <jakub@redhat.com>
PR target/79568
* config/i386/i386.c (ix86_expand_builtin): Handle
OPTION_MASK_ISA_AVX512VL and OPTION_MASK_ISA_64BIT in
ix86_builtins_isa[fcode].isa as a requirement of those
flags and any other flag in the bitmask.
(ix86_init_mmx_sse_builtins): Use 0 instead of
~OPTION_MASK_ISA_64BIT as mask.
* config/i386/i386-builtin.def (bdesc_special_args,
bdesc_args): Likewise.
* gcc.target/i386/pr79568-1.c: New test.
* gcc.target/i386/pr79568-2.c: New test.
* gcc.target/i386/pr79568-3.c: New test.
Jakub Jelinek [Tue, 30 May 2017 07:59:29 +0000 (09:59 +0200)]
backport: re PR target/79559 (ICE in ix86_print_operand, at config/i386/i386.c:18189)
Backported from mainline
2017-02-18 Jakub Jelinek <jakub@redhat.com>
PR target/79559
* config/i386/i386.c (ix86_print_operand): Use output_operand_lossage
instead of gcc_assert for K, r and R code checks. Formatting fixes.
Jakub Jelinek [Tue, 30 May 2017 07:58:01 +0000 (09:58 +0200)]
backport: re PR tree-optimization/79411 (ICE: SSA corruption (fail_abnormal_edge_coalesce))
Backported from mainline
2017-02-10 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/79411
* tree-ssa-reassoc.c (is_reassociable_op): Return false if
stmt operands are SSA_NAMEs used in abnormal phis.
(can_reassociate_p): Return false if op is SSA_NAME used in abnormal
phis.
Jakub Jelinek [Tue, 30 May 2017 07:57:10 +0000 (09:57 +0200)]
backport: re PR middle-end/79399 (GCC fails to compile big source at -O0)
Backported from mainline
2017-02-07 Jakub Jelinek <jakub@redhat.com>
Richard Biener <rguenther@suse.de>
PR middle-end/79399
* ira-int.h (struct target_ira_int): Change x_max_struct_costs_size
type from int to size_t.
* ira-costs.c (struct_costs_size): Change type from int to size_t.
Jakub Jelinek [Tue, 30 May 2017 07:56:11 +0000 (09:56 +0200)]
backport: re PR target/79197 (ICE in extract_insn in gcc/recog.c:2311)
Backported from mainline
2017-02-02 Jakub Jelinek <jakub@redhat.com>
PR target/79197
* config/rs6000/rs6000.md (*fixuns_trunc<mode>di2_fctiduz): Rename to ...
(fixuns_trunc<mode>di2): ... this, remove previous expander. Put all
conditions on a single line.
* gcc.target/powerpc/pr79197.c: New test.
* gcc.c-torture/compile/pr79197.c: New test.
Jakub Jelinek [Tue, 30 May 2017 07:55:06 +0000 (09:55 +0200)]
backport: re PR c++/78341 (ICE on invalid C++ code on x86_64-linux-gnu (internal compiler error: in cp_parser_std_attribute_spec, at cp/parser.c:24597))
Backported from mainline
2017-01-11 Jakub Jelinek <jakub@redhat.com>
Jakub Jelinek [Tue, 30 May 2017 07:51:12 +0000 (09:51 +0200)]
backport: re PR ipa/77905 (ICE at -Os and above in both 32-bit and 64-bit modes on x86_64-linux-gnu (internal compiler error: in ipa_comdats, at ipa-comdats.c:352))
Backported from mainline
2016-12-13 Jakub Jelinek <jakub@redhat.com>
PR ipa/77905
* ipa-pure-const.c (cdtor_p): Return true for
DECL_STATIC_{CON,DE}STRUCTOR even when it is
DECL_LOOPING_CONST_OR_PURE_P.
Jakub Jelinek [Tue, 30 May 2017 07:46:27 +0000 (09:46 +0200)]
backport: re PR c++/78649 (ICE on invalid C++ code on x86_64-linux-gnu (internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in build_value_init_noctor, at cp/init.c:380))
Backported from mainline
2016-12-02 Jakub Jelinek <jakub@redhat.com>
PR c++/78649
* pt.c (tsubst_init): Don't call build_value_init if decl's type
is error_mark_node.
Jakub Jelinek [Tue, 30 May 2017 07:45:47 +0000 (09:45 +0200)]
backport: re PR fortran/78298 (ICE in lookup_decl_in_outer_ctx, bei omp-low.c:4115)
Backported from mainline
2016-11-28 Jakub Jelinek <jakub@redhat.com>
PR fortran/78298
* tree-nested.c (convert_local_reference_stmt): After adding
shared (FRAME.NN) clause to omp parallel, task or target,
add it also to all outer omp parallel, task or target constructs.
Jakub Jelinek [Tue, 30 May 2017 07:44:51 +0000 (09:44 +0200)]
backport: re PR middle-end/69183 (ICE when using OpenMP PRIVATE keyword in OMP DO loop not explicitly encapsulated in OMP PARALLEL region)
Backported from mainline
2016-11-23 Jakub Jelinek <jakub@redhat.com>
PR middle-end/69183
* omp-low.c (build_outer_var_ref): Change lastprivate argument
to code, pass it recursively, adjust uses. For OMP_CLAUSE_PRIVATE
on worksharing constructs, treat it like clauses on simd construct.
Formatting fix.
(lower_rec_input_clauses): For OMP_CLAUSE_PRIVATE_OUTER_REF pass
OMP_CLAUSE_PRIVATE as last argument to build_outer_var_ref.
(lower_lastprivate_clauses): Pass OMP_CLAUSE_LASTPRIVATE instead
of true as last argument to build_outer_var_ref.
Jakub Jelinek [Tue, 30 May 2017 07:44:11 +0000 (09:44 +0200)]
backport: re PR c++/77739 (internal compiler error: in create_tmp_var, at gimple-expr.c:524)
Backported from mainline
2016-11-23 Jakub Jelinek <jakub@redhat.com>
PR c++/77739
* cp-gimplify.c (cp_gimplify_tree) <case VEC_INIT_EXPR>: Pass
false as handle_invisiref_parm_p to cp_genericize_tree.
(struct cp_genericize_data): Add handle_invisiref_parm_p field.
(cp_genericize_r): Don't wrap is_invisiref_parm into references
if !wtd->handle_invisiref_parm_p.
(cp_genericize_tree): Add handle_invisiref_parm_p argument,
set wtd.handle_invisiref_parm_p to it.
(cp_genericize): Pass true as handle_invisiref_parm_p to
cp_genericize_tree. Formatting fix.
Jakub Jelinek [Tue, 30 May 2017 07:43:37 +0000 (09:43 +0200)]
backport: re PR middle-end/78416 (wrong code for division by (u128)~INT64_MAX at -O0)
Backported from mainline
2016-11-22 Jakub Jelinek <jakub@redhat.com>
PR middle-end/78416
* expmed.c (expand_divmod): Use wide_int for computation of
op1_is_pow2. Don't set it if op1 is 0. Formatting fixes.
Use size <= HOST_BITS_PER_WIDE_INT instead of
HOST_BITS_PER_WIDE_INT >= size.
Jakub Jelinek [Tue, 30 May 2017 07:37:39 +0000 (09:37 +0200)]
backport: re PR c++/78089 (__builtin_shuffle parsing bug)
Backported from mainline
2016-10-31 Jakub Jelinek <jakub@redhat.com>
PR c++/78089
* parser.c (cp_parser_postfix_expression): Replace return statement in
the first switch with setting postfix_expression to the return
expression and break;.
Jakub Jelinek [Tue, 30 May 2017 07:36:52 +0000 (09:36 +0200)]
backport: re PR rtl-optimization/77919 (ICE converting DC to V2DF mode)
Backported from mainline
2016-10-29 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/77919
* expr.c (expand_expr_real_1) <normal_inner_ref>: Only avoid forcing
into memory if both modes are complex and their inner modes have the
same precision. If the two modes are different complex modes, convert
each part separately and generate a new CONCAT.
Jakub Jelinek [Tue, 30 May 2017 07:34:46 +0000 (09:34 +0200)]
backport: re PR sanitizer/66343 ("Error: .Lubsan_type3 already defined" with UBSan and precompiled headers)
Backported from mainline
2016-10-05 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/66343
* ubsan.c (ubsan_ids): New GTY(()) array.
(ubsan_type_descriptor, ubsan_create_data): Use ubsan_ids
instead of static local counters.
* gcc.dg/pch/pr66343-1.c: New test.
* gcc.dg/pch/pr66343-1.hs: New file.
* gcc.dg/pch/pr66343-2.c: New test.
* gcc.dg/pch/pr66343-2.hs: New file.
Jakub Jelinek [Tue, 30 May 2017 07:32:25 +0000 (09:32 +0200)]
backport: re PR c++/77467 (Segmentation fault with switch statement in constexpr function)
Backported from mainline
2016-09-28 Jakub Jelinek <jakub@redhat.com>
PR c++/77467
* constexpr.c (enum constexpr_switch_state): New.
(struct constexpr_ctx): Add css_state field.
(label_matches): Add CTX and STMT arguments, remove I and
DEFAULT_LABEL. For CASE_LABEL_EXPR assert ctx->css_state != NULL,
handle default labels according to css_state.
(cxx_eval_statement_list): Remove statement skipping, label_matches
and default_label handling code.
(cxx_eval_loop_expr): Exit after first iteration even if
switches (jump_target).
(cxx_eval_switch_expr): Set up css_state field in ctx, if default
label has been seen in the body, but no cases matched, evaluate
the body second time.
(cxx_eval_constant_expression): Handle stmt skipping and label_matches
here. Handle PREDICT_EXPR. For MODIFY_EXPR or INIT_EXPR, assert
statement is not skipped. For COND_EXPR during skipping, don't
evaluate condition, just the then block and if still skipping at the
end also the else block.
(cxx_eval_outermost_constant_expr): Adjust constexpr_ctx initializer.
(is_sub_constant_expr): Likewise.
Jakub Jelinek [Tue, 30 May 2017 07:31:03 +0000 (09:31 +0200)]
backport: re PR c++/77722 (-fsanitize=undefined doesn't give runtime error in function without return value, unless at least 2 instructions)
Backported from mainline
2016-09-27 Jakub Jelinek <jakub@redhat.com>
PR c++/77722
* cp-gimplify.c (cp_ubsan_maybe_instrument_return): Instrument also
functions that have just a STATEMENT_LIST instead of BIND_EXPR, or
BIND_EXPR with some statement rather than STATEMENT_LIST as body.
* g++.dg/ubsan/return-4.C: New test.
* g++.dg/ubsan/return-5.C: New test.
* g++.dg/ubsan/return-6.C: New test.
Jakub Jelinek [Tue, 30 May 2017 07:26:00 +0000 (09:26 +0200)]
backport: re PR ipa/77587 (C compiler produces incorrect stack alignment with __attribute__((weak)))
Backported from mainline
2016-09-19 Jakub Jelinek <jakub@redhat.com>
Jan Hubicka <jh@suse.cz>
PR target/77587
* cgraph.c (cgraph_node::rtl_info): Pass &avail to
ultimate_alias_target call, return NULL if avail < AVAIL_AVAILABLE.
Call ultimate_alias_target just once, not up to 4 times.
* gcc.dg/pr77587.c: New test.
* gcc.dg/pr77587a.c: New file.
Jakub Jelinek [Tue, 30 May 2017 07:23:20 +0000 (09:23 +0200)]
backport: re PR middle-end/77594 (double computation for __builtin_sub_overflow (0, ...))
Backported from mainline
2016-09-16 Jakub Jelinek <jakub@redhat.com>
Eric Botcazou <ebotcazou@adacore.com>
PR middle-end/77594
* internal-fn.c (expand_arith_overflow) <case MINUS_EXPR>: Don't fall
through into expand_addsub_overflow after expand_neg_overflow.
Jakub Jelinek [Tue, 30 May 2017 07:21:41 +0000 (09:21 +0200)]
backport: re PR fortran/77500 (ICE in gfc_trans_omp_atomic, at fortran/trans-openmp.c:2822)
Backported from mainline
2016-09-08 Jakub Jelinek <jakub@redhat.com>
PR fortran/77500
* trans-openmp.c (gfc_trans_omp_atomic): For atomic write or
swap, don't try to look through GFC_ISYM_CONVERSION. In other cases,
check that value.function.isym is non-NULL before dereferencing it.
Jakub Jelinek [Tue, 30 May 2017 07:18:37 +0000 (09:18 +0200)]
backport: re PR c++/77363 (Missing debug information in DWARF)
Backported from mainline
2016-08-30 Jakub Jelinek <jakub@redhat.com>
PR debug/77363
* dwarf2out.c (modified_type_die): Use lookup_type_die (type)
instead of lookup_type_die (type_main_variant (type)) even for array
types.
Jakub Jelinek [Tue, 30 May 2017 07:15:49 +0000 (09:15 +0200)]
backport: re PR target/71910 (ICE on valid OpenMP code)
Backported from mainline
2016-08-16 Jakub Jelinek <jakub@redhat.com>
PR target/71910
* tree-cfg.c (execute_fixup_cfg): Add node variable, use it. Before inlining,
add cgraph edge for the added __builtin_unreachable call.
Jakub Jelinek [Tue, 30 May 2017 07:12:08 +0000 (09:12 +0200)]
backport: re PR c/67410 (c/c-typeck.c references out of bounds array)
Backported from mainline
2016-08-12 Jakub Jelinek <jakub@redhat.com>
Martin Liska <mliska@suse.cz>
PR c/67410
* c-typeck.c (set_nonincremental_init_from_string): Use / instead of
% to determine val element to change. Assert that
wchar_bytes * charwidth fits into val array.
Jakub Jelinek [Tue, 30 May 2017 07:09:01 +0000 (09:09 +0200)]
backport: re PR c/72816 (ICE on x86_64-linux-gnu (tree check: expected tree that contains ‘decl with RTL’ structure, have ‘field_decl’ in set_decl_rtl, at emit-rtl.c:1282))
Backported from mainline
2016-08-11 Jakub Jelinek <jakub@redhat.com>
PR c/72816
* c-decl.c (grokdeclarator): When adding TYPE_DOMAIN for flexible
array member through typedef, for orig_qual_indirect == 0 clear
orig_qual_type.
Martin Liska [Mon, 29 May 2017 09:12:33 +0000 (11:12 +0200)]
Backport r246961
2017-05-29 Martin Liska <mliska@suse.cz>
Backport from mainline
2017-04-18 Martin Liska <mliska@suse.cz>
PR gcov-profile/78783
* gcov-tool.c (gcov_output_files): Validate that destination
file is either removed by the tool or by a user.
2017-05-29 Martin Liska <mliska@suse.cz>
Backport from mainline
2017-04-18 Martin Liska <mliska@suse.cz>
PR gcov-profile/78783
* libgcov-driver.c (gcov_get_filename): New function.
Martin Liska [Mon, 29 May 2017 09:11:42 +0000 (11:11 +0200)]
Backport r246848
2017-05-29 Martin Liska <mliska@suse.cz>
Backport from mainline
2017-04-11 Martin Liska <mliska@suse.cz>
PR ipa/80212
* cgraph.c (cgraph_node::dump): Dump calls_comdat_local.
* ipa-split.c (split_function): Create a local comdat symbol
if caller is in a comdat group.
2017-05-29 Martin Liska <mliska@suse.cz>
Backport from mainline
2017-04-11 Martin Liska <mliska@suse.cz>
Martin Liska [Mon, 29 May 2017 09:09:27 +0000 (11:09 +0200)]
Backport r246804
2017-05-29 Martin Liska <mliska@suse.cz>
Backport from mainline
2017-04-10 Martin Liska <mliska@suse.cz>
PR gcov-profile/80224
* gcov.c (print_usage): Fix usage string.
(get_gcov_intermediate_filename): Remove.
(output_gcov_file): Use both for normal and intermediate format.
(generate_results): Do not initialize special file for
intermediate format.
Martin Liska [Mon, 29 May 2017 09:08:48 +0000 (11:08 +0200)]
Backport r246530
2017-05-29 Martin Liska <mliska@suse.cz>
Backport from mainline
2017-03-28 Richard Biener <rguenther@suse.de>
PR ipa/80205
* tree-inline.c (copy_phis_for_bb): Do not create PHI node
without arguments, generate default definition of a SSA name.
2017-05-29 Martin Liska <mliska@suse.cz>
Backport from mainline
2017-03-28 Martin Liska <mliska@suse.cz>
Martin Liska [Mon, 29 May 2017 09:08:14 +0000 (09:08 +0000)]
Backport r246525
2017-05-29 Martin Liska <mliska@suse.cz>
Backport from mainline
2017-03-28 Martin Liska <mliska@suse.cz>
PR ipa/80104
* cgraphunit.c (cgraph_node::expand_thunk): Mark argument of a
thunk call as DECL_GIMPLE_REG_P when vector or complex type.
2017-05-29 Martin Liska <mliska@suse.cz>
Backport from mainline
2017-03-28 Martin Liska <mliska@suse.cz>