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>
Andreas Tobler [Fri, 19 May 2017 18:39:54 +0000 (20:39 +0200)]
backport: unwind-arm.h: Make _Unwind_GetIP...
2017-05-19 Andreas Tobler <andreast@gcc.gnu.org>
Backport from mainline
2017-05-17 Andreas Tobler <andreast@gcc.gnu.org>
* config/arm/unwind-arm.h: Make _Unwind_GetIP, _Unwind_GetIPInfo and
_Unwind_SetIP available as functions for arm*-*-freebsd*.
* config/arm/unwind-arm.c: Implement the above.
Janne Blomqvist [Fri, 19 May 2017 13:30:45 +0000 (16:30 +0300)]
Don't assume __secure_getenv is available
Glibc 2.17 made __secure_getenv an officially supported function, and
renamed it secure_getenv. The libgfortran configure has checked for
both of these, per
https://sourceware.org/glibc/wiki/Tips_and_Tricks/secure_getenv.
Unfortunately, while the dynamical library (libc.so) retains the
__secure_getenv symbol for backwards compatibility, the static library
(libc.a) does not. This means that a libgfortran.a compiled against an
older glibc will not work if one tries to link against a newer
libc.a. This creates problems for providing gfortran binary
distributions that work on as many target systems as possible.
Thus, retain the support for __secure_getenv but call it only via a
weak reference.
Backported from trunk.
2017-05-19 Janne Blomqvist <jb@gcc.gnu.org>
* libgfortran.h: HAVE_SECURE_GETENV: Don't check
HAVE___SECURE_GETENV.
* environ/runtime.c (secure_getenv): Use __secure_getenv via a
weak reference.
Jonathan Wakely [Thu, 18 May 2017 15:31:41 +0000 (16:31 +0100)]
Skip C tests if test flags include C++ options
Backport from mainline
2016-08-02 Jonathan Wakely <jwakely@redhat.com>
* testsuite/18_support/bad_exception/23591_thread-1.c: Skip test if
options are present that aren't valid for C.
* testsuite/abi/header_cxxabi.c: Likewise.
Jonathan Wakely [Thu, 18 May 2017 15:31:02 +0000 (16:31 +0100)]
PR69699 document why __GLIBCXX__ macro is useless
Backport from mainline
2017-01-17 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/69699
* doc/xml/manual/abi.xml (abi.versioning.history): Explain why the
_GLIBCXX__ macro is not useful. Remove redundant date information
and link to the GCC release timeline.
(abi.versioning.active): Move partial sentence into the previous
paragraph.
* doc/html/*: Regenerate.
Backport from mainline
2016-11-09 Tim Shen <timshen@google.com>
PR libstdc++/78236
* libstdc++-v3/include/bits/regex.h (regex_iterator::regex_iterator()):
Define end() as _M_pregex == nullptr.
* libstdc++-v3/include/bits/regex.tcc (regex_iterator::operator==(),
regex_iterator::operator++()): Fix operator==() and operator++() to
look at null-ness of _M_pregex on both sides.
* testsuite/28_regex/regression.cc: New testcase.
Jonathan Wakely [Thu, 18 May 2017 09:23:29 +0000 (10:23 +0100)]
Enable printers and xmethods for std::__cxx11::list
Backport from mainline
2016-10-11 Jonathan Wakely <jwakely@redhat.com>
* python/libstdcxx/v6/printers.py (build_libstdcxx_dictionary):
Register printer for std::__cxx11::list.
* python/libstdcxx/v6/xmethods.py (ListMethodsMatcher.match): Match
std::__cxx11::list as well as std::list.
PR c/79756
* c-common.c (c_common_mark_addressable_vec): Look through
C_MAYBE_CONST_EXPR.
* gcc.dg/vector-1.c: New testcase.
2017-02-28 Richard Biener <rguenther@suse.de>
PR tree-optimization/79732
* tree-inline.c (expand_call_inline): Handle anonymous
SSA lhs properly when inlining a function without return
value.
* gcc.dg/torture/pr79732.c: New testcase.
2017-02-22 Richard Biener <rguenther@suse.de>
PR tree-optimization/79666
* tree-vrp.c (extract_range_from_binary_expr_1): Make sure
to not symbolically negate if that may introduce undefined
overflow.
Richard Biener [Wed, 10 May 2017 07:53:45 +0000 (07:53 +0000)]
Backport PRs 80122, 80222, 80334, 80539
2017-05-10 Richard Biener <rguenther@suse.de>
Backport from mainline
2017-03-21 Richard Biener <rguenther@suse.de>
PR tree-optimization/80122
* tree-inline.c (copy_bb): Do not expans va-arg packs or
va_arg_pack_len when the inlined call stmt requires pack
expansion itself.
* tree-inline.h (struct copy_body_data): Make call_stmt a gcall *.
* gcc.dg/torture/pr80122.c: New testcase.
2017-03-28 Richard Biener <rguenther@suse.de>
PR middle-end/80222
* gimple-fold.c (gimple_fold_indirect_ref): Do not touch
TYPE_REF_CAN_ALIAS_ALL references.
* fold-const.c (fold_indirect_ref_1): Likewise.
* g++.dg/pr80222.C: New testcase.
2017-04-06 Richard Biener <rguenther@suse.de>
PR tree-optimization/80334
* tree-ssa-loop-ivopts.c (rewrite_use_address): Properly
preserve alignment of accesses.
* g++.dg/torture/pr80334.C: New testcase.
2017-04-27 Richard Biener <rguenther@suse.de>
PR middle-end/80539
* tree-chrec.c (chrec_fold_plus_poly_poly): Deal with not
being in loop-closed SSA form conservatively.
(chrec_fold_multiply_poly_poly): Likewise.
2016-05-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
Backport from mainline
PR target/69868 + swap optimization backports
* config/rs6000/rs6000.c (swap_web_entry): Enlarge
special_handling bitfield.
(special_handling_values): Add SH_XXPERMDI, SH_CONCAT, SH_VPERM,
and SH_VPERM_COMP.
(const_load_sequence_p): New.
(load_comp_mask_p): New.
(v2df_reduction_p): New.
(rtx_is_swappable_p): Perform special handling for XXPERMDI and
for reductions.
(insn_is_swappable_p): Perform special handling for VEC_CONCAT,
V2DF reductions, and various permutes.
(adjust_xxpermdi): New.
(adjust_concat): New.
(find_swapped_load_and_const_vector): New.
(replace_const_vector_in_load): New.
(adjust_vperm): New.
(adjust_vperm_comp): New.
(handle_special_swappables): Call adjust_xxpermdi, adjust_concat,
adjust_vperm, and adjust_vperm_comp.
(replace_swap_with_copy): Allow vector NOT operations to also be
replaced by copies.
(dump_swap_insn_table): Handle new special handling values.
[gcc/testsuite]
2016-05-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
Janus Weil [Mon, 1 May 2017 10:51:22 +0000 (12:51 +0200)]
backport: re PR fortran/80392 ([OOP] ICE with allocatable polymorphic function result in a procedure pointer component)
2017-05-01 Janus Weil <janus@gcc.gnu.org>
Backport from trunk
PR fortran/80392
* trans-types.c (gfc_get_derived_type): Prevent an infinite loop when
building a derived type that includes a procedure pointer component
with a polymorphic result.
2017-05-01 Janus Weil <janus@gcc.gnu.org>
Backport from trunk
PR fortran/80392
* gfortran.dg/proc_ptr_comp_49.f90: New test case.