backport: re PR middle-end/86705 (pr45678-2.c ICE with msp430-elf -mlarge)
2018-08-02 Jozef Lawrynowicz <jozef.l@mittosystems.com>
Backport from mainline
2018-07-31 Jozef Lawrynowicz <jozef.l@mittosystems.com>
PR middle-end/86705
* gcc/cfgexpand.c (set_parm_rtl): Use the alignment of Pmode when
MAX_SUPPORTED_STACK_ALIGNMENT would otherwise be exceeded by the
requested variable alignment.
(expand_one_ssa_partition): Likewise.
(expand_one_var): Likewise.
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.
Eric Botcazou [Tue, 17 Jul 2018 10:12:02 +0000 (10:12 +0000)]
decl.c (choices_to_gnu): Rename parameters.
* gcc-interface/decl.c (choices_to_gnu): Rename parameters. Deal with
an operand of Character type. Factor out range generation to the end.
Check that the bounds are literals and convert them to the type of the
operand before building the ranges.
* gcc-interface/utils.c (make_dummy_type): Minor tweak.
(make_packable_type): Propagate TYPE_DEBUG_TYPE.
(maybe_pad_type): Likewise.
Fritz Reese [Mon, 16 Jul 2018 23:35:39 +0000 (23:35 +0000)]
re PR fortran/83184 (Out of memory or ICE with option -fdec)
2018-07-16 Fritz Reese <fritzoreese@gmail.com>
gcc/testsuite/ChangeLog:
PR fortran/83184
Backport from trunk.
* gfortran.dg/assumed_rank_14.f90: New testcase.
* gfortran.dg/assumed_rank_15.f90: New testcase.
* gfortran.dg/dec_structure_8.f90: Update error messages.
* gfortran.dg/dec_structure_23.f90: Update error messages.
gcc/fortran/ChangeLog:
PR fortran/83184
Backport from trunk.
* decl.c (match_old_style_init): Initialize locus of variable expr when
creating a data variable.
(match_clist_expr): Verify array is explicit shape/size before
attempting to allocate constant array constructor.
Fritz Reese [Mon, 16 Jul 2018 22:25:54 +0000 (22:25 +0000)]
backport: re PR fortran/83183 (Out of memory with option -finit-derived)
2018-07-16 Fritz Reese <fritzoreese@gmail.com>
gcc/testsuite/ChangeLog:
Backport from trunk:
PR fortran/83183
PR fortran/86325
* gfortran.dg/init_flag_18.f90: New testcase.
* gfortran.dg/init_flag_19.f03: New testcase.
gcc/fortran/ChangeLog:
Backport from trunk:
PR fortran/86417
* module.c (mio_component): Set component->loc when loading from module.
PR fortran/83183
PR fortran/86325
* expr.c (class_allocatable, class_pointer, comp_allocatable,
comp_pointer): New helpers.
(component_initializer): Generate EXPR_NULL for allocatable or pointer
components. Do not generate initializers for components within BT_CLASS.
Do not assign to comp->initializer.
(gfc_generate_initializer): Use new helpers; move code to generate
EXPR_NULL for class allocatable components into component_initializer().
Jonathan Wakely [Wed, 4 Jul 2018 13:59:57 +0000 (14:59 +0100)]
Use non-throwing is_directory in filesystem::create_directory
The create_dir helper was calling the throwing form of
filesystem::is_directory instead of passing the error_code argument.
Since std::filesystem::create_directory(const path&, error_code&) is
noexcept, it would call std::terminate if an error occurred in
is_directory.
Passing the error_code also takes care of clearing it in the case where
is_directory returns true.
Backport from mainline
2018-03-09 Jonathan Wakely <jwakely@redhat.com>
src/filesystem/ops.cc (create_dir): Pass error_code to is_directory.
There is no need to use an allocator of the correct value_type when
calling allocator_traits::construct and allocator_traits::destroy. The
existing node allocator can be used, instead of constructing a new
allocator object every time.
There's also no benefit to using __gnu_cxx::__alloc_traits instead of
std::allocator_traits to get the pointer and const_pointer types.
std::forward_list is only available for C++11 and later, when
std::allocator_traits is available too.
Backport from mainline
2018-06-13 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/86127
* include/bits/forward_list.h (_Fwd_list_base::_Tp_alloc_type): Remove
unused typedef.
(_Fwd_list_base::_M_create_node, _Fwd_list_base::_M_erase_after):
Use node allocator to create and destroy elements.
(forward_list::_Tp_alloc_type): Remove unused typedef.
(forward_list::_Alloc_traits): Use allocator_traits instead of
__gnu_cxx::__alloc_traits.
* include/bits/forward_list.tcc (_Fwd_list_base::_M_erase_after):
Use node allocator to create and destroy elements.
Jonathan Wakely [Wed, 4 Jul 2018 13:59:13 +0000 (14:59 +0100)]
PR libstdc++/85098 add missing definitions for static constants
In C++11 and C++14 any odr-use of these constants requires a definition
at namespace-scope. In C++17 they are implicitly inline and so the
namespace-scope redeclarations are redundant (and allowing them is
deprecated).
Backport from mainline
2018-05-18 Jonathan Wakely <jwakely@redhat.com>
Jonathan Wakely [Wed, 4 Jul 2018 13:59:01 +0000 (14:59 +0100)]
PR libstdc++/83982 fix exception-safety guarantee of std::vector::resize
Construct new elements before moving existing ones, so that if a default
constructor throws, the existing elements are not left in a moved-from
state.
Backport from mainline
2018-06-14 Daniel Trebbien <dtrebbien@gmail.com>
Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/83982
* include/bits/vector.tcc (vector::_M_default_append(size_type)):
Default-construct new elements before moving existing ones.
* testsuite/23_containers/vector/capacity/resize/strong_guarantee.cc:
New.
re PR go/86331 (the gccgo's "go" tool looks like failing to invoke any sub go command)
PR go/86331
os: check return value as well as error from waitid
https://gcc.gnu.org/PR86331 indicates that if a signal handler runs it
is possible for syscall.Syscall6 to return a non-zero errno value even
if no error occurs. That is a problem in general, but this fix will
let us work around the general problem for the specific case of
calling waitid.
Martin Liska [Fri, 29 Jun 2018 09:31:30 +0000 (11:31 +0200)]
Partial backport r256656
2018-06-29 Martin Liska <mliska@suse.cz>
Backport from mainline
2018-01-10 Kelvin Nilsen <kelvin@gcc.gnu.org>
* lex.c (search_line_fast): Remove illegal coercion of an
unaligned pointer value to vector pointer type and replace with
use of __builtin_vec_vsx_ld () built-in function, which operates
on unaligned pointer values.
Kelvin Nilsen [Tue, 26 Jun 2018 19:45:01 +0000 (19:45 +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 directives to scan
for vpkudus.
Robin Dapp [Tue, 26 Jun 2018 12:23:02 +0000 (12:23 +0000)]
S/390: Fix mtune default.
When building with --with-tune=zEC12 and calling the resulting gcc
with --march=z13 (no extra -mtune), the binary would unexpectedly be compiled
with -march=z13 -mtune=zEC12. This patch avoids using the default tune
parameter if -march is specified as argument but the user can still
explicitly state -march=z13 -mtune=zEC12.
gcc/ChangeLog:
2018-06-26 Robin Dapp <rdapp@linux.ibm.com>
* config/s390/s390.h (enum processor_flags): Do not use
default tune parameter when -march was specified.
Jakub Jelinek [Tue, 26 Jun 2018 11:54:29 +0000 (13:54 +0200)]
re PR target/86314 (GCC 7.x and 8.x zero out "eax" before using "rax" in "lock bts")
PR target/86314
* config/i386/i386.md (setcc + movzbl to xor + setcc peephole2s):
Check reg_overlap_mentioned_p in addition to reg_set_p with the same
operands.
Jakub Jelinek [Mon, 25 Jun 2018 12:48:29 +0000 (14:48 +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.
Paul Thomas [Mon, 25 Jun 2018 07:52:09 +0000 (07:52 +0000)]
re PR fortran/83118 (Bad intrinsic assignment of class(*) array component of derived type)
2018-06-25 Paul Thomas <pault@gcc.gnu.org>
PR fortran/83118
Back port from trunk
* resolve.c (resolve_ordinary_assign): Force the creation of a
vtable for assignment of non-polymorphic expressions to an
unlimited polymorphic object.
* trans-array.c (gfc_alloc_allocatable_for_assignment): Use the
size of the rhs type for such assignments. Set the dtype, _len
and vptrs appropriately.
* trans-expr.c (gfc_trans_assignment): Force the use of the
_copy function for these assignments.
2018-06-25 Paul Thomas <pault@gcc.gnu.org>
PR fortran/83118
Back port from trunk
* gfortran.dg/unlimited_polymorphic_30.f03: New test.
2018-06-23 Richard Sandiford <richard.sandiford@linaro.org>
gcc/
PR tree-optimization/85989
* gimple-ssa-backprop.c (backprop::m_visited_phis): New member
variable.
(backprop::intersect_uses): Check it when deciding whether this
is a backedge reference.
(backprop::process_block): Add each phi to m_visited_phis
after visiting it, then clear it at the end.
gcc/testsuite/
PR tree-optimization/85989
* gcc.dg/torture/pr85989.c: New test.
Jakub Jelinek [Fri, 22 Jun 2018 21:33:07 +0000 (23:33 +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 [Fri, 22 Jun 2018 21:27:25 +0000 (23:27 +0200)]
backport: re PR c/85696 (OpenMP with variably modified and default(none) won't compile)
Backported from mainline
2018-05-11 Jakub Jelinek <jakub@redhat.com>
PR c/85696
* c-omp.c (c_omp_predetermined_sharing): Return
OMP_CLAUSE_DEFAULT_SHARED for artificial vars with integral type.
* c-typeck.c (c_finish_omp_clauses): Don't use
c_omp_predetermined_sharing, instead just check TREE_READONLY.
* cp-tree.h (cxx_omp_predetermined_sharing_1): New prototype.
* cp-gimplify.c (cxx_omp_predetermined_sharing): New wrapper around
cxx_omp_predetermined_sharing_1. Rename old function to ...
(cxx_omp_predetermined_sharing_1): ... this.
* semantics.c (finish_omp_clauses): Use cxx_omp_predetermined_sharing_1
instead of cxx_omp_predetermined_sharing.
Jakub Jelinek [Fri, 22 Jun 2018 21:25:04 +0000 (23:25 +0200)]
backport: re PR c/85696 (OpenMP with variably modified and default(none) won't compile)
Backported from mainline
2018-05-11 Jakub Jelinek <jakub@redhat.com>
PR c/85696
* c-omp.c (c_omp_predetermined_sharing): Return
OMP_CLAUSE_DEFAULT_SHARED for artificial vars with integral type.
* c-typeck.c (c_finish_omp_clauses): Don't use
c_omp_predetermined_sharing, instead just check TREE_READONLY.
* cp-tree.h (cxx_omp_predetermined_sharing_1): New prototype.
* cp-gimplify.c (cxx_omp_predetermined_sharing): New wrapper around
cxx_omp_predetermined_sharing_1. Rename old function to ...
(cxx_omp_predetermined_sharing_1): ... this.
* semantics.c (finish_omp_clauses): Use cxx_omp_predetermined_sharing_1
instead of cxx_omp_predetermined_sharing.
Jakub Jelinek [Fri, 22 Jun 2018 21:23:03 +0000 (23:23 +0200)]
backport: re PR c++/85662 ("error: non-constant condition for static assertion" from __builtin_offsetof in C++)
Backported from mainline
2018-06-22 Jakub Jelinek <jakub@redhat.com>
PR c++/85662
* g++.dg/ext/offsetof3.C: New test.
2018-05-10 Jakub Jelinek <jakub@redhat.com>
PR c++/85662
* c-common.h (fold_offsetof_1): Removed.
(fold_offsetof): Add TYPE argument defaulted to size_type_node and
CTX argument defaulted to ERROR_MARK.
* c-common.c (fold_offsetof_1): Renamed to ...
(fold_offsetof): ... this. Remove wrapper function. Add TYPE
argument, convert the pointer constant to TYPE and use size_binop
with PLUS_EXPR instead of fold_build_pointer_plus if type is not
a pointer type. Adjust recursive calls.
* c-fold.c (c_fully_fold_internal): Use fold_offsetof rather than
fold_offsetof_1, pass TREE_TYPE (expr) as TYPE to it and drop the
fold_convert_loc.
* c-typeck.c (build_unary_op): Use fold_offsetof rather than
fold_offsetof_1, pass argtype as TYPE to it and drop the
fold_convert_loc.
* cp-gimplify.c (cp_fold): Use fold_offsetof rather than
fold_offsetof_1, pass TREE_TYPE (x) as TYPE to it and drop the
fold_convert.
Jakub Jelinek [Fri, 22 Jun 2018 21:19:32 +0000 (23:19 +0200)]
backport: re PR tree-optimization/85529 (wrong code at -O2 and -O3 on x86_64-linux-gnu)
Backported from mainline
2018-04-27 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/85529
* tree-ssa-reassoc.c (optimize_range_tests_var_bound): Add FIRST_BB
argument. Don't call get_nonzero_bits if opcode is ERROR_MARK_NODE,
rhs2 def stmt's bb is dominated by first_bb and it isn't an obvious
zero extension or masking of the MSB bit.
(optimize_range_tests): Add FIRST_BB argument, pass it through
to optimize_range_tests_var_bound.
(maybe_optimize_range_tests, reassociate_bb): Adjust
optimize_range_tests callers.
* gcc.c-torture/execute/pr85529-1.c: New test.
* gcc.c-torture/execute/pr85529-2.c: New test.
* gcc.dg/pr85529.c: New test.