Martin Liska [Mon, 22 Jul 2019 09:37:18 +0000 (11:37 +0200)]
Backport r273660
2019-07-22 Martin Liska <mliska@suse.cz>
Backport from mainline
2019-07-22 Martin Liska <mliska@suse.cz>
PR driver/91172
* opts-common.c (decode_cmdline_option): Decode
argument of -Werror and check it for a wrong language.
* opts-global.c (complain_wrong_lang): Remove such case.
2019-07-22 Martin Liska <mliska@suse.cz>
Backport from mainline
2019-07-22 Martin Liska <mliska@suse.cz>
Jason Merrill [Fri, 19 Jul 2019 08:53:07 +0000 (04:53 -0400)]
PR c++/90098 - partial specialization and class non-type parms.
A non-type template parameter of class type used in an expression has
const-qualified type; the pt.c hunks deal with this difference from the
unqualified type of the parameter declaration. WAhen we use such a
parameter as an argument to another template, we don't want to confuse
things by copying it, we should pass it straight through. And we might as
well skip copying other classes in constant evaluation context in a
template, too; we'll get the copy semantics at instantiation time.
PR c++/90099
PR c++/90101
* call.c (build_converted_constant_expr_internal): Don't copy.
* pt.c (process_partial_specialization): Allow VIEW_CONVERT_EXPR
around class non-type parameter.
(unify) [TEMPLATE_PARM_INDEX]: Ignore cv-quals.
(invalid_nontype_parm_type_p): Check for dependent class type.
If a noexcept function calls a function that might throw, doing the tail
call optimization means that an exception thrown in the called function
will propagate out, breaking the noexcept specification. So we need to
prevent the optimization in that case.
* tree-tailcall.c (find_tail_calls): Don't turn a call from a
nothrow function to a might-throw function into a tail call.
Kito Cheng [Thu, 18 Jul 2019 07:00:32 +0000 (07:00 +0000)]
RISC-V: Fix splitter for 32-bit AND on 64-bit target.
Fixes github.com/riscv/riscv-gcc issue #161. We were accidentally using
BITS_PER_WORD to compute shift counts when we should have been using the
bitsize of the operand modes. This was wrong when we had an SImode shift
and a 64-bit target.
Andrew Waterman <andrew@sifive.com>
gcc/
* config/riscv/riscv.md (lshrsi3_zero_extend_3+1): Use operands[1]
bitsize instead of BITS_PER_WORD.
gcc/testsuite/
* gcc.target/riscv/shift-shift-2.c: Add one more test.
gcc/ChangeLog:
2019-07-18 Kito Cheng <kito.cheng@sifive.com>
Backport from mainline
2019-07-08 Andrew Waterman <andrew@sifive.com>
Jim Wilson <jimw@sifive.com>
* config/riscv/riscv.md (lshrsi3_zero_extend_3+1): Use operands[1]
bitsize instead of BITS_PER_WORD.
gcc/testsuite/
gcc/testsuite/ChangeLog:
2019-07-18 Kito Cheng <kito.cheng@sifive.com>
Backport from mainline
2019-07-08 Jim Wilson <jimw@sifive.com>
* gcc.target/riscv/shift-shift-2.c: Add one more test.
pa.c (pa_som_asm_init_sections): Don't force all constant data into data section when generating PIC code.
* config/pa/pa.c (pa_som_asm_init_sections): Don't force all constant
data into data section when generating PIC code.
(pa_select_section): Use pa_reloc_rw_mask() to qualify relocs.
(pa_reloc_rw_mask): Return 3 when generating PIC code and when
generating code for SOM targets earlier than HP-UX 11. Otherwise,
return 2 for SOM and 0 for other targets.
Andreas Krebbel [Wed, 17 Jul 2019 07:32:30 +0000 (07:32 +0000)]
S/390: Fix vector shift count operand
We currently use subst definitions to handle the different variants of shift
count operands. Unfortunately, in the vector shift pattern the shift count
operand is used directly. Without it being adjusted for the 'subst' variants the
displacement value is omitted resulting in a wrong shift count being applied.
This patch needs to be applied to older branches as well.
gcc/ChangeLog:
2019-07-17 Andreas Krebbel <krebbel@linux.ibm.com>
Backport from mainline
2019-07-01 Andreas Krebbel <krebbel@linux.ibm.com>
Jakub Jelinek [Sun, 14 Jul 2019 08:28:06 +0000 (10:28 +0200)]
backport: re PR middle-end/78884 ([7/8] ICE when gimplifying VLA in OpenMP SIMD region)
Backported from mainline
2019-07-04 Jakub Jelinek <jakub@redhat.com>
PR middle-end/78884
* gimplify.c (struct gimplify_omp_ctx): Add add_safelen1 member.
(gimplify_bind_expr): If seeing TREE_ADDRESSABLE VLA inside of simd
loop body, set ctx->add_safelen1 instead of making it GOVD_PRIVATE.
(gimplify_adjust_omp_clauses): Add safelen (1) clause if
ctx->add_safelen1 is set.
The gcc.c-torture/execute/builtins/lib directory contains a reimplementation
of many C library string functions, which causes non-trivial register allocation
bugs with LTO and static linked libraries. To fix this long-standing test issue,
turn off ipa-ra which avoids the register corruption across calls. All builtin
torture tests now pass on aarch64-none-elf. Committed as obvious.
See PR78529 for more details.
Backport from mainline
2019-07-04 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/91063
* tree-vect-stmts.c (vect_init_vector): Call gsi_remove to remove
stmt from stmts sequence before calling vect_init_vector_1.
Formatting fix.
* gcc.dg/gomp/pr91063.c: New test.
2019-07-04 Richard Biener <rguenther@suse.de>
PR ipa/91062
* tree-pass.h (execute_all_ipa_transforms): Add a flag
parameter whether to disable GC collection.
* passes.c (execute_one_ipa_transform_pass): Likewise, and
honor it.
(execute_all_ipa_transforms): Likewise and pass it down.
* cgraph.c (cgraph_node::get_body): Do not invoke garbage
collection from applying IPA transforms.
* cgraphunit.c (cgraph_node::expand): Allow garbage collection
from applying IPA transforms.
Eric Botcazou [Fri, 12 Jul 2019 10:16:11 +0000 (10:16 +0000)]
re PR rtl-optimization/91136 (incorrect move of instruction to delay slot causes application crash in exception handling)
PR rtl-optimization/91136
* df-core.c (ACCESSING REFS): Fix typos in comment.
* resource.c (mark_target_live_reg): Add artificial defs that occur at
the beginning of the block to the initial set of live registers.
This patch recognises Modula-2 as language for the traceback table,
fixing the problem shown in
https://gcc.gnu.org/ml/gcc-patches/2019-07/msg00848.html .
Richard Biener [Mon, 8 Jul 2019 11:48:48 +0000 (11:48 +0000)]
re PR tree-optimization/91108 (Fails to pun through unions)
2019-07-08 Richard Biener <rguenther@suse.de>
PR tree-optimization/91108
* tree-ssa-sccvn.c: Include builtins.h.
(vn_reference_lookup_3): Use only alignment constraints to
verify same-valued store disambiguation.
* gcc.dg/tree-ssa/pr91091-1.c: New testcase.
* gcc.dg/tree-ssa/ssa-fre-78.c: Likewise.
Paul Thomas [Sun, 7 Jul 2019 14:32:53 +0000 (14:32 +0000)]
re PR fortran/91077 (Wrong indexing when using a pointer)
2019-07-07 Paul Thomas <pault@gcc.gnu.org>
PR fortran/91077
* trans-array.c (gfc_conv_scalarized_array_ref) Delete code
that gave symbol backend decl for subref arrays and deferred
length variables.
2019-07-07 Paul Thomas <pault@gcc.gnu.org>
PR fortran/91077
* gfortran.dg/pointer_array_11.f90 : New test.
A dynamic linker with lazy binding support may need to handle vector PCS
function symbols specially, so an ELF symbol table marking was
introduced for such symbols.
Function symbol references and definitions that follow the vector PCS
are marked in the generated assembly with .variant_pcs and then the
STO_AARCH64_VARIANT_PCS st_other flag is set on the symbol in the object
file. The marking is propagated to the dynamic symbol table by the
static linker so a dynamic linker can handle such symbols specially.
For this to work, the assembler, the static linker and the dynamic
linker has to be updated on a system. Old assembler does not support
the new .variant_pcs directive, so a toolchain with old binutils won't
be able to compile code that references vector PCS symbols.
Jonathan Wakely [Wed, 3 Jul 2019 21:09:13 +0000 (22:09 +0100)]
PR libstdc++/91067 fix missing exports for filesystem iterators
The copy assignment operator for recursive_directory_iterator was not
exported despite being needed. The __shared_ptr default constructors are
not needed when compiling with GCC but Clang requires them for -O1.
PR libstdc++/91067
* acinclude.m4 (libtool_VERSION): Bump to 6:27:0.
* configure: Regenerate.
* config/abi/pre/gnu.ver (GLIBCXX_3.4.27): Add new version. Export
missing symbols.
* testsuite/27_io/filesystem/iterators/91067.cc: New test.
* testsuite/util/testsuite_abi.cc: Add new symbol version.
Jonathan Wakely [Wed, 3 Jul 2019 21:09:08 +0000 (22:09 +0100)]
Fix preprocessor checks for Clang builtins
Clang seems to define built-ins that start with "__builtin_" as
non-keywords, which means that we need to use __has_builtin to detect
them, not __is_identifier. The built-ins that don't start with
"__builtin_" are keywords, and can only be detected using
__is_identifier and not by __has_builtin.
Backport from mainline
2019-07-02 Jonathan Wakely <jwakely@redhat.com>
* include/bits/c++config (_GLIBCXX_HAVE_BUILTIN_LAUNDER)
(_GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED): Use __has_builtin
instead of __is_identifier to detect Clang support.
Marek Polacek [Tue, 2 Jul 2019 00:23:41 +0000 (00:23 +0000)]
PR c++/90490 - fix decltype issues in noexcept-specifier.
* except.c (build_noexcept_spec): Call
instantiate_non_dependent_expr_sfinae before
build_converted_constant_expr instead of calling
instantiate_non_dependent_expr after it. Add
processing_template_decl_sentinel.
* g++.dg/cpp0x/noexcept43.C: New test.
* g++.dg/cpp0x/noexcept44.C: New test.
Marek Polacek [Tue, 2 Jul 2019 00:22:37 +0000 (00:22 +0000)]
PR c++/60223 - ICE with T{} in non-deduced context.
* pt.c (unify): Allow COMPOUND_LITERAL_P in a non-deduced context.
* g++.dg/cpp0x/nondeduced1.C: New test.
* g++.dg/cpp0x/nondeduced2.C: New test.
* g++.dg/cpp0x/nondeduced3.C: New test.
* g++.dg/cpp0x/nondeduced4.C: New test.
Eric Botcazou [Sat, 29 Jun 2019 09:05:43 +0000 (09:05 +0000)]
decl.c (gnat_to_gnu_entity): Beep up comment on SAVED...
* gcc-interface/decl.c (gnat_to_gnu_entity): Beep up comment on SAVED,
and tweak comment on the assertion about the scopes of Itypes. Do not
skip the regular processing for Itypes that are E_Record_Subtype with
a Cloned_Subtype. Get the Cloned_Subtype for every E_Record_Subtype
if the type is dummy and hasn't got its own freeze node.
<E_Record_Subtype>: Save again the DECL of the Cloned_Subtype, if any.
<E_Access_Subtype>: Save again the DECL of the equivalent type.
(Gigi_Equivalent_Type) <E_Access_Subtype>: New case.
Eric Botcazou [Sat, 29 Jun 2019 07:30:57 +0000 (07:30 +0000)]
decl.c (set_nonaliased_component_on_array_type): Add missing guard for the presence of TYPE_CANONICAL.
* gcc-interface/decl.c (set_nonaliased_component_on_array_type): Add
missing guard for the presence of TYPE_CANONICAL.
(set_reverse_storage_order_on_array_type): Likewise.
Jakub Jelinek [Fri, 28 Jun 2019 22:56:27 +0000 (00:56 +0200)]
backport: re PR target/90991 (_mm_loadu_ps instrinsic translates to vmovaps in combination with _mm512_insertf32x4)
Backported from mainline
2019-06-26 Jakub Jelinek <jakub@redhat.com>
PR target/90991
* config/i386/sse.md
(*<extract_type>_vinsert<shuffletype><extract_suf>_0): Use vmovupd,
vmovups, vmovdqu, vmovdqu32 or vmovdqu64 instead of the aligned
insns if operands[2] is misaligned_operand.
Jonathan Wakely [Thu, 27 Jun 2019 11:31:02 +0000 (12:31 +0100)]
PR libstdc++/85494 use rand_s in std::random_device
This is a minimal fix for the use of a deterministic RNG on mingw-w64,
simply using rand_s unconditionally. The rest of the r271740 changes on
trunk are not included. That means that RDSEED and RDRAND are not
available for mingw-w64 and the token passed to the constructor is
ignored completely.
PR libstdc++/85494 use rand_s in std::random_device
* config/os/mingw32-w64/os_defines.h (_GLIBCXX_USE_CRT_RAND_S): Define.
* src/c++11/cow-string-inst.cc (random_device::_M_init_pretr1)
[_GLIBCXX_USE_CRT_RAND_S]: Do nothing if rand_s will be used.
* src/c++11/random.cc [_GLIBCXX_USE_CRT_RAND_S] (__winxp_rand_s):
Define new function.
(random_device::_M_init_pretr1) [_GLIBCXX_USE_CRT_RAND_S]: Do nothing
if rand_s will be used.
(random_device::_M_getval_pretr1) [_GLIBCXX_USE_CRT_RAND_S]: Use
__winxp_rand_s().
* testsuite/26_numerics/random/random_device/85494.cc: New test.
When I refactored the filesystem_error code I changed it to only use the
constructor parameter in the what() string, instead of the string
returned by system_error::what(). That meant it no longer included the
description of the error_code that system_error adds. This restores the
previous behaivour, as encouraged by the standard ("Implementations
should include the system_error::what() string and the pathnames of
path1 and path2 in the native format in the returned string").
PR libstdc++/91012
* src/c++17/fs_path.cc (filesystem_error::_Impl): Use a string_view
for the what_arg parameters.
(filesystem_error::filesystem_error): Pass system_error::what() to
the _Impl constructor.
* testsuite/27_io/filesystem/filesystem_error/cons.cc: Ensure that
filesystem_error::what() contains system_error::what().
Andrew Stubbs [Tue, 25 Jun 2019 09:47:15 +0000 (09:47 +0000)]
GCN: Wait for exit value to write before exiting.
2019-06-25 Andrew Stubbs <ams@codesourcery.com>
Backport from mainline
2019-05-24 Andrew Stubbs <ams@codesourcery.com>
gcc/
* config/gcn/gcn-run.c (main): Set a non-zero return value if the
kernel does not exit cleanly.
* config/gcn/gcn.md (gcn_return): Insert s_waitcnt before s_dcache_wb.
Thomas Koenig [Fri, 21 Jun 2019 19:28:54 +0000 (19:28 +0000)]
backport: re PR fortran/90937 (ICE: in gfc_get_symbol_decl, at fortran/trans-decl.c:1538)
2019-06-21 Thomas Koenig <tkoenig@gcc.gnu.org>
Backport from trunk
PR fortran/90937
* trans-types.c (get_formal_from_actual_arglist): Get symbol from
current namespace so it will be freed later. If symbol is of type
character, get an empty character length.
2019-06-21 Thomas Koenig <tkoenig@gcc.gnu.org>
Backport from trunk
PR fortran/90937
* gfortran.dg/external_procedure_4.f90: New test.
Jonathan Wakely [Fri, 21 Jun 2019 17:37:07 +0000 (18:37 +0100)]
PR libstdc++/90920 restore previous checks for empty ranges
The change in r263433 broke the contract of the __rotate functions, by no
longer accepting empty ranges. That means that callers which inlined the
old version of std::rotate (without checks) that end up linking to a new
definition of std::__rotate (also without checks) could perform a divide
by zero and crash.
This restores the old contract of the __rotate overloads.
Backport from mainline
2019-06-19 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/90920 partially revert r263433
* include/bits/stl_algo.h (__rotate): Restore checks for empty ranges.
(rotate): Remove checks.
* testsuite/25_algorithms/rotate/90920.cc: New test.
Steven G. Kargl [Thu, 20 Jun 2019 23:50:54 +0000 (23:50 +0000)]
backport: re PR fortran/77632 ([F08] Pointer initialisation does not quite work with arrays)
2019-06-20 Steven G. Kargl <kargl@gcc.gnu.org>
Backport from mainline
PR fortran/77632
* /decl.c (variable_decl): Mark a variable that is a target in pointer
initialization when in PROGRAM, MODULE, or SUBMODULE scope with an
implicit save.
2019-06-20 Steven G. Kargl <kargl@gcc.gnu.org>
Backport from mainline
PR fortran/77632
* gfortran.dg/pr77632_1.f90: New test.