David Malcolm [Fri, 12 Feb 2021 01:31:28 +0000 (20:31 -0500)]
analyzer: fix ICE in print_mem_ref [PR98969]
PR analyzer/98969 and PR analyzer/99064 describes ICEs, in both cases
within print_mem_ref, when falsely reporting memory leaks - though it
is possible to generate the ICE on other diagnostics (which I added
in one of the test cases).
This patch fixes the ICE, leaving the fix for the leak false positives
as followup work.
The analyzer uses region_model::get_representative_path_var and
region_model::get_representative_tree to map back from its svalue
and region classes to the tree type used by the rest of the compiler,
and, in particular, for diagnostics.
The root cause of the ICE is sloppiness about types within those
functions; specifically when casts were stripped off svalues. To
track these down I added wrapper functions that verify that the
types of the results are correct, and in doing so found various
other type-safety issues, which the patch also fixes.
Doing so led to various changes in diagnostics messages due to
more accurate types, but I felt that these changes weren't
desirable.
For example, the warning at CVE-2005-1689-minimal.c line 48
which expects:
double-'free' of 'inbuf.data'
changed fo
double-'free' of '(char *)inbuf.data'
So I added stripping of top-level casts where necessary to avoid
cluttering diagnostics.
Finally, the more accurate types led to worse results from
readability_comparator, where e.g. the event message at line 50
of sensitive-1.c regressed from the precise:
passing sensitive value 'password' in call to 'called_by_test_5' from 'test_5'
to the vaguer:
calling 'called_by_test_5' from 'test_5'
This was due to erroneously picking the initial value of "password"
in the caller frame as the best value within the *callee* frame, due to
"char *" vs "const char *", which confuses the logic for tracking values
that pass along callgraph edges. The patch fixes this by combining the
readability tests for tree and stack depth, rather than performing
them in sequence, so that it favors the value in the deepest frame.
As noted above, the patch fixes the ICEs, but does not fix the
leak false positives.
gcc/analyzer/ChangeLog:
PR analyzer/98969
* engine.cc (readability): Add names for the various arbitrary
values. Handle NOP_EXPR and INTEGER_CST.
(readability_comparator): Combine the readability tests for
tree and stack depth, rather than performing them sequentially.
(impl_region_model_context::on_state_leak): Strip off top-level
casts.
* region-model.cc (region_model::get_representative_path_var): Add
type-checking, moving the bulk of the implementation to...
(region_model::get_representative_path_var_1): ...here. Respect
types in casts by recursing and re-adding the cast, rather than
merely stripping them off. Use the correct type when handling
region_svalue.
(region_model::get_representative_tree): Strip off any top-level
cast.
(region_model::get_representative_path_var): Add type-checking,
moving the bulk of the implementation to...
(region_model::get_representative_path_var_1): ...here.
* region-model.h (region_model::get_representative_path_var_1):
New decl
(region_model::get_representative_path_var_1): New decl.
* store.cc (append_pathvar_with_type): New.
(binding_cluster::get_representative_path_vars): Cast path_vars
to the correct type when adding them to *OUT_PVS.
gcc/testsuite/ChangeLog:
PR analyzer/98969
* g++.dg/analyzer/pr99064.C: New test.
* gcc.dg/analyzer/pr98969.c: New test.
GCC Administrator [Fri, 12 Feb 2021 00:16:25 +0000 (00:16 +0000)]
Daily bump.
Eric Botcazou [Thu, 11 Feb 2021 23:16:49 +0000 (00:16 +0100)]
Fix -freorder-blocks-and-partition glitch with Windows SEH
Since GCC 8, the -freorder-blocks-and-partition pass can split a function
into hot and cold parts, thus generating 2 CIEs for a single function in
DWARF for exception purposes and doing an equivalent trick for Windows SEH.
Now the Windows system unwinder is picky when it comes to the boundary
between an active EH region and the end of the function and, therefore,
a nop may need to be added in specific cases.
gcc/
* config/i386/winnt.c (i386_pe_seh_unwind_emit): When switching to
the cold section, emit a nop before the directive if the previous
active instruction can throw.
Uros Bizjak [Thu, 11 Feb 2021 23:07:56 +0000 (00:07 +0100)]
libgomp/i386: Revert the type of syscall wrappers output back to long.
Linux man-pages 5.07 wrongly declares syscall output type as int. This error
was fixed in release 5.10, so this patch reverts my recent change.
2021-02-11 Uroš Bizjak <ubizjak@gmail.com>
libgomp/
* config/linux/x86/futex.h (__futex_wait):
Revert output type back to long.
(__futex_wake): Ditto.
(futex_wait): Update for revert.
(futex_wake): Ditto.
Uros Bizjak [Thu, 11 Feb 2021 21:48:47 +0000 (22:48 +0100)]
libgomp/i386: Move syscall asms to static inline wrapper.
Move syscall asms to static inline wrapper functions to improve #ifdeffery.
Also correct output type to int and timeout type to void *.
2021-02-11 Uroš Bizjak <ubizjak@gmail.com>
libgomp/
* config/linux/x86/futex.h (__futex_wait): New static inline
wrapper function. Correct output type to int and
timeout type to void *.
(__futex_wake): New static inline wrapper function.
Correct output type to int.
(futex_wait): Use __futex_wait.
(futex_wake): Use __futex_wake.
Marek Polacek [Tue, 9 Feb 2021 20:17:48 +0000 (15:17 -0500)]
c++: Endless loop with targ deduction in member tmpl [PR95888]
My r10-7007 patch tweaked tsubst not to reduce the template level of
template parameters when tf_partial. That caused infinite looping in
is_specialization_of: we ended up with a class template specialization
whose TREE_TYPE (CLASSTYPE_TI_TEMPLATE (t)) == t, so the second for
loop in is_specialization_of never finished.
There's a lot going on in this test, but essentially: the template fn
here has two template parameters, we call it with one explicitly
provided, the other one has to be deduced. So we'll find ourselves
in fn_type_unification which uses tf_partial when tsubsting the
*explicit* template arguments into the function type. That leads to
tsubstituting the return type, C<T>. C is a member template; its
most general template is
template<class U> template<class V> struct B<U>::C
we figure out (tsubst_template_args) that the template argument list
is <int, int>. They come from different levels, one comes from B<int>,
the other one from fn<int>.
So now we lookup_template_class to see if we have C<int, int>. We
do the
/* This is a full instantiation of a member template. Find
the partial instantiation of which this is an instance. */
TREE_VEC_LENGTH (arglist)--;
// arglist is now <int>, not <int, int>
found = tsubst (gen_tmpl, arglist, complain, NULL_TREE);
TREE_VEC_LENGTH (arglist)++;
magic which is looking for the partial instantiation, in this case,
that would be template<class V> struct B<int>::C. Note we're still
in a tf_partial context! So the tsubst_template_args in the tsubst
(which tries to substitute <int> into <U, V>) returns <int, V>, but
V's template level hasn't been reduced! After tsubst_template_args,
tsubst_template_decl looks to see if we already have this specialization:
// t = template_decl C
// full_args = <int, V>
spec = retrieve_specialization (t, full_args, hash);
but doesn't find the one we created a while ago, when processing
B<int> b; in the test, because V's levels don't match. Whereupon
tsubst_template_decl creates a new TEMPLATE_DECL, one that leads to
the infinite looping problem.
Fixed by using tf_none when looking for an existing partial instantiation.
It also occurred to me that I should be able to trigger a similar
problem with 'auto', since r10-7007 removed an is_auto check. And lo,
I constructed deduce10.C which exhibits the same issue with pre-r10-7007
compilers. This patch fixes that problem as well. I'm ecstatic.
gcc/cp/ChangeLog:
PR c++/95888
* pt.c (lookup_template_class_1): Pass tf_none to tsubst when looking
for the partial instantiation.
gcc/testsuite/ChangeLog:
PR c++/95888
* g++.dg/template/deduce10.C: New test.
* g++.dg/template/deduce9.C: New test.
Peter Bergner [Thu, 11 Feb 2021 20:15:26 +0000 (14:15 -0600)]
rs6000: Fix invalid address used in MMA built-in function
The mma_assemble_input_operand predicate is too lenient on the memory
operands it will accept, leading to an ICE when illegitimate addresses
are passed in. The solution is to only accept memory operands with
addresses that are valid for quad word memory accesses. The test case
is a minimized test case from the Eigen library. The creduced test case
is very noisy with respect to warnings, so the test case has added -w to
silence them.
2021-02-11 Peter Bergner <bergner@linux.ibm.com>
gcc/
PR target/99041
* config/rs6000/predicates.md (mma_assemble_input_operand): Restrict
memory addresses that are legal for quad word accesses.
gcc/testsuite/
PR target/99041
* g++.target/powerpc/pr99041.C: New test.
Jonathan Wakely [Thu, 11 Feb 2021 16:18:19 +0000 (16:18 +0000)]
libstdc++: Fix versioned namespace build
The recent changes to define various std::exception_ptr functions inline
included a change so that the definitions of those functions would be
omitted for the ABI unstable gnu-versioned-namespace configuration. That
change was incorrect, because the existing functions that are gated by
the _GLIBCXX_EH_PTR_COMPAT macro are always needed even for the
versioned namespace.
This change introduces a new macro to control whether operator== is
defined as deleted or not, distinct from the existing macro. The new
macro is not defined for versioned namespace builds, but the old macro
still is.
libstdc++-v3/ChangeLog:
* libsupc++/eh_ptr.cc (_GLIBCXX_EH_PTR_RELOPS_COMPAT): Define
new macro.
* libsupc++/exception_ptr.h (_GLIBCXX_EH_PTR_USED): Check new
macro instead of _GLIBCXX_EH_PTR_COMPAT.
(operator==): Likewise.
Jonathan Wakely [Thu, 11 Feb 2021 15:35:23 +0000 (15:35 +0000)]
libstdc++: Document when C++11/14/17 support became stable [PR 99058]
libstdc++-v3/ChangeLog:
PR libstdc++/99058
* doc/xml/manual/status_cxx2011.xml: Document when support
became stable.
* doc/xml/manual/status_cxx2014.xml: Likewise.
* doc/xml/manual/status_cxx2017.xml: Likewise.
* doc/html/manual/status.html: Regenerate.
Jakub Jelinek [Thu, 11 Feb 2021 16:24:17 +0000 (17:24 +0100)]
c++: Fix zero initialization of flexible array members [PR99033]
array_type_nelts returns error_mark_node for type of flexible array members
and build_zero_init_1 was placing an error_mark_node into the CONSTRUCTOR,
on which e.g. varasm ICEs. I think there is nothing erroneous on zero
initialization of flexible array members though, such arrays should simply
get no elements, like they do if such classes are constructed (everything
except when some larger initializer comes from an explicit initializer).
So, this patch handles [] arrays in zero initialization like [0] arrays
and fixes handling of the [0] arrays - the
tree_int_cst_equal (max_index, integer_minus_one_node) check
didn't do what it thought it would do, max_index is typically unsigned
integer (sizetype) and so it is never equal to a -1.
What the patch doesn't do and maybe would be desirable is if it returns
error_mark_node for other reasons let the recursive callers not stick that
into CONSTRUCTOR but return error_mark_node instead. But I don't have a
testcase where that would be needed right now.
2021-02-11 Jakub Jelinek <jakub@redhat.com>
PR c++/99033
* init.c (build_zero_init_1): Handle zero initialiation of
flexible array members like initialization of [0] arrays.
Use integer_minus_onep instead of comparison to integer_minus_one_node
and integer_zerop instead of comparison against size_zero_node.
Formatting fixes.
* g++.dg/ext/flexary38.C: New test.
Marek Polacek [Thu, 11 Feb 2021 03:51:30 +0000 (22:51 -0500)]
c++: ICE with unexpanded pack in do-while [PR99063]
Here an unexpanded parameter pack snuck into prep_operand which doesn't
expect to see an operand without a type, and since r247842
NONTYPE_ARGUMENT_PACK doesn't have a type anymore.
This only happens with the do-while loop whose condition may not
contain a declaration so we never called finish_cond which checks
for unexpanded parameter packs. So use check_for_bare_parameter_packs
to remedy that.
gcc/cp/ChangeLog:
PR c++/99063
* semantics.c (finish_do_stmt): Check for unexpanded parameter packs.
gcc/testsuite/ChangeLog:
PR c++/99063
* g++.dg/cpp0x/variadic-crash6.C: New test.
Patrick Palka [Thu, 11 Feb 2021 15:59:54 +0000 (10:59 -0500)]
c++: Fix ICE from op_unqualified_lookup [PR97582]
In this testcase, we're crashing because the lookup of operator+ from
within the generic lambda via lookup_name finds multiple bindings
(C1::operator+ and C2::operator+) and returns a TREE_LIST thereof,
something which op_unqualified_lookup (and push_operator_bindings) isn't
prepared to handle.
This patch extends op_unqualified_lookup and push_operator_bindings
to handle such an ambiguous lookup result in the natural way.
gcc/cp/ChangeLog:
PR c++/97582
* name-lookup.c (op_unqualified_lookup): Handle an ambiguous
lookup result by discarding it if the first element is a
class-scope declaration, otherwise return it.
(push_operator_bindings): Handle an ambiguous lookup result by
doing push_local_binding on each element in the list.
gcc/testsuite/ChangeLog:
PR c++/97582
* g++.dg/cpp0x/lambda/lambda-template17.C: New test.
Andrea Corallo [Wed, 3 Feb 2021 14:21:54 +0000 (15:21 +0100)]
arm: Low overhead loop handle long range branches [PR98931]
gcc/
PR target/98931
* config/arm/thumb2.md (*doloop_end_internal): Generate
alternative sequence to handle long range branches.
gcc/testsuite/
PR target/98931
* gcc.target/arm/pr98931.c: New testcase.
Joel Hutton [Thu, 11 Feb 2021 14:59:26 +0000 (14:59 +0000)]
[aarch64][vect] Support V8QI->V8HI WIDEN_ patterns
In the case where 8 out of every 16 elements are widened using a
widening pattern and the next 8 are skipped, the patterns are not
recognized. This is because they are normally used in a pair, such as
VEC_WIDEN_MINUS_HI/LO, to achieve a v16qi->v16hi conversion for example.
This patch adds support for V8QI->V8HI patterns.
gcc/ChangeLog:
PR tree-optimization/98772
* optabs-tree.c (supportable_half_widening_operation): New function
to check for supportable V8QI->V8HI widening patterns.
* optabs-tree.h (supportable_half_widening_operation): New function.
* tree-vect-stmts.c (vect_create_half_widening_stmts): New function
to create promotion stmts for V8QI->V8HI widening patterns.
(vectorizable_conversion): Add case for V8QI->V8HI.
gcc/testsuite/ChangeLog:
PR tree-optimization/98772
* gcc.target/aarch64/pr98772.c: New test.
Paul Thomas [Thu, 11 Feb 2021 13:24:50 +0000 (13:24 +0000)]
Fortran: Fix calls to associate name typebound subroutines [PR98897].
2021-02-11 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/98897
* match.c (gfc_match_call): Include associate names as possible
entities with typebound subroutines. The target needs to be
resolved for the type.
gcc/testsuite/
PR fortran/98897
* gfortran.dg/typebound_call_32.f90: New test.
Richard Biener [Tue, 9 Feb 2021 10:50:23 +0000 (11:50 +0100)]
reduce sparseset memory requirement
Currently we use HOST_WIDEST_FAST_INT for the sparseset element
type which maps to a 64bit type on 64bit hosts. That's excessive
for the only current sparseset users which are LRA and IRA and
which store register numbers in it which are unsigned int. The
following changes the sparseset element type to unsigned int.
2021-02-09 Richard Biener <rguenther@suse.de>
* sparseset.h (SPARSESET_ELT_BITS): Remove.
(SPARSESET_ELT_TYPE): Use unsigned int.
* fwprop.c: Do not include sparseset.h.
Paul Thomas [Thu, 11 Feb 2021 10:38:23 +0000 (10:38 +0000)]
Fortran: Fix ICE after error regression [PR99060].
2021-02-11 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/99060
* primary.c (gfc_match_varspec): Test for non-null 'previous'
before using its name in the error message.
gcc/testsuite/
PR fortran/99060
* gfortran.dg/pr99060.f90: New test.
Tobias Burnus [Thu, 11 Feb 2021 08:36:23 +0000 (09:36 +0100)]
Fortran: intrinsic.texi add missing arg to FINDLOC
gcc/fortran/ChangeLog:
* intrinsic.texi (FINDLOC): Add 'MASK' to argument table.
(MAXLOC, MAXVAL, MINLOC, MINVAL): For 'MASK', remove 'an
array' as scalars are also permitted.
Alexandre Oliva [Thu, 11 Feb 2021 05:08:06 +0000 (02:08 -0300)]
use -mfpu=auto for arm/simd/vmmla_1.c
On some of our arm targets, we get various -mfpu flags implicitly or
explicitly passed to the compiler during test runs. The target
options pushed in arm_neon.h that affect vmmlaq_s32 set isa_bit_neon,
but the caller doesn't have that bit set, so arm_can_inline_p rejects
the attempt to inline it, and the test fails.
An explicit -mfpu=neon would address the compile problem, but cause
the assembler to reject the generated code.
So this patch adds -mfpu=auto to the test, overriding any implicit
flags with the fpu implied by the arch.
for gcc/testsuite/ChangeLog
* gcc.target/arm/simd/vmmla_1.c: Pass -mfpu=auto.
Jerry DeLisle [Thu, 11 Feb 2021 03:37:52 +0000 (19:37 -0800)]
libgfortran: Fix unwanted end-of-record by checking if seen_dollar.
libgfortran/ChangeLog:
PR libfortran/98825
* io/transfer.c (next_record_w): Insert check for seen_dollar and if
so, skip issueing next record.
gcc/testsuite/ChangeLog:
PR libfortran/98825
* gfortran.dg/dollar_edit_descriptor_4.f: New test.
Marek Polacek [Wed, 10 Feb 2021 17:07:10 +0000 (12:07 -0500)]
c, c++: Plug -Wduplicated-cond memory leaks [PR99057]
Freeing the condition chain needs to use vec_free which does ->release,
or we leak memory.
gcc/c/ChangeLog:
* c-parser.c (c_parser_if_statement): Use vec_free.
gcc/cp/ChangeLog:
* parser.c (cp_parser_selection_statement): Use vec_free.
GCC Administrator [Thu, 11 Feb 2021 00:16:33 +0000 (00:16 +0000)]
Daily bump.
Martin Sebor [Wed, 10 Feb 2021 21:42:22 +0000 (14:42 -0700)]
Add test for PR tree-optimization/92879.
gcc/testsuite/ChangeLog:
PR tree-optimization/92879
* g++.dg/warn/Warray-bounds-16.C: New test.
David Malcolm [Wed, 10 Feb 2021 19:33:10 +0000 (14:33 -0500)]
libcpp: fix ICE comparing macro locations without column info [PR96391]
PR preprocessor/96391 describes an ICE in the C++ frontend on:
#define CONST const
#define VOID void
typedef CONST VOID *PCVOID;
where the typedef line occurs after enough code has been compiled
that location_t values are beyond LINE_MAP_MAX_LOCATION_WITH_COLS,
and hence no column numbers are available.
The issue occurs in linemap_compare_locations when comparing the
locations of the "const" and "void" tokens.
Upon resolving the LRK_MACRO_EXPANSION_POINT, both have the same
location_t, the line of the "typedef" (with no column), and so
the l0 == l1 clause is triggered, but they are not from the
same macro expansion, leading first_map_in_common to return NULL
and triggering the "abort" condition.
This patch fixes the issue by checking when the two macro expansion
point location_t values are equal that the value
<= LINE_MAP_MAX_LOCATION_WITH_COLS and thus has column information,
fixing the issue.
gcc/testsuite/ChangeLog:
PR preprocessor/96391
* g++.dg/plugin/location-overflow-test-pr96391.c: New test.
* g++.dg/plugin/plugin.exp (plugin_test_list): Add it,
using the location_overflow_plugin.c from gcc.dg/plugin.
libcpp/ChangeLog:
PR preprocessor/96391
* line-map.c (linemap_compare_locations): Require that
the location be <= LINE_MAP_MAX_LOCATION_WITH_COLS when
treating locations as coming from the same macro expansion.
Jakub Jelinek [Wed, 10 Feb 2021 18:52:37 +0000 (19:52 +0100)]
varasm: Fix ICE with -fsyntax-only [PR99035]
My FE change from 2 years ago uses TREE_ASM_WRITTEN in -fsyntax-only
mode more aggressively to avoid "expanding" functions multiple times.
With -fsyntax-only nothing is really expanded, so I think it is acceptable
to adjust the assert and allow declare_weak at any time, with -fsyntax-only
we know it is during parsing only anyway.
2021-02-10 Jakub Jelinek <jakub@redhat.com>
PR c++/99035
* varasm.c (declare_weak): For -fsyntax-only, allow even
TREE_ASM_WRITTEN function decls.
* g++.dg/ext/weak6.C: New test.
Jakub Jelinek [Wed, 10 Feb 2021 18:50:11 +0000 (19:50 +0100)]
i386: Fix ICEs due to simplify_gen_subreg returning NULL [PR99025]
In these patterns, we call simplify_gen_subreg on the input operand
to create paradoxical subregs that have 2x, 4x or 8x elements as the input
operand. That works fine if the input operand is a REG, but when it is a
SUBREG, RTL doesn't allow SUBREG of SUBREG and so relies on simplify_subreg
actually simplifying it. And e.g. if the input operand is a SUBREG that
changes the element mode (floating vs. non-floating) and then combined with
a paradoxical subreg (i.e. different size) this can easily fail, then
simplify_gen_subreg returns NULL but we still use it in instructions.
Fixed by forcing the operands into REG.
2021-02-10 Jakub Jelinek <jakub@redhat.com>
PR target/99025
* config/i386/sse.md (fix<fixunssuffix>_truncv2sfv2di2,
<insn>v8qiv8hi2, <insn>v8qiv8si2, <insn>v4qiv4si2, <insn>v4hiv4si2,
<insn>v8qiv8di2, <insn>v4qiv4di2, <insn>v2qiv2di2, <insn>v4hiv4di2,
<insn>v2hiv2di2, <insn>v2siv2di2): Force operands[1] into REG before
calling simplify_gen_subreg on it.
* gcc.target/i386/pr99025.c: New test.
Jakub Jelinek [Wed, 10 Feb 2021 18:31:15 +0000 (19:31 +0100)]
c++: Consider addresses of heap artificial vars always non-NULL [PR98988, PR99031]
With -fno-delete-null-pointer-checks which is e.g. implied by
-fsanitize=undefined or default on some embedded targets, the middle-end
folder doesn't consider addresses of global VAR_DECLs to be non-NULL, as one
of them could have address 0. Still, I think malloc/operator new (at least
the nonthrowing) relies on NULL returns meaning allocation failure rather
than success. Furthermore, the artificial VAR_DECLs we create for
constexpr new never actually live in the address space of the program,
so we can pretend they will never be NULL too.
> I'm surprised that nonzero_address has such a limited set of things it will
> actually believe have non-zero addresses with
> -fno-delete-null-pointer-checks. But it seems that we should be able to
> arrange to satisfy
>
> > if (definition && !DECL_EXTERNAL (decl)
>
> since these "variables" are indeed defined within the current translation
> unit.
Doing that seems to work and as added benefit it fixes another PR that has
been filed recently. I need to create the varpool node explicitly and call
a method that sets the definition member in there, but I can also unregister
those varpool nodes at the end of constexpr processing, as the processing
ensured they don't leak outside of the processing.
2021-02-10 Jakub Jelinek <jakub@redhat.com>
PR c++/98988
PR c++/99031
* constexpr.c: Include cgraph.h.
(cxx_eval_call_expression): Call varpool_node::finalize_decl on
heap artificial vars.
(cxx_eval_outermost_constant_expr): Remove varpool nodes for
heap artificial vars.
* g++.dg/cpp2a/constexpr-new16.C: New test.
* g++.dg/cpp2a/constexpr-new17.C: New test.
Martin Liska [Wed, 10 Feb 2021 13:15:41 +0000 (14:15 +0100)]
nvptx: properly use flag_patchable_function_entry
gcc/ChangeLog:
* config/nvptx/nvptx.c (nvptx_option_override): Use
flag_patchable_function_entry instead of the removed
function_entry_patch_area_size.
Jonathan Wakely [Wed, 10 Feb 2021 16:51:34 +0000 (16:51 +0000)]
libstdc++: Re-enable workaround for _wstat64 bug [PR 88881]
This wasn't fixed upstream for mingw-w64 so we still need the
workaround.
libstdc++-v3/ChangeLog:
PR libstdc++/88881
* src/c++17/fs_ops.cc (fs::status): Re-enable workaround.
Jonathan Wakely [Wed, 10 Feb 2021 16:45:38 +0000 (16:45 +0000)]
libstdc++: Use correct error category for Windows error codes
When the result of GetLastError() is stored in a std::error_code it
should use std::system_category(), not std::generic_category() that is
used for POSIX errno values.
libstdc++-v3/ChangeLog:
* src/c++17/fs_ops.cc (fs::create_hard_link, fs::equivalent)
(fs::remove): Use std::system_category() for error codes from
GetLastError().
* src/filesystem/ops.cc (fs::create_hard_link, fs::remove):
Likewise.
Jonathan Wakely [Wed, 10 Feb 2021 16:37:39 +0000 (16:37 +0000)]
libstdc++: Fix spelling of __MINGW32__ macros
libstdc++-v3/ChangeLog:
* testsuite/27_io/filesystem/operations/proximate.cc: Fix typo
in __MINGW32__ macro name.
* testsuite/27_io/filesystem/path/compare/lwg2936.cc: Likewise.
* testsuite/27_io/filesystem/path/generation/proximate.cc:
Likewise.
* testsuite/27_io/filesystem/path/generation/relative.cc:
Likewise.
* testsuite/util/testsuite_fs.h: Likewise.
Richard Biener [Wed, 10 Feb 2021 10:28:30 +0000 (11:28 +0100)]
fix memory leak in optimize pragma parsing
The optimize pragma/attribute parsing calls decode_cmdline_options_to_array
but doesn't free the array. The following fixes that.
2021-02-10 Richard Biener <rguenther@suse.de>
gcc/c-family/
* c-common.c (parse_optimize_options): Free decoded_options.
Nathan Sidwell [Wed, 10 Feb 2021 13:29:39 +0000 (05:29 -0800)]
c++: generic lambdas and local-externs from outer scopes [PR 99030]
Lambdas can refer to local externs from their enclosing scope. When
the lambda's generic but the containing function is not a temploid,
we'll never have tsubsted the declaring decl so won't have a local
specialization. But in that case we can just use the decl we
tsubsting directly -- it's not dependent.
PR c++/99030
gcc/cp
* pt.c (tsubst_copy) [VAR_DECL]: For a DECL_LOCAL_DECL_P T is the
answer if there's no local specialization.
gcc/testsuite/
* g++.dg/lookup/pr99030.C: New.
Martin Liska [Wed, 10 Feb 2021 08:39:54 +0000 (09:39 +0100)]
if-to-switch: fix memory leak in case merging
gcc/ChangeLog:
PR tree-optimization/99002
PR tree-optimization/99026
* gimple-if-to-switch.cc (if_chain::is_beneficial): Fix memory
leak when adjacent cases are merged.
* tree-switch-conversion.c (switch_decision_tree::analyze_switch_statement): Use
release_clusters.
(make_pass_lower_switch): Remove trailing whitespace.
* tree-switch-conversion.h (release_clusters): New.
Richard Biener [Wed, 10 Feb 2021 09:17:15 +0000 (10:17 +0100)]
rtl-optimization/99054 - fix leak in fixup_partitions
This fixes a leak of the vector retured by find_partition_fixes
by turning it into an auto_vec.
2021-02-10 Richard Biener <rguenther@suse.de>
PR rtl-optimization/99054
* cfgrtl.c (rtl-optimization/99054): Return an auto_vec.
(fixup_partitions): Adjust.
(rtl_verify_edges): Likewise.
Jakub Jelinek [Wed, 10 Feb 2021 09:34:58 +0000 (10:34 +0100)]
openmp: Temporarily disable into_ssa when gimplifying OpenMP reduction clauses [PR99007]
gimplify_scan_omp_clauses was already calling gimplify_expr with false as
last argument to make sure it is not an SSA_NAME, but as the testcases show,
that is not enough, SSA_NAME temporaries created during that gimplification
can be reused too and we can't allow SSA_NAMEs to be used across OpenMP
region boundaries, as we can only firstprivatize decls.
Fixed by temporarily disabling into_ssa.
2021-02-10 Jakub Jelinek <jakub@redhat.com>
PR middle-end/99007
* gimplify.c (gimplify_scan_omp_clauses): For MEM_REF on reductions,
temporarily disable gimplify_ctxp->into_ssa around gimplify_expr
calls.
* g++.dg/gomp/pr99007.C: New test.
* gcc.dg/gomp/pr99007-1.c: New test.
* gcc.dg/gomp/pr99007-2.c: New test.
* gcc.dg/gomp/pr99007-3.c: New test.
Richard Biener [Wed, 10 Feb 2021 08:13:01 +0000 (09:13 +0100)]
ipa/99029 - fix memory leak in propagate_malloc
This makes sure to release the vec<> of callees.
2021-02-10 Richard Biener <rguenther@suse.de>
PR ipa/99029
* ipa-pure-const.c (propagate_malloc): Use an auto_vec<>
for callees.
Richard Biener [Wed, 10 Feb 2021 08:06:26 +0000 (09:06 +0100)]
tree-optimization/99024 - fix leak in loop vect analysis
When we analyzed a loop as epilogue but later in peeling decide
we're not going to use it then in the DTOR we clear the original
loops ->aux which causes us to leak the main loop vinfo.
Fixed by only clearing aux if it is associated with the vinfo
we're destroying.
2021-02-10 Richard Biener <rguenther@suse.de>
PR tree-optimization/99024
* tree-vect-loop.c (_loop_vec_info::~_loop_vec_info): Only
clear loop->aux if it is associated with the destroyed loop_vinfo.
Martin Liska [Tue, 9 Feb 2021 08:50:04 +0000 (09:50 +0100)]
if-to-switch: fix a memory leak
gcc/ChangeLog:
PR tree-optimization/99002
* gimple-if-to-switch.cc (find_conditions): Fix memory leak
in the function.
Martin Liska [Tue, 9 Feb 2021 08:57:04 +0000 (09:57 +0100)]
ICF: fix memory leak
gcc/ChangeLog:
PR ipa/99003
* ipa-icf.c (sem_item::add_reference): Fix memory leak when
a reference exists.
Jakub Jelinek [Wed, 10 Feb 2021 06:54:30 +0000 (07:54 +0100)]
dwarf2out: Don't prune static data members initialized with constants with -gdwarf-5 [PR98755]
In DWARF4 and earlier, static data members were represented as DW_TAG_member and the
pruning code wouldn't prune those, but in DWARF5 they are represented as DW_TAG_variable
with the class parent and the pruning code prunes those by default unless they are
referenced from a separate definition without the class parent (out of class definition).
C++17 inline vars have the definitions in the class though and even before if the static
data member isn't ODR used, it doesn't need to be defined, so we could just never describe
those static data members in the debug info.
This change stops the pruning of DW_TAG_variable with DW_AT_const_value attribute
with a class parent for -gdwarf-5 and later.
This fixes
-FAIL: g++.dg/debug/dwarf2/constexpr-var-1.C scan-assembler-times DW_AT_const_expr 2
-FAIL: libstdc++-prettyprinters/80276.cc whatis p4
-FAIL: libstdc++-prettyprinters/80276.cc whatis p4
-FAIL: libstdc++-prettyprinters/libfundts.cc print as
-FAIL: libstdc++-prettyprinters/libfundts.cc print as
-FAIL: libstdc++-prettyprinters/libfundts.cc print os
-FAIL: libstdc++-prettyprinters/libfundts.cc print os
2021-02-10 Jakub Jelinek <jakub@redhat.com>
PR debug/98755
* dwarf2out.c (prune_unused_types_walk): Mark DW_TAG_variable DIEs
at class scope for DWARF5+.
Julian Brown [Tue, 9 Feb 2021 20:00:14 +0000 (12:00 -0800)]
openacc: Add XFAILs [PR98979]
This patch adds some XFAILs for PR98979 until the patch to fix them has
been approved. See:
https://gcc.gnu.org/pipermail/gcc-patches/2021-February/564711.html
gcc/testsuite/
PR fortran/98979
* gfortran.dg/goacc/array-with-dt-2.f90: Add expected errors.
* gfortran.dg/goacc/derived-chartypes-1.f90: Skip ICEing test.
* gfortran.dg/goacc/derived-chartypes-2.f90: Likewise.
libgomp/
PR fortran/98979
* testsuite/libgomp.oacc-fortran/array-stride-dt-1.f90: Add expected
errors.
Julian Brown [Tue, 9 Feb 2021 22:09:00 +0000 (14:09 -0800)]
Revert "openacc: Allow strided arrays in update directives"
This patch reverts the non-testsuite parts of commit
9a4d32f85ccebc0ee4b24e6d9d7a4f11c04d7146 which cause ICEs without the
yet-to-be-approved patch here:
https://gcc.gnu.org/pipermail/gcc-patches/2021-February/564711.html
gcc/fortran/
PR fortran/98979
* openmp.c (resolve_omp_clauses): Omit OpenACC update in
contiguity check and stride-specified error.
GCC Administrator [Wed, 10 Feb 2021 00:16:39 +0000 (00:16 +0000)]
Daily bump.
François Dumont [Mon, 30 Nov 2020 19:57:16 +0000 (20:57 +0100)]
libstdc++: Add unordered containers heterogeneous lookup
Add unordered containers heterogeneous lookup member functions find, count, contains and
equal_range in C++20. Those members are considered for overload resolution only if hash and
equal functors used to instantiate the container have a nested is_transparent type.
libstdc++-v3/ChangeLog:
* include/bits/stl_tree.h
(__has_is_transparent, __has_is_transparent_t): Move...
* include/bits/stl_function.h: ...here.
* include/bits/hashtable_policy.h (_Hash_code_base<>::_M_hash_code_tr): New..
(_Hashtable_base<>::_M_equals_tr): New.
* include/bits/hashtable.h (_Hashtable<>::_M_find_tr, _Hashtable<>::_M_count_tr,
_Hashtable<>::_M_equal_range_tr): New member function templates to perform
heterogeneous lookup.
(_Hashtable<>::_M_find_before_node_tr): New.
(_Hashtable<>::_M_find_node_tr): New.
* include/bits/unordered_map.h (unordered_map::find<>, unordered_map::count<>,
unordered_map::contains<>, unordered_map::equal_range<>): New member function
templates to perform heterogeneous lookup.
(unordered_multimap::find<>, unordered_multimap::count<>,
unordered_multimap::contains<>, unordered_multimap::equal_range<>): Likewise.
* include/bits/unordered_set.h (unordered_set::find<>, unordered_set::count<>,
unordered_set::contains<>, unordered_set::equal_range<>): Likewise.
(unordered_multiset::find<>, unordered_multiset::count<>,
unordered_multiset::contains<>, unordered_multiset::equal_range<>): Likewise.
* include/debug/unordered_map
(unordered_map::find<>, unordered_map::equal_range<>): Likewise.
(unordered_multimap::find<>, unordered_multimap::equal_range<>): Likewise.
* include/debug/unordered_set
(unordered_set::find<>, unordered_set::equal_range<>): Likewise.
(unordered_multiset::find<>, unordered_multiset::equal_range<>): Likewise.
* testsuite/23_containers/unordered_map/operations/1.cc: New test.
* testsuite/23_containers/unordered_multimap/operations/1.cc: New test.
* testsuite/23_containers/unordered_multiset/operations/1.cc: New test.
* testsuite/23_containers/unordered_set/operations/1.cc: New test.
François Dumont [Thu, 4 Feb 2021 05:45:18 +0000 (06:45 +0100)]
libstdc++: Remove execution branch in deque iterator operator-
libstdc++-v3/ChangeLog:
* include/bits/stl_deque.h
(std::operator-(deque::iterator, deque::iterator)): Replace if/then with
a null pointer test.
David Malcolm [Tue, 9 Feb 2021 20:54:14 +0000 (15:54 -0500)]
analyzer: support "_IO_"-prefixed variants of FILE * fns [PR98575]
PR analyzer/98575 describes an unexpected -Wanalyzer-malloc-leak false
positive from gcc.dg/analyzer/pr94851-1.c on glibc < 2.28.
The issue is that a getchar call gets inlined into a call to _IO_getc,
and "_IO_getc" is not in the set of FILE * functions the analyzer
"knows about". This exposes a bug in memory leak detection on code
paths in which an unknown function has been called.
The memory leak bug is fixed in the prior commit, but for good
measure this patch special-cases the "_IO_"-prefixed names in glibc
so that the analyzer can reuse its knowledge about the unprefixed
variants.
gcc/analyzer/ChangeLog:
PR analyzer/98575
* sm-file.cc (is_file_using_fn_p): Support "_IO_"-prefixed
variants.
gcc/testsuite/ChangeLog:
PR analyzer/98575
* gcc.dg/analyzer/file-1.c (test_5): New.
* gcc.dg/analyzer/file-3.c: New test.
David Malcolm [Tue, 9 Feb 2021 20:53:01 +0000 (15:53 -0500)]
analyzer: treat pointers written to *UNKNOWN as escaping [PR98575]
PR analyzer/98575 describes an unexpected -Wanalyzer-malloc-leak false
positive from gcc.dg/analyzer/pr94851-1.c on glibc < 2.28.
The issue is that a getchar call gets inlined into a call to _IO_getc,
and "_IO_getc" is not in the set of FILE * functions the analyzer
"knows about". This leads to a global pointer
struct buf *curbp;
being treated as UNKNOWN after the call to _IO_getc. Later when a
malloced pointer is written to curbp->b_amark, the write is discarded
(since curbp is unknown) without noting that the pointer has escaped,
and so the pointer is erroneously treated as leaking when the function
returns.
This patch updates the handling of *UNKNOWN to treat pointers written
to them as having escaped, fixing the false positive.
The patch stops the leak warning in gcc.dg/analyzer/explode-1.c.
After merging states at the join-point after the first switch, pp has
UNKNOWN value, and so *pp is a write through UNKNOWN, which with this
patch is now treated as escaping - despite the fact that all possible
values for *pp are on the stack. There doesn't seem to be a good way
to fix this, and the testcase is an artifically constructed one, so the
patch simply removes the dg-warning directive.
gcc/analyzer/ChangeLog:
PR analyzer/98575
* store.cc (store::set_value): Treat a pointer written to *UNKNOWN
as having escaped.
gcc/testsuite/ChangeLog:
PR analyzer/98575
* gcc.dg/analyzer/explode-1.c: Remove expected leak warning.
* gcc.dg/analyzer/pr94851-2.c: New test.
* gcc.dg/analyzer/pr98575-1.c: New test.
Eric Botcazou [Tue, 9 Feb 2021 18:49:18 +0000 (19:49 +0100)]
Fix miscompilation of Python on HP-PA/Linux
This is the miscompilation of Python at -O2 on HP-PA/Linux present
on the mainline and 10 branch, caused by the presence of a call to
__builtin_unreachable () in the middle of a heavily branchy code,
which confuses the reorg pass.
gcc/
PR rtl-optimization/96015
* reorg.c (skip_consecutive_labels): Minor comment tweaks.
(relax_delay_slots): When deleting a jump to the next active
instruction over a barrier, first delete the barrier if the
jump is the only way to reach the target label.
Andre Vieira [Tue, 9 Feb 2021 18:09:19 +0000 (18:09 +0000)]
aarch64: fix vector multiplication costs
This patch introduces a vect.mul RTX cost and decouples the vector
multiplication costing from the scalar one.
gcc/ChangeLog:
2021-02-09 Andre Vieira <andre.simoesdiasvieira@arm.com>
* config/aarch64/aarch64-cost-tables.h: Add entries for vect.mul.
* config/aarch64/aarch64.c (aarch64_rtx_mult_cost): Use vect.mul for
vector multiplies and vect.alu for SSRA.
* config/arm/aarch-common-protos.h (struct vector_cost_table): Define
vect.mul cost field.
* config/arm/aarch-cost-tables.h: Add entries for vect.mul.
* config/arm/arm.c: Likewise.
gcc/testsuite/ChangeLog:
2021-02-09 Andre Vieira <andre.simoesdiasvieira@arm.com>
* gcc.target/aarch64/asimd-mul-to-shl-sub.c: New test.
Jonathan Wright [Tue, 9 Feb 2021 15:35:16 +0000 (15:35 +0000)]
testsuite: aarch64: Add tests for vpaddq intrinsics
Add tests for vpaddq_* Neon intrinsics. Since these intrinsics are
only supported for AArch64, these tests are restricted to only run on
AArch64 targets.
gcc/testsuite/ChangeLog:
2021-02-09 Jonathan Wright <jonathan.wright@arm.com>
* gcc.target/aarch64/advsimd-intrinsics/vpXXXq.inc:
New test template.
* gcc.target/aarch64/advsimd-intrinsics/vpaddq.c: New test.
Jonathan Wakely [Tue, 9 Feb 2021 16:53:56 +0000 (16:53 +0000)]
libstdc++: Clear up directories created by tests
libstdc++-v3/ChangeLog:
* testsuite/27_io/filesystem/operations/remove_all.cc: Remove
test directory after making it writable again.
* testsuite/experimental/filesystem/operations/remove_all.cc:
Likewise.
Nathan Sidwell [Tue, 9 Feb 2021 16:11:58 +0000 (08:11 -0800)]
c++: Fix indirect partitions [PR 98944]
The most recent reimplementation of module loading initialization
changed the behaviour of setting an import's location, and broke some
partition handling.
PR c++/98944
gcc/cp/
* module.cc (module_state::is_rooted): Rename to ...
(module_state::has_location): ... here. Adjust callers.
(module_state::read_partitions): Adjust validity check.
Don't overwrite a known location.
gcc/testsuite/
* g++.dg/modules/pr98944_a.C: New.
* g++.dg/modules/pr98944_b.C: New.
* g++.dg/modules/pr98944_c.C: New.
* g++.dg/modules/pr98944_d.C: New.
Jonathan Wakely [Tue, 9 Feb 2021 11:23:29 +0000 (11:23 +0000)]
libstdc++: Make coroutine_handle<_Promise>::from_address() noexcept [PR 99021]
The coroutine_handle<void>::from_address(void*) version is already
noexcept, and they do the same thing. Make them consistent.
libstdc++-v3/ChangeLog:
PR libstdc++/99021
* include/std/coroutine (coroutine_handle<P>::from_address): Add
noexcept.
Vladimir Vishnevsky [Tue, 9 Feb 2021 10:25:38 +0000 (10:25 +0000)]
libstdc++: Fix build failure for targets without unistd.h
The patch fixes build issues occurring if build parameter
"--enable-cstdio=stdio_pure" is specified and no unistd.h is
present in the environment.
libstdc++-v3/ChangeLog:
* include/ext/stdio_sync_filebuf.h: Remove unused <unistd.h>.
* src/c++17/fs_ops.cc (fs::permissions): Qualify mode_t.
Richard Biener [Tue, 9 Feb 2021 10:59:06 +0000 (11:59 +0100)]
Fix O(region-size) unwind in VN
This fixes the currently O(region-size) unwinding of avail info
to be O(unwind-size) by tracking a linked-list stack of pushed
avails. This reduces the compile-time spent in complete unrolling
for WRF.
2021-02-09 Richard Biener <rguenther@suse.de>
PR tree-optimization/98863
* tree-ssa-sccvn.h (vn_avail::next_undo): Add.
* tree-ssa-sccvn.c (last_pushed_avail): New global.
(rpo_elim::eliminate_push_avail): Chain pushed avails.
(unwind_state::avail_top): Add.
(do_unwind): Rewrite unwinding of avail entries.
(do_rpo_vn): Initialize last_pushed_avail and
avail_top of the undo state.
Jakub Jelinek [Tue, 9 Feb 2021 11:32:43 +0000 (12:32 +0100)]
string: Add a workaround for -Wstringop-overread false positives [PR98465]
In the PR there are several possibilities how to improve _M_disjunct at
least in certain cases so that the compiler can figure out at least in some
cases where __s is provably disjunct from _M_data() ... _M_data() + this->size()
but it is probably GCC 12 material.
The false positive warning is on this particular copy, which is done for
non-disjunct pointers when __len2 > __len1 and the __s >= __p + __len1,
i.e. __s used to point to the characters moved through _S_move a few lines earlier
by __len2 - __len1 characters up to make space. That is why the
_S_copy source is __s + __len2 - __len1. Unfortunately, when the compiler
can't prove objects are disjunct, that copying from __s + __len2 - __len1
of __len2 characters can very well mean accessing characters the source
object (if it is not disjunct) provably can't have.
The following patch works around that by making the _S_copy be a __p based
pointer instead of __s based pointer.
__s + __len2 - __len1
and
__p + (__s - __p) + (__len2 - __len1)
have the same value and the latter may seem to be uselessly longer,
but it seems at least currently in GIMPLE we keep it that way and so that is
what the warning code during expansion will see, and only actually
optimize it to __s + __len2 - __len1 during RTL when we lose information
on what is a pointer and what is a mere offset with the same mode.
So, in the end we emit exactly the same assembly, just without the false
positive warning.
2021-02-09 Jakub Jelinek <jakub@redhat.com>
PR middle-end/98465
* include/bits/basic_string.tcc (basic_string::_M_replace): When __s
points to the characters moved by earlier _S_move, compute the source
address using expression based on the __p pointer rather than __s
pointer.
* g++.dg/warn/Wstringop-overread-1.C: New test.
Jakub Jelinek [Tue, 9 Feb 2021 11:29:32 +0000 (12:29 +0100)]
calls: Fix a memory leak in maybe_warn_rdwr_sizes [PR99004]
The print_generic_expr_to_str function ends with
return xstrdup (...); and therefore expects the caller to free
the argument.
The following patch does that after it has been copied.
Instead of doing const_cast to cast away const char * to char *,
because the code uses s0 and s1 in so few places, I chose just
to change the types of the two variables so that const_cast
is not needed. After all, it is a heap allocated string that
this function owns and so if it wanted, it could change it too.
2021-02-09 Jakub Jelinek <jakub@redhat.com>
PR middle-end/99004
* calls.c (maybe_warn_rdwr_sizes): Change s0 and s1 type from
const char * to char * and free those pointers after use.
Richard Biener [Tue, 9 Feb 2021 09:11:35 +0000 (10:11 +0100)]
tree-optimization/99017 - be more forgiving in BB vect costing
This works around a SLP graph partitioning or cost collecting issue
by being more forgiving in vect_bb_vectorization_profitable_p.
2021-02-09 Richard Biener <rguenther@suse.de>
PR tree-optimization/99017
* tree-vect-slp.c (vect_bb_vectorization_profitable_p): Allow
zero vector cost entries.
Jason Merrill [Mon, 8 Feb 2021 22:16:14 +0000 (17:16 -0500)]
c++: consteval and explicit instantiation [PR96905]
Normally, an explicit instantiation means we want to write out the
instantiation. But not for a consteval function.
gcc/cp/ChangeLog:
PR c++/96905
* pt.c (mark_decl_instantiated): Exit early if consteval.
gcc/testsuite/ChangeLog:
PR c++/96905
* g++.dg/cpp2a/consteval-expinst1.C: New test.
Jason Merrill [Mon, 8 Feb 2021 22:04:03 +0000 (17:04 -0500)]
c++: generic lambda, fn* conv, empty class [PR98326]
Here, in the thunk returned from the captureless lambda conversion to
pointer-to-function, we try to pass through invisible reference parameters
by reference, without doing a copy. The empty class copy optimization was
messing that up.
gcc/cp/ChangeLog:
PR c++/98326
PR c++/20408
* cp-gimplify.c (simple_empty_class_p): Don't touch an invisiref
parm.
gcc/testsuite/ChangeLog:
PR c++/98326
* g++.dg/cpp1y/lambda-generic-empty1.C: New test.
Jason Merrill [Mon, 8 Feb 2021 20:56:11 +0000 (15:56 -0500)]
c++: constexpr, union, and no_unique_address [PR98994]
My second patch for 97566 omits nested CONSTRUCTORs for empty fields, but we
do want them for empty union members.
gcc/cp/ChangeLog:
PR c++/98994
PR c++/97566
* constexpr.c (cxx_eval_store_expression): Only skip empty fields in
RECORD_TYPE.
gcc/testsuite/ChangeLog:
PR c++/98994
* g++.dg/cpp2a/no_unique_address12.C: New test.
GCC Administrator [Tue, 9 Feb 2021 00:16:30 +0000 (00:16 +0000)]
Daily bump.
Nathan Sidwell [Wed, 3 Feb 2021 12:44:41 +0000 (04:44 -0800)]
c++: cleanup function name [PR 98531]
The next piece of 98531 is that in some cases we need to create a
cleanup function to do the work (when the object is an array, or we're
using regular atexit). We were not pushing that function's decl
anywhere (not giving it a context) so streaming it failed.
This is a partial fix. You'll notice we're naming these from a per-TU
counter. I've captured that in PR98893.
gcc/cp/
* decl.c (start_cleanup_fn): Push function into
namespace.
gcc/testsuite/
* g++.dg/modules/pr98531-2.h: New.
* g++.dg/modules/pr98531-2_a.H: New.
* g++.dg/modules/pr98531-2_b.C: New.
* g++.dg/modules/pr98531-3.h: New.
* g++.dg/modules/pr98531-3_a.H: New.
* g++.dg/modules/pr98531-3_b.C: New.
Nathan Sidwell [Fri, 22 Jan 2021 16:48:27 +0000 (08:48 -0800)]
c++: cross-module __cxa_atexit use [PR 98531]
The compiler's use of lazily-declared library functions must insert
said functions into a symbol table, so that they can be correctly
merged across TUs at the module-level. We have too many different
ways of declaring such library functions. This fixes __cxa_atexit (or
its system-specific variations), pushing (or merging) the decl into
the appropriate namespace. Because we're pushing a lazy builtin,
check_redeclaration_exception_specification needed a tweak to allow a
such a builtin's eh spec to differ from what the user may have already
declared. (I suspect no all headers declare atexit as noexcept.)
We can't test the -fno-use-cxa-atexit path with modules, as that
requires a followup patch to a closely related piece (which also
affects cxa_atexit targets in other circumstances).
PR c++/98531
gcc/cp/
* cp-tree.h (push_abi_namespace, pop_abi_namespace): Declare.
* decl.c (push_abi_namespace, pop_abi_namespace): Moved
from rtti.c, add default namespace arg.
(check_redeclaration_exception_specification): Allow a lazy
builtin's eh spec to differ from an lready-declared user
declaration.
(declare_global_var): Use push/pop_abi_namespace.
(get_atexit_node): Push the fndecl into a namespace.
* rtti.c (push_abi_namespace, pop_abi_namespace): Moved to
decl.c.
gcc/testsuite/
* g++.dg/modules/pr98531-1.h: New.
* g++.dg/modules/pr98531-1_a.H: New.
* g++.dg/modules/pr98531-1_b.C: New.
* g++.dg/abi/pr98531-1.C: New.
* g++.dg/abi/pr98531-2.C: New.
* g++.dg/abi/pr98531-3.C: New.
* g++.dg/abi/pr98531-4.C: New.
Mike Frysinger [Sun, 7 Feb 2021 20:17:47 +0000 (15:17 -0500)]
mklog: automatically fill in generated entries
contrib/ChangeLog:
* mklog.py (generated_files): New set.
(generate_changelog): Add entries based on generated_files.
Marek Polacek [Mon, 8 Feb 2021 16:34:54 +0000 (11:34 -0500)]
c++: Fix typo in CLASSTYPE_TI_TEMPLATE comment.
gcc/cp/ChangeLog:
* cp-tree.h (CLASSTYPE_TI_TEMPLATE): Fix typo.
Andre Vieira [Mon, 8 Feb 2021 16:04:18 +0000 (16:04 +0000)]
middle-end/98974 - fixup after STMT_VINFO_VEC_STMTS rework
This fixes up the nvectors parameter passed to vect_get_loop_mask in
vectorizable_condition after the STMT_VINFO_VEC_STMTS rework.
gcc/ChangeLog:
2021-02-08 Andre Vieira <andre.simoesdiasvieira@arm.com>
PR middle-end/98974
* tree-vect-stmts.c (vectorizable_condition): Remove shadow vec_num
parameter in vectorizable_condition.
gcc/testsuite/ChangeLog:
2021-02-08 Andre Vieira <andre.simoesdiasvieira@arm.com>
PR middle-end/98974
* gfortran.dg/pr98974.F90: New test.
Richard Biener [Mon, 8 Feb 2021 08:52:56 +0000 (09:52 +0100)]
lto/96591 - walk VECTOR_CST elements in walk_tree
This implements walking of VECTOR_CST elements in walk_tree, mimicing
the walk of COMPLEX_CST elements. Without this free-lang-data fails
to see some types in case they are only refered to via tree constants
used only as VECTOR_CST elements.
2021-02-08 Richard Biener <rguenther@suse.de>
PR lto/96591
* tree.c (walk_tree_1): Walk VECTOR_CST elements.
* g++.dg/lto/pr96591_0.C: New testcase.
Martin Liska [Fri, 5 Feb 2021 12:11:44 +0000 (13:11 +0100)]
opts: fix handling of -fpatchable-function-entries option
gcc/ChangeLog:
PR lto/98971
* cfgexpand.c (pass_expand::execute): Parse per-function option
flag_patchable_function_entry and use it.
* common.opt: Remove function_entry_patch_area_size and
function_entry_patch_area_start global variables.
* opts.c (parse_and_check_patch_area): New function.
(common_handle_option): Use it.
* opts.h (parse_and_check_patch_area): New function.
* toplev.c (process_options): Parse and use
function_entry_patch_area_size.
Martin Sebor [Mon, 8 Feb 2021 00:21:32 +0000 (17:21 -0700)]
Correct typos in attribute malloc documentation.
gcc/ChangeLog:
* doc/extend.texi (attribute malloc): Correct typos.
GCC Administrator [Mon, 8 Feb 2021 00:16:25 +0000 (00:16 +0000)]
Daily bump.
GCC Administrator [Sun, 7 Feb 2021 00:16:19 +0000 (00:16 +0000)]
Daily bump.
GCC Administrator [Sat, 6 Feb 2021 00:16:39 +0000 (00:16 +0000)]
Daily bump.
Joseph Myers [Fri, 5 Feb 2021 21:40:13 +0000 (21:40 +0000)]
Regenerate .pot files.
gcc/po/
* gcc.pot: Regenerate.
libcpp/po/
* cpplib.pot: Regenerate.
Iain Buclaw [Fri, 5 Feb 2021 11:47:23 +0000 (12:47 +0100)]
d: Remove the expansion of intrinsic and built-in codes from the DEF_D_INTRINSIC macro
Instead, the full name of these codes are explicitly given in
intrinsics.def, to make it clear what these values map to.
gcc/d/ChangeLog:
* d-tree.h (DEF_D_INTRINSIC): Don't insert INTRINSIC_ into the
intrinsic code name.
* intrinsics.cc (DEF_D_INTRINSIC): Don't insert INTRISIC_ and
BUILT_IN_ into the intrinsic and built-in code names.
* intrinsics.def: Explicitly use full intrinsic and built-in
codes in all definitions.
Marek Polacek [Wed, 3 Feb 2021 22:57:22 +0000 (17:57 -0500)]
c++: Fix bogus -Wvolatile warning in C++20 [PR98947]
Since most of volatile is deprecated in C++20, we are required to warn
for compound assignments to volatile variables and so on. But here we
have
volatile int x, y, z;
(b ? x : y) = 1;
and we shouldn't warn, because simple assignments like x = 24; should
not provoke the warning when they are a discarded-value expression.
We warn here because when ?: is used as an lvalue, we transform it in
cp_build_modify_expr/COND_EXPR from (a ? b : c) = rhs to
(a ? (b = rhs) : (c = rhs))
and build_conditional_expr then calls mark_lvalue_use for the new
artificial assignments, which then evokes the warning. The calls
to mark_lvalue_use were added in r160289 to suppress warnings in
Wunused-var-10.c, but looks like they're no longer needed.
To warn on
(b ? (x = 2) : y) = 1;
(b ? x : (y = 5)) = 1;
I've tweaked a check in mark_use/MODIFY_EXPR.
I'd argue this is a regression because GCC 9 doesn't warn.
gcc/cp/ChangeLog:
PR c++/98947
* call.c (build_conditional_expr_1): Don't call mark_lvalue_use
on arg2/arg3.
* expr.c (mark_use) <case MODIFY_EXPR>: Don't check read_p when
issuing the -Wvolatile warning. Only set TREE_THIS_VOLATILE if
a warning was emitted.
gcc/testsuite/ChangeLog:
PR c++/98947
* g++.dg/cpp2a/volatile5.C: New test.
Marek Polacek [Thu, 4 Feb 2021 17:53:59 +0000 (12:53 -0500)]
c++: Fix ICE with invalid using enum [PR96462]
Here we ICE in finish_nonmember_using_decl -> lookup_using_decl ->
... -> find_namespace_slot because "name" is not an IDENTIFIER_NODE.
It is a BIT_NOT_EXPR because this broken test uses
using E::~E; // SCOPE::NAME
A using-decl can't refer to a destructor, and lookup_using_decl already
checks that in the class member case. But in C++17, we do the "enum
scope is the enclosing scope" block, and so scope gets set to ::, and
we go into the NAMESPACE_DECL block. In C++20 we don't do it, we go
to the ENUMERAL_TYPE block.
I resorted to hoisting the check along with a diagnostic tweak: we
don't want to print "::::~E names destructor".
gcc/cp/ChangeLog:
PR c++/96462
* name-lookup.c (lookup_using_decl): Hoist the destructor check.
gcc/testsuite/ChangeLog:
PR c++/96462
* g++.dg/cpp2a/using-enum-8.C: New test.
Nathan Sidwell [Thu, 4 Feb 2021 16:16:17 +0000 (08:16 -0800)]
driver: error for nonexistent linker inputs [PR 98943]
We used to check all unknown input files, even when passing them to a
compiler. But that caused problems. However, not erroring out on
non-existent would-be-linker inputs confuses configure machinery that
probes the compiler to see if it accepts various inputs. This
restores the access check for things that are thought to be linker
input files, when we're not linking. (If we are linking, we presume
the linker will error out on its own accord.)
PR driver/98943
gcc/
* gcc.c (driver::maybe_run_linker): Check for input file
accessibility if not linking.
gcc/testsuite/
* c-c++-common/pr98943.c: New.
Richard Biener [Fri, 5 Feb 2021 08:54:00 +0000 (09:54 +0100)]
tree-optimization/98855 - redo BB vectorization costing
The following attempts to account for the fact that BB vectorization
regions now can span multiple loop levels and that an unprofitable
inner loop vectorization shouldn't be offsetted by a profitable
outer loop vectorization to make it overall profitable.
For now I've implemented a heuristic based on the premise that
vectorization should be profitable even if loops may not be entered
or if they iterate any number of times. Especially the first
assumption then requires that stmts directly belonging to loop A
need to be costed separately from stmts belonging to another loop
which also simplifies the implementation.
On x86 the added testcase has in the outer loop
t.c:38:20: note: Cost model analysis for part in loop 1:
Vector cost: 56
Scalar cost: 192
and the inner loop
t.c:38:20: note: Cost model analysis for part in loop 2:
Vector cost: 132
Scalar cost: 48
and thus the vectorization is considered not profitable
(note the same would happen in case the 2nd cost were for
a loop outer to the 1st costing).
Future enhancements may consider static knowledge of whether
a loop is always entered which would allow some inefficiency
in the vectorization of its loop header. Likewise stmts only
reachable from a loop exit can be treated this way.
2021-02-05 Richard Biener <rguenther@suse.de>
PR tree-optimization/98855
* tree-vectorizer.h (add_stmt_cost): New overload.
* tree-vect-slp.c (li_cost_vec_cmp): New.
(vect_bb_slp_scalar_cost): Cost individual loop regions
separately. Account for the scalar instance root stmt.
* g++.dg/vect/slp-pr98855.cc: New testcase.
Tom de Vries [Fri, 5 Feb 2021 09:36:38 +0000 (10:36 +0100)]
debug: fix switch lowering debug info
gcc/ChangeLog:
PR debug/98656
* tree-switch-conversion.c (jump_table_cluster::emit): Add loc
argument.
(bit_test_cluster::emit): Reuse location_t for newly created
gswitch statement.
(switch_decision_tree::try_switch_expansion): Preserve
location_t.
* tree-switch-conversion.h: Change function signatures.
Jakub Jelinek [Fri, 5 Feb 2021 09:39:03 +0000 (10:39 +0100)]
i386: Fix up TARGET_QIMODE_MATH for many AMD CPU tunings [PR98957]
As written in the PR, TARGET_QIMODE_MATH was meant to be set for all
tunings and it was the case for GCC <= 7, but as the number of
PROCESSOR_* enumerators grew, some AMD tunings (which are at the end
of the list) over time got enumerators with values >= 32 and
TARGET_QIMODE_MATH became disabled for them, in GCC 8 for 2
tunings, in GCC 9 for 7 tunings, in GCC 10 for 8 tunings, and
on the trunk for 11 tunings.
The following patch fixes it by using uhwis rather than uints
and gives them also symbolic names.
2021-02-05 Jakub Jelinek <jakub@redhat.com>
PR target/98957
* config/i386/i386-options.c (m_NONE, m_ALL): Define.
* config/i386/x86-tune.def (X86_TUNE_BRANCH_PREDICTION_HINTS,
X86_TUNE_PROMOTE_QI_REGS): Use m_NONE instead of 0U.
(X86_TUNE_QIMODE_MATH): Use m_ALL instead of ~0U.
Jakub Jelinek [Fri, 5 Feb 2021 09:22:07 +0000 (10:22 +0100)]
c++: Fix ICE with structured binding initialized to incomplete array [PR97878]
We ICE on the following testcase, for incomplete array a on auto [b] { a }; without
giving any kind of diagnostics, with auto [c] = a; during error-recovery.
The problem is that we get too far through check_initializer and e.g.
store_init_value -> constexpr stuff can't deal with incomplete array types.
As the type of the structured binding artificial variable is always deduced,
I think it is easiest to diagnose this early, even if they have array types
we'll need their deduced type to be complete rather than just its element
type.
2021-02-05 Jakub Jelinek <jakub@redhat.com>
PR c++/97878
* decl.c (check_array_initializer): For structured bindings, require
the array type to be complete.
* g++.dg/cpp1z/decomp54.C: New test.
Kyrylo Tkachov [Fri, 5 Feb 2021 09:17:57 +0000 (09:17 +0000)]
aarch64: Reimplement vget_high* intrinsics
Similar to the vget_low* intrinsics we should just use a proper vec_select rather than
going through V2DI subregs.
gcc/ChangeLog:
* config/aarch64/aarch64-simd-builtins.def (get_high): Define builtin.
* config/aarch64/aarch64-simd.md (aarch64_get_high<mode>): Define.
* config/aarch64/arm_neon.h (__GET_HIGH): Delete.
(vget_high_f16): Reimplement using new builtin.
(vget_high_f32): Likewise.
(vget_high_f64): Likewise.
(vget_high_p8): Likewise.
(vget_high_p16): Likewise.
(vget_high_p64): Likewise.
(vget_high_s8): Likewise.
(vget_high_s16): Likewise.
(vget_high_s32): Likewise.
(vget_high_s64): Likewise.
(vget_high_u8): Likewise.
(vget_high_u16): Likewise.
(vget_high_u32): Likewise.
(vget_high_u64): Likewise.
Kyrylo Tkachov [Fri, 5 Feb 2021 08:14:07 +0000 (08:14 +0000)]
aarch64: Reimplement vget_low* intrinsics
We can do better on the vget_low* intrinsics.
Currently they reinterpret their argument into a V2DI vector and extract the low "lane",
reinterpreting that back into the shorter vector.
This is functionally correct and generates a sequence of subregs and a vec_select that, by itself,
gets optimised away eventually.
However it's bad when we want to use the result in a other SIMD operations.
Then the subreg-vec_select-subreg combo blocks many combine patterns.
This patch reimplements them to emit a proper low vec_select from the start.
It generates much cleaner RTL and allows for more aggressive combinations, particularly
with the patterns that Jonathan has been pushing lately.
gcc/ChangeLog:
* config/aarch64/aarch64-simd-builtins.def (get_low): Define builtin.
* config/aarch64/aarch64-simd.md (aarch64_get_low<mode>): Define.
* config/aarch64/arm_neon.h (__GET_LOW): Delete.
(vget_low_f16): Reimplement using new builtin.
(vget_low_f32): Likewise.
(vget_low_f64): Likewise.
(vget_low_p8): Likewise.
(vget_low_p16): Likewise.
(vget_low_p64): Likewise.
(vget_low_s8): Likewise.
(vget_low_s16): Likewise.
(vget_low_s32): Likewise.
(vget_low_s64): Likewise.
(vget_low_u8): Likewise.
(vget_low_u16): Likewise.
(vget_low_u32): Likewise.
(vget_low_u64): Likewise.
Kito Cheng [Thu, 28 Jan 2021 10:29:53 +0000 (18:29 +0800)]
PR target/98878 - Incorrect multilib list for riscv*-rtems
- Multi-lib only check the default argument is appeared in the multilib
flag list, but we didn't check the case that the flag is required but
default argument didn't provide.
- For example riscv*-rtems has a multilib set:
rv32imafd/ilp32d;@march=rv32imafd@mabi=ilp32d
And when we set the default argument of arch to rv32imafdc and ABI to
ilp32d, gcc will check the ilp32d is matched, but it didn't check
rv32imafd is not provided by default arguments, so it should not
reuse default library.
- The side effcet of this patch is csky-elf target will increase the
number of multilib from 54 to 59, but it's because genmultilib didn't
know the default argument for multilib, so I think it could be
improved in future.
gcc/ChangeLog:
* gcc.c (print_multilib_info): Check all required argument is provided
by default arg.
liuhongt [Thu, 7 Jan 2021 02:15:33 +0000 (10:15 +0800)]
Fix ICE: Don't generate integer mask comparision for 128/256-bits vector when op_true/op_false are NULL or constm1_rtx/const0_rtx [PR98537]
avx512vl-pr92686-vpcmp-{1,2,intelasm-1}.c are used to guard code
generation of integer mask comparison, but for vector comparison to
vector dest, integer mask comparison is disliked, so delete these
useless tests.
gcc/ChangeLog:
PR target/98537
* config/i386/i386-expand.c (ix86_expand_sse_cmp): Don't
generate integer mask comparison for 128/256-bits vector when
op_true/op_false is NULL_RTX or CONSTM1_RTX/CONST0_RTX. Also
delete redundant !maskcmp condition.
(ix86_expand_int_vec_cmp): Ditto but no redundant deletion
here.
(ix86_expand_sse_movcc): Delete definition of maskcmp, add the
condition directly to if (maskcmp), add extra check for
cmpmode, it should be MODE_INT.
(ix86_expand_fp_vec_cmp): Pass NULL to ix86_expand_sse_cmp's
parameters op_true/op_false.
(ix86_use_mask_cmp_p): New.
gcc/testsuite/ChangeLog:
PR target/98537
* g++.target/i386/avx512bw-pr98537-1.C: New test.
* g++.target/i386/avx512vl-pr98537-1.C: New test.
* g++.target/i386/avx512vl-pr98537-2.C: New test.
* gcc.target/i386/avx512vl-pr88547-1.c: Adjust testcase,
integer mask comparison should not be generated.
* gcc.target/i386/avx512vl-pr92686-vpcmp-1.c: Remove.
* gcc.target/i386/avx512vl-pr92686-vpcmp-2.c: Ditto.
* gcc.target/i386/avx512vl-pr92686-vpcmp-intelasm-1.c: Ditto.
liuhongt [Thu, 28 Jan 2021 06:07:00 +0000 (14:07 +0800)]
Enable X86_TUNE_AVX256_UNALIGNED_{LOAD,STORE}_OPTIMAL in generic tune.
gcc/ChangeLog:
PR target/98172
* config/i386/x86-tune.def (X86_TUNE_AVX256_UNALIGNED_LOAD_OPTIMAL):
Remove m_GENERIC from ~list.
(X86_TUNE_AVX256_UNALIGNED_STORE_OPTIMAL): Ditto.
GCC Administrator [Fri, 5 Feb 2021 00:16:23 +0000 (00:16 +0000)]
Daily bump.
Julian Brown [Thu, 4 Feb 2021 18:13:22 +0000 (10:13 -0800)]
openacc: Tests for character types in derived-type mappings
This patch adds some tests for character types that are components of
derived types used in OpenACC data-movement clauses.
gcc/testsuite/
* gfortran.dg/goacc/derived-chartypes-1.f90: New test.
* gfortran.dg/goacc/derived-chartypes-2.f90: Likewise.
* gfortran.dg/goacc/derived-chartypes-3.f90: Likewise.
* gfortran.dg/goacc/derived-chartypes-4.f90: Likewise.
Julian Brown [Tue, 2 Feb 2021 11:44:34 +0000 (03:44 -0800)]
openacc: Allow strided arrays in update directives
OpenACC 3.0 ("2.14.4. Update Directive") states:
Noncontiguous subarrays may appear. It is implementation-specific
whether noncontiguous regions are updated by using one transfer for
each contiguous subregion, or whether the non-contiguous data is
packed, transferred once, and unpacked, or whether one or more larger
subarrays (no larger than the smallest contiguous region that contains
the specified subarray) are updated.
This patch relaxes some conditions in the Fortran front-end so that
strided accesses are permitted for update directives.
gcc/fortran/
* openmp.c (resolve_omp_clauses): Omit OpenACC update in
contiguity check and stride-specified error.
gcc/testsuite/
* gfortran.dg/goacc/array-with-dt-2.f90: New test.
libgomp/
* testsuite/libgomp.oacc-fortran/array-stride-dt-1.f90: New test.
Julian Brown [Sat, 30 Jan 2021 01:18:07 +0000 (17:18 -0800)]
openacc: Use class_pointer instead of pointer attribute for class types
Elsewhere in the Fortran front-end, the class_pointer attribute is
used for BT_CLASS entities instead of the pointer attribute. This patch
follows suit for OpenACC. I couldn't actually come up with a test case
where this makes a difference (i.e., where "class_pointer" and "pointer"
have different values at this point in the code), but this may nonetheless
fix a latent bug.
gcc/fortran/
* trans-openmp.c (gfc_trans_omp_clauses): Use class_pointer attribute
for BT_CLASS.
Julian Brown [Fri, 29 Jan 2021 23:37:27 +0000 (15:37 -0800)]
openacc: Dereference BT_CLASS data pointers but not BT_DERIVED pointers
The stanza in gfc_trans_omp_clauses that handles derived type members
that are themselves derived type pointers or class pointers now adds
an explicit dereference only for the latter. The former is already
dereferenced transparently in gfc_conv_component_ref.
gcc/fortran/
* trans-openmp.c (gfc_trans_omp_clauses): Fix dereferencing for
BT_DERIVED members.
gcc/testsuite/
* gfortran.dg/goacc/derived-classtypes-1.f95: New test.
Jakub Jelinek [Thu, 4 Feb 2021 22:42:09 +0000 (23:42 +0100)]
testsuite: Fix up pr25376.c on powerpc64-linux and array-quals-1.c on powerpc-linux [PR98325]
The following patch fixes the pr25376.c testcase on powerpc64-linux
and array-quals-1.c on powerpc-linux.
Previously it failed like:
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?a1\$ (found a1) has section ^\\\\.(const|rodata|srodata)|\\\\[RO\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?b1\$ (found b1) has section ^\\\\.(const|rodata|srodata)|\\\\[RO\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?c1\$ (found c1) has section ^\\\\.(const|rodata|srodata)|\\\\[RO\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?d1\$ (found d1) has section ^\\\\.(const|rodata|srodata)|\\\\[RO\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?p\$ (found p) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?p1\$ (found p1) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?q\$ (found q) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?q1\$ (found q1) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?r\$ (found r) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?r1\$ (found r1) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?s\$ (found s) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?s1\$ (found s1) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?t\$ (found t) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/array-quals-1.c scan-assembler-symbol-section symbol ^_?t1\$ (found t1) has section ^\\\\.(const|rodata|srodata)|\\\\[RW\\\\] (found .sdata)
FAIL: gcc.dg/pr25376.c scan-assembler-symbol-section symbol simple\$ (found .L.simple) has section ^\\\\.?my_named_section|simple\\\\[DS\\\\]|^\\\\"\\\\.opd\\\\" (found .opd)
FAIL: gcc.dg/pr25376.c scan-assembler-symbol-section symbol simple\$ (found simple) has section ^\\\\.?my_named_section|simple\\\\[DS\\\\]|^\\\\"\\\\.opd\\\\" (found .opd)
The problem with pr25376.c testcase are the ELFv1 function descriptors,
.section my_named_section,"ax",@progbits
.align 2
.globl simple
.section ".opd","aw"
.align 3
simple:
.quad .L.simple,.TOC.@tocbase,0
.previous
.type simple, @function
.L.simple:
so the simple symbol is found in the .opd section rather than in the
my_named_section the test attempts to verify for that symbol.
This patch deals it with two changes, the last two hunks in scanasm.exp
teach it about the behavior of .previous directive and the first hunk
for powerpc if symbol is in .opd section will try section in which the
.L.symbol label is instead.
The array-quals-1.c test fails because on powerpc-linux the symbols
are emitted into .sdata section rather than one of the expected ones.
2021-02-04 Jakub Jelinek <jakub@redhat.com>
PR testsuite/98325
* lib/scanasm.exp (dg-scan-symbol-section): For powerpc*-*-* targets if
$section is .opd, look at .L.$symbol_name's section.
(parse_section_section_of_symbols): Handle .previous directive.
* gcc.dg/array-quals-1.c: Allow .sdata section.
Iain Buclaw [Thu, 4 Feb 2021 21:34:22 +0000 (22:34 +0100)]
d: Merge upstream dmd
46133f761, druntime
0fd4364c
D front-end changes:
- Backported built-in function handling from upstream.
- Added new intrinsic `byteswap(ushort)`.
Druntime changes:
- Update intrinsic modules core.bitop, core.checkedint, core.simd,
core.vararg, and core.volatile.
- Backport platform-specific fixes for runtime modules core.cpuid,
core.internal.traits, and rt.lifetime.
- Backport openbsd fixes for core.stdc.stdio.
- Backport solaris fixes for core.sys.posix.locale, and
core.thread.osthread (PR98910).
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd
46133f761.
* d-builtins.cc (d_build_builtins_module): Set builtins as BUILTINgcc.
(maybe_set_builtin_1): Likewise.
* d-frontend.cc (eval_builtin): Adjust condition for early return.
* intrinsics.cc (maybe_set_intrinsic): Set intrinsics as BUILTINgcc.
(maybe_expand_intrinsic): Add case for INTRINSIC_BSWAP16.
* intrinsics.def (INTRINSIC_BT): Update signature.
(INTRINSIC_BT64): Likewise.
(INTRINSIC_BSWAP16): New intrinsic.
(INTRINSIC_VLOAD8): Update module.
(INTRINSIC_VLOAD16): Likewise.
(INTRINSIC_VLOAD32): Likewise.
(INTRINSIC_VLOAD64): Likewise.
(INTRINSIC_VSTORE8): Likewise.
(INTRINSIC_VSTORE16): Likewise.
(INTRINSIC_VSTORE32): Likewise.
(INTRINSIC_VSTORE64): Likewise.
(INTRINSIC_ADDS): Update signature.
(INTRINSIC_ADDSL): Likewise.
(INTRINSIC_ADDU): Likewise.
(INTRINSIC_ADDUL): Likewise.
(INTRINSIC_SUBS): Likewise.
(INTRINSIC_SUBSL): Likewise.
(INTRINSIC_SUBU): Likewise.
(INTRINSIC_SUBUL): Likewise.
(INTRINSIC_MULS): Likewise.
(INTRINSIC_MULSL): Likewise.
(INTRINSIC_MULU): Likewise.
(INTRINSIC_MULUI): Likewise.
(INTRINSIC_MULUL): Likewise.
(INTRINSIC_NEGS): Likewise.
(INTRINSIC_NEGSL): Likewise.
libphobos/ChangeLog:
PR d/98910
* libdruntime/MERGE: Merge upstream druntime
0fd4364c.
* libdruntime/Makefile.am (DRUNTIME_DSOURCES): Add core/volatile.d.
* libdruntime/Makefile.in: Regenerate.
* testsuite/libphobos.allocations/tls_gc_integration.d: Update test.
gcc/testsuite/ChangeLog:
* gdc.dg/intrinsics.d: Update test.
Martin Sebor [Thu, 4 Feb 2021 21:50:23 +0000 (14:50 -0700)]
PR c/97882 - Segmentation Fault on improper redeclaration of function
gcc/c/ChangeLog:
PR c/97882
* c-decl.c (locate_old_decl): Add type to diagnostic output.
(diagnose_mismatched_decls): Same.
(start_function): Introduce temporaries for better readability.
* c-typeck.c (comptypes_internal): Only consider complete enum
types in comparisons with integers.
gcc/testsuite/ChangeLog:
PR c/97882
* gcc.dg/decl-8.c: Adjust text of expected diagnostic.
* gcc.dg/label-decl-4.c: Same.
* gcc.dg/mismatch-decl-1.c: Same.
* gcc.dg/old-style-then-proto-1.c: Same.
* gcc.dg/parm-mismatch-1.c: Same.
* gcc.dg/pr35445.c: Same.
* gcc.dg/redecl-11.c: Same.
* gcc.dg/redecl-12.c: Same.
* gcc.dg/redecl-13.c: Same.
* gcc.dg/redecl-15.c: Same.
* gcc.dg/tls/thr-init-1.c: Same.
* objc.dg/id-1.m: Same.
* objc.dg/tls/diag-3.m: Same.
* gcc.dg/pr97882.c: New test.
* gcc.dg/qual-return-7.c: New test.
* gcc.dg/qual-return-8.c: New test.
Jason Merrill [Thu, 4 Feb 2021 16:46:45 +0000 (11:46 -0500)]
c++: Empty args for variadic concept [PR98717]
Nice when fixing a bug is as easy as removing incorrect checks.
gcc/cp/ChangeLog:
PR c++/98717
* constraint.cc (build_concept_check_arguments): Remove assert.
(build_concept_check): Allow empty args.
gcc/testsuite/ChangeLog:
PR c++/98717
* g++.dg/cpp2a/concepts-variadic3.C: New test.
David Malcolm [Thu, 4 Feb 2021 20:20:59 +0000 (15:20 -0500)]
diagnostics: fix excessive range-printing involving macros [PR97932]
PR c/97932 describes a bug in which diagnostic_show_locus prints most
of a source file.
The issue is that it prints a range in which the start and end locations
are part of the same macro map, but the start location is for a token in
the definition of the macro, whereas the end location is for a token in
an argument of the macro.
This patch extends compatible_locations_p to require that range-printing
of macro maps requires the location to either be both for the definition
of the macro, or both for the arguments of the macro (not one of each),
fixing the issue.
gcc/ChangeLog:
PR c/97932
* diagnostic-show-locus.c (compatible_locations_p): Require
locations in the same macro map to be either both from the
macro definition, or both from the macro arguments.
gcc/testsuite/ChangeLog:
PR c/97932
* gcc.dg/pr97932.c: New test.
emsr [Thu, 4 Feb 2021 16:41:29 +0000 (11:41 -0500)]
Correct date value of the __cpp_size_t_suffix macro.
The value of __cpp_size_t_suffix is 202011 not 202006.
gcc/c-family/ChangeLog:
* c-cppbuiltin.c (c_cpp_builtins): __cpp_size_t_suffix=202011L.
gcc/testsuite/ChangeLog:
* g++.dg/cpp23/feat-cxx2b.C: __cpp_size_t_suffix == 202011.
Jakub Jelinek [Thu, 4 Feb 2021 17:30:45 +0000 (18:30 +0100)]
c++, libcpp: Use make_signed_t<size_t> in the 1z diagnostics
The following patch uses make_signed_t<size_t> instead of
make_signed<size_t>::type in the diagnostics, because the former is shorter.
It is true that one can't use make_signed<size_t>::type in C++11 code (which
is why I haven't changed it in the testcase which is c++11 effective
target), but the message talks about C++23 and make_signed_t is a C++14 and
later feature, so I think it is fine.
2021-02-04 Jakub Jelinek <jakub@redhat.com>
* expr.c (cpp_classify_number): Use make_signed_t<size_t> instead of
make_signed<size_t>::type in the diagnostics.
* g++.dg/warn/Wsize_t-literals.C: Expect make_signed_t<size_t> instead
of make_signed<size_t>::type in the diagnostics.