Commit Graph

192484 Commits

Author SHA1 Message Date
Thomas Schwinge
2788d42bdc options: Fix 'enabledby_negargs' typo in 'LangEnabledBy' option property diagnostics
Originally introduced almost ten years ago in
r193303/commit 0829c7f7c5
"optc-gen.awk: Factor code out to...".

	gcc/
	* opt-functions.awk (lang_enabled_by): Fix 'enabledby_negargs'
	typo.
2022-03-29 11:18:36 +02:00
Jonathan Wakely
8bbeffc102 libstdc++: Workaround for missing 'using enum' in Clang 12
Once we no longer care about older compilers without this feature, we
can drop these static data members, so the names don't have to be
visible at class scope.

libstdc++-v3/ChangeLog:

	* libsupc++/compare (_Strong_order) [!__cpp_using_enum]: Add
	static data members for _Fp_fmt enumerators.
2022-03-29 10:06:33 +01:00
Jonathan Wakely
7255d29c57 libstdc++: Fix incorrect preprocessor conditions in <version>
The conditions that guard the feature test macros in <version> should
match the main definitions of the macros in other headers.

This doesn't matter for GCC, because it supports all the conditions
being tested here, but it does matter for non-GCC compilers without the
relevant C++20 features.

libstdc++-v3/ChangeLog:

	* include/std/version (__cpp_lib_variant): Fix conditions to
	match <variant>.
	(__cpp_lib_expected): Fix condition to match <expected>.
2022-03-29 10:06:33 +01:00
Marc Poulhiès
35464c7903 testsuite: Check fpic support in pr103275.c
Test must check for effective support of fpic.

gcc/testsuite/ChangeLog:
	* gcc.target/i386/pr103275.c: Add missing
	dg-require-effective-target for checking fpic.
2022-03-29 10:36:36 +02:00
Marc Poulhiès
b6cccf88cb testsuite: fixup pr97521.c and pr96713.c on i686-*
On targets that do not have MXX/SSE enabled by default, pr97521
and pr96713 fail because they emit warnings:

pr97521.c:12:1: warning: MMX vector return without MMX enabled
                changes the ABI [-Wpsabi]
pr97521.c:11:1: note: the ABI for passing parameters with
                16-byte alignment has changed in GCC 4.6
pr97521.c:11:1: warning: SSE vector argument without SSE enabled
                changes the ABI [-Wpsabi]

Add -Wno-psabi to dg-options.

gcc/testsuite/ChangeLog:
	* gcc.target/i386/pr97521.c: Add -Wno-psabi to dg-options.
	* gcc.dg/analyzer/pr96713.c: Likewise.
2022-03-29 10:36:30 +02:00
Richard Biener
28c5df7930 tree-optimization/105080 - make sure SCEV is available for ranger
When doing format diagnostics at -O0 we should make sure to make
SCEV available to avoid false positives due to ranges we otherwise
can trivially compute.

2022-03-28  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/105080
	* tree-ssa-strlen.cc (printf_strlen_execute): Always init
	loops and SCEV.

	* gcc.dg/pr105080.c: New testcase.
2022-03-29 08:14:40 +02:00
David Malcolm
3734527dfa analyzer: ensure that we purge state when reusing a conjured_svalue [PR105087]
PR analyzer/105087 describes a false positive from
-Wanalyzer-double-free in which the analyzer erroneously considers two
successive inlined vasprintf calls to have allocated the same pointer.

The root cause is that the result written back from vasprintf is a
conjured_svalue, and that we normally purge state when reusing a
conjured_svalue, but various places in the code were calling
region_model_manager::get_or_create_conjured_svalue but failing to
then call region_model::purge_state_involving on the result.

This patch fixes things by moving responsibility for calling
region_model::purge_state_involving into
region_model_manager::get_or_create_conjured_svalue, so that it is
always called when reusing a conjured_svalue, fixing the false positive.

gcc/analyzer/ChangeLog:
	PR analyzer/105087
	* analyzer.h (class conjured_purge): New forward decl.
	* region-model-asm.cc (region_model::on_asm_stmt): Add
	conjured_purge param to calls binding_cluster::on_asm and
	region_model_manager::get_or_create_conjured_svalue.
	* region-model-impl-calls.cc
	(call_details::get_or_create_conjured_svalue): Likewise for call
	to region_model_manager::get_or_create_conjured_svalue.
	(region_model::impl_call_fgets): Remove call to
	region_model::purge_state_involving, as this is now done
	implicitly by call_details::get_or_create_conjured_svalue.
	(region_model::impl_call_fread): Likewise.
	(region_model::impl_call_strchr): Pass conjured_purge param to
	call to region_model_manager::get_or_create_conjured_svalue.
	* region-model-manager.cc (conjured_purge::purge): New.
	(region_model_manager::get_or_create_conjured_svalue): Add
	param "p".  Use it to purge state when reusing an existing
	conjured_svalue.
	* region-model.cc (region_model::on_call_pre): Replace call to
	region_model::purge_state_involving with passing conjured_purge
	to region_model_manager::get_or_create_conjured_svalue.
	(region_model::handle_unrecognized_call): Pass conjured_purge to
	store::on_unknown_fncall.
	* region-model.h
	(region_model_manager::get_or_create_conjured_svalue): Add param
	"p".
	* store.cc (binding_cluster::on_unknown_fncall): Likewise.  Pass
	it on to region_model_manager::get_or_create_conjured_svalue.
	(binding_cluster::on_asm): Likewise.
	(store::on_unknown_fncall): Add param "p" and pass it on to
	binding_cluster::on_unknown_fncall.
	* store.h (binding_cluster::on_unknown_fncall): Add param p.
	(binding_cluster::on_asm): Likewise.
	(store::on_unknown_fncall): Likewise.
	* svalue.h (class conjured_purge): New.

gcc/testsuite/ChangeLog:
	* gcc.dg/analyzer/pr105087-1.c: New test.
	* gcc.dg/analyzer/pr105087-2.c: New test.
	* gcc.dg/analyzer/vasprintf-1.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-03-28 20:41:23 -04:00
David Malcolm
1203e8f788 analyzer: fix ICE with incorrect lookup of cgraph node [PR105074]
gcc/analyzer/ChangeLog:
	PR analyzer/105074
	* region.cc (ipa_ref_requires_tracking): Drop "context_fndecl",
	instead using the ref->referring to get the cgraph node of the
	caller.
	(symnode_requires_tracking_p): Likewise.

gcc/testsuite/ChangeLog:
	PR analyzer/105074
	* gcc.dg/analyzer/pr105074.c: New test.
	* gcc.dg/analyzer/untracked-1.c (extern_fn_char_ptr): New decl.
	(test_13): New.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-03-28 20:40:16 -04:00
GCC Administrator
aab0127dae Daily bump. 2022-03-29 00:17:13 +00:00
Indu Bhagat
eed9d091de ctfout: use ctfc_get_num_ctf_vars instead
A minor cosmetic fix.

2022-03-28  Indu Bhagat  <indu.bhagat@oracle.com>

gcc/ChangeLog:

	* ctfout.cc (ctf_preprocess): Use ctfc_get_num_ctf_vars instead.
	(output_ctf_vars): Likewise.
2022-03-28 14:06:46 -07:00
Tom Tromey
88252529f0 Remove --with-gmp-dir and --with-mpfr-dir
The top-level configure options --with-gmp-dir and --with-mpfr-dir
were obsoleted and marked as "REMOVED" back in 2006.  I think that's
long enough ago for everyone to have updated their scripts, so this
patch removes them entirely.  While doing this, I also found one other
leftover that wasn't removed by the earlier patch.  This is also
removed here.

2022-03-28  Tom Tromey  <tromey@adacore.com>

	* configure.ac: Remove --with-mpfr-dir and --with-gmp-dir.
	* configure: Rebuild.
2022-03-28 14:18:57 -06:00
Joseph Myers
00635b6cf3 Update gcc sv.po
* sv.po: Update.
2022-03-28 20:04:59 +00:00
Jason Merrill
83a21c9934 c++: Fix __has_trivial_* docs [PR59426]
These have been misdocumented since C++98 POD was split into C++11 trivial
and standard-layout in r149721.

	PR c++/59426

gcc/ChangeLog:

	* doc/extend.texi: Refer to __is_trivial instead of __is_pod.
2022-03-28 15:36:13 -04:00
Jason Merrill
f8093854c7 c++: add comment
gcc/cp/ChangeLog:

	* pt.cc (determine_specialization): Add comment.
2022-03-28 15:36:12 -04:00
Patrick Palka
23e57329c6 c++: reject concept w/ multiple tparm lists [PR105067]
We weren't rejecting a concept declared with multiple template
parameter lists.

	PR c++/105067

gcc/cp/ChangeLog:

	* pt.cc (finish_concept_definition): Check that a concept is
	declared with exactly one template parameter list.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/concepts-err4.C: New test.
2022-03-28 14:15:39 -04:00
Patrick Palka
ecb4882e36 c++: constrained template friend matching ICE [PR105064]
Here during declaration matching for the two constrained template
friends, we crash from maybe_substitute_reqs_for because the second
friend doesn't yet have DECL_TEMPLATE_INFO set (we're being called
indirectly from push_template_decl).

As far as I can tell, this situation happens only when declaring a
constrained template friend within a non-template class (as in the
testcase), in which case the substitution would be a no-op anyway.
So this patch rearranges maybe_substitute_reqs_for to gracefully
handle missing DECL_TEMPLATE_INFO by just skipping the substitution.

	PR c++/105064

gcc/cp/ChangeLog:

	* constraint.cc (maybe_substitute_reqs_for): Don't assume
	DECL_TEMPLATE_INFO is available.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/concepts-friend9.C: New test.
2022-03-28 14:15:16 -04:00
H.J. Lu
cccbb77658 x86: Also use Yw in *ssse3_pshufbv8qi3 clobber
PR target/105068
	* config/i386/sse.md (*ssse3_pshufbv8qi3): Also replace "Yv" with
	"Yw" in clobber.
2022-03-28 10:47:02 -07:00
Tom de Vries
0127fb1b78 [nvptx] Improve help description of misa and mptx
Currently we have:
...
$ gcc --target-help 2>&1 | egrep "misa|mptx"
  -misa=                      Specify the version of the ptx ISA to use.
  -mptx=                      Specify the version of the ptx version to use.
  Known PTX ISA versions (for use with the -misa= option):
  Known PTX versions (for use with the -mptx= option):
...

As reported in PR104818, the "version of the ptx version" doesn't make much
sense.

Furthermore, the description of misa (and 'Known ISA versions') is misleading
because it does not specify the version of the PTX ISA, but rather the PTX ISA
target architecture.

Fix this by printing instead:
...
$ gcc --target-help 2>&1 | egrep "misa|mptx"
  -misa=                      Specify the PTX ISA target architecture to use.
  -mptx=                      Specify the PTX ISA version to use.
  Known PTX ISA target architectures (for use with the -misa= option):
  Known PTX ISA versions (for use with the -mptx= option):
...

Tested on nvptx.

gcc/ChangeLog:

2022-03-28  Tom de Vries  <tdevries@suse.de>

	PR target/104818
	* config/nvptx/gen-opt.sh (ptx_isa): Improve help text.
	* config/nvptx/nvptx-gen.opt: Regenerate.
	* config/nvptx/nvptx.opt (misa, mptx, ptx_version): Improve help text.
	* config/nvptx/t-nvptx (s-nvptx-gen-opt): Add missing dependency on
	gen-opt.sh.
2022-03-28 18:38:57 +02:00
Jason Merrill
fc50d9a252 c++: hash table ICE with variadic alias [PR105003]
For PR104008 we thought it might be enough to keep strip_typedefs from
removing this alias template specialization, but this PR demonstrates that
other parts of the compiler also need to know to consider it dependent.

So, this patch changes complex_alias_template_p to no longer consider
template parameters used when their only use appears in a pack expansion,
unless they are the parameter packs being expanded.

To do that I also needed to change it to use cp_walk_tree instead of
for_each_template_parm.  It occurs to me that find_template_parameters
should probably also use cp_walk_tree, but I'm not messing with that now.

	PR c++/105003
	PR c++/104008
	PR c++/102869

gcc/cp/ChangeLog:

	* pt.cc (complex_alias_template_r): walk_tree callback,	replacing
	uses_all_template_parms_r, complex_pack_expansion_r.
	(complex_alias_template_p): Adjust.
	* tree.cc (strip_typedefs): Revert r12-7710 change.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/variadic-alias6.C: New test.
	* g++.dg/cpp0x/variadic-alias7.C: New test.
2022-03-28 10:57:08 -04:00
David Malcolm
875342766d gimple-fold: fix location of loads for memory ops [PR104308]
PR analyzer/104308 reports that when -Wanalyzer-use-of-uninitialized-value
complains about certain memmove operations where the source is
uninitialized, the diagnostic uses UNKNOWN_LOCATION:

In function 'main':
cc1: warning: use of uninitialized value '*(short unsigned int *)&s + 1' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
  'main': event 1
    |
    |pr104308.c:5:8:
    |    5 |   char s[5]; /* { dg-message "region created on stack here" } */
    |      |        ^
    |      |        |
    |      |        (1) region created on stack here
    |
  'main': event 2
    |
    |cc1:
    | (2): use of uninitialized value '*(short unsigned int *)&s + 1' here
    |

The issue is that gimple_fold_builtin_memory_op converts a memmove to:

  _3 = MEM <unsigned short> [(char * {ref-all})_1];
  MEM <unsigned short> [(char * {ref-all})&s] = _3;

but only sets the location of the 2nd stmt, not the 1st.

Fixed thusly, giving:

pr104308.c: In function 'main':
pr104308.c:6:3: warning: use of uninitialized value '*(short unsigned int *)&s + 1' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
    6 |   memmove(s, s + 1, 2); /* { dg-warning "use of uninitialized value" } */
      |   ^~~~~~~~~~~~~~~~~~~~
  'main': events 1-2
    |
    |    5 |   char s[5]; /* { dg-message "region created on stack here" } */
    |      |        ^
    |      |        |
    |      |        (1) region created on stack here
    |    6 |   memmove(s, s + 1, 2); /* { dg-warning "use of uninitialized value" } */
    |      |   ~~~~~~~~~~~~~~~~~~~~
    |      |   |
    |      |   (2) use of uninitialized value '*(short unsigned int *)&s + 1' here
    |

One side-effect of this change is a change in part of the output of
gcc.dg/uninit-40.c from:

  uninit-40.c:47:3: warning: ‘*(long unsigned int *)(&u[1][0][0])’ is used uninitialized [-Wuninitialized]
     47 |   __builtin_memcpy (&v[1], &u[1], sizeof (V));
        |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  uninit-40.c:45:5: note: ‘*(long unsigned int *)(&u[1][0][0])’ was declared here
     45 |   V u[2], v[2];
        |     ^

to:

  uninit-40.c:47:3: warning: ‘u’ is used uninitialized [-Wuninitialized]
     47 |   __builtin_memcpy (&v[1], &u[1], sizeof (V));
        |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  uninit-40.c:45:5: note: ‘u’ declared here
     45 |   V u[2], v[2];
        |     ^

What's happening is that pass "early_uninit"(29)'s call to
maybe_warn_operand is guarded by this condition:
  1051            else if (gimple_assign_load_p (stmt)
  1052                     && gimple_has_location (stmt))

Before the patch, the stmt:
  _3 = MEM <unsigned long> [(char * {ref-all})&u + 8B];
has no location, and so early_uninit skips this operand at line
1052 above.  Later, pass "uninit"(217) tests the var_decl "u$8", and
emits a warning for it.

With the patch, the stmt has a location, and so early_uninit emits a
warning for "u" and sets a NW_UNINIT warning suppression at that
location.  Later, pass "uninit"(217)'s test of "u$8" is rejected
due to that per-location suppression of uninit warnings, from the
earlier warning.

gcc/ChangeLog:
	PR analyzer/104308
	* gimple-fold.cc (gimple_fold_builtin_memory_op): When optimizing
	to loads then stores, set the location of the new load stmt.

gcc/testsuite/ChangeLog:
	PR analyzer/104308
	* gcc.dg/analyzer/pr104308.c: New test.
	* gcc.dg/uninit-40.c (foo): Update expression in expected message.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-03-28 09:43:07 -04:00
Jason Merrill
19b87a0648 c++: low -faligned-new [PR102071]
This test ICEd after the constexpr new patch (r10-3661) because alloc_call
had a NOP_EXPR around it; fixed by moving the NOP_EXPR to alloc_expr.  And
the PR pointed out that the size_t cookie might need more alignment, so I
fix that as well.

	PR c++/102071

gcc/cp/ChangeLog:

	* init.cc (build_new_1): Include cookie in alignment.  Omit
	constexpr wrapper from alloc_call.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1z/aligned-new9.C: New test.
2022-03-28 09:35:58 -04:00
Jason Merrill
8796eb27e2 c++: visibility of local extern [PR103291]
When setting up the hidden namespace-scope decl for a local extern, we also
need to set its visibility.

	PR c++/103291

gcc/cp/ChangeLog:

	* name-lookup.cc (push_local_extern_decl_alias): Call
	determine_visibility.

gcc/testsuite/ChangeLog:

	* g++.dg/ext/visibility/visibility-local-extern1.C: New test.
2022-03-28 09:35:58 -04:00
Jason Merrill
b854ce130e c++: CTAD and member alias template [PR102123]
When building a deduction guide from the Test constructor, we need to
rewrite the use of _dummy into a dependent reference, i.e. Test<T>::template
_dummy.  We were using SCOPE_REF for both type and non-type templates; we
need to use UNBOUND_CLASS_TEMPLATE for type templates.

	PR c++/102123

gcc/cp/ChangeLog:

	* pt.cc (tsubst_copy): Use make_unbound_class_template for rewriting
	a type template reference.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1z/class-deduction110.C: New test.
2022-03-28 09:35:58 -04:00
Jason Merrill
c7361eb36f c++: member alias declaration [PR103968]
Here, we were wrongly thinking that (const Options&)Widget<T>::c_options is
not value-dependent because neither the type nor the (value of) c_options
are dependent, but since we're binding it to a reference we also need to
consider that it has a value-dependent address.

	PR c++/103968

gcc/cp/ChangeLog:

	* pt.cc (value_dependent_expression_p): Check
	has_value_dependent_address for conversion to reference.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/alias-decl-mem1.C: New test.
2022-03-28 09:35:58 -04:00
Jason Merrill
8bc5cdaafa c++: CTAD and member function references [PR103943]
More quirks of rewriting member references to dependent references for
CTAD.  A reference to a member of dependent scope is definitely dependent.
And since r11-7044, tsubst_baselink builds a SCOPE_REF, so
tsubst_qualified_id should just use it.

	PR c++/103943

gcc/cp/ChangeLog:

	* pt.cc (tsubst_qualified_id): Handle getting SCOPE_REF from
	tsubst_baselink.
	(instantiation_dependent_scope_ref_p): Check dependent_scope_p.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1z/class-deduction109.C: New test.
2022-03-28 09:35:58 -04:00
Jason Merrill
72bdfcb848 c++: missing aggregate base ctor [PR102045]
When make_base_init_ok changes a call to a complete constructor into a call
to a base constructor, we were never marking the base ctor as used, so it
didn't get emitted.

	PR c++/102045

gcc/cp/ChangeLog:

	* call.cc (make_base_init_ok): Call make_used.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1z/aggr-base12.C: New test.
2022-03-28 09:35:58 -04:00
Jason Merrill
71e1db540c c++: mangling union{1} in template [PR104847]
My implementation of union non-type template arguments in r11-2016 broke
braced casts of union type, because they are still in syntactic (undigested)
form.

	PR c++/104847

gcc/cp/ChangeLog:

	* mangle.cc (write_expression): Don't write a union designator when
	undigested.

gcc/testsuite/ChangeLog:

	* g++.dg/abi/mangle-union1.C: New test.
2022-03-28 09:35:58 -04:00
Jason Merrill
07be8f8da4 c++: ICE with alias in pack expansion [PR103769]
This was breaking because when we stripped the 't' typedef in s<t<Args>...>
to be s<Args...>, the TYPE_MAIN_VARIANT of "Args..." was still
"t<Args>...", because type pack expansions are treated as types.  Fixed by
using the right function to copy a "type".

	PR c++/99445
	PR c++/103769

gcc/cp/ChangeLog:

	* tree.cc (strip_typedefs): Use build_distinct_type_copy.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/variadic-alias5.C: New test.
2022-03-28 09:35:58 -04:00
Tom de Vries
52f42dce15 [libgomp, testsuite] Fix hardcoded libexec in plugin/configfrag.ac
When building an nvptx offloading configuration on openSUSE Leap 15.3, the
site script /usr/share/site/x86_64-unknown-linux-gnu is activated, setting
libexecdir to ${exec_prefix}/lib rather than ${exec_prefix}/libexec:
...
| # If user did not specify libexecdir, set the correct target:
| # Nor FHS nor openSUSE allow prefix/libexec. Let's default to prefix/lib.
|
| if test "$libexecdir" = '${exec_prefix}/libexec' ; then
|       libexecdir='${exec_prefix}/lib'
| fi
...

However, in libgomp libgomp/plugin/configfrag.ac we hardcode libexec:
...
    # Configure additional search paths.
    if test x"$tgt_dir" != x; then
      offload_additional_options="$offload_additional_options \
        -B$tgt_dir/libexec/gcc/\$(target_alias)/\$(gcc_version) \
	-B$tgt_dir/bin"
...

Fix this by using /$(libexecdir:\$(exec_prefix)/%=%)/ instead of /libexec/.

Tested on x86_64-linux with nvptx accelerator.

libgomp/ChangeLog:

2022-03-28  Tom de Vries  <tdevries@suse.de>

	* plugin/configfrag.ac: Use /$(libexecdir:\$(exec_prefix)/%=%)/
	instead of /libexec/.
	* configure: Regenerate.
2022-03-28 14:09:02 +02:00
Jonathan Wakely
567eb37c76 libstdc++: Fix typos in comments in tests
libstdc++-v3/ChangeLog:

	* testsuite/20_util/optional/monadic/and_then.cc: Fix typo.
	* testsuite/20_util/optional/monadic/transform.cc: Likewise.
	* testsuite/22_locale/codecvt/always_noconv/char/1.cc: Likewise.
	* testsuite/22_locale/codecvt/encoding/char/1.cc: Likewise.
	* testsuite/22_locale/codecvt/in/char/1.cc: Likewise.
	* testsuite/22_locale/codecvt/max_length/char/1.cc: Likewise.
	* testsuite/22_locale/codecvt/out/char/1.cc: Likewise.
	* testsuite/22_locale/codecvt/unshift/char/1.cc: Likewise.
2022-03-28 12:20:42 +01:00
Martin Liska
a74ccc8cb0 gcc-changelog: Update revert_regex.
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Match trailing dot literally.
2022-03-28 12:42:46 +02:00
Martin Liska
c8464cf444 gcc-changelog: Make This reverts stricter.
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Make the parsing stricter.
2022-03-28 12:29:29 +02:00
Richard Biener
bc86a86a4f tree-optimization/105070 - annotate bit cluster tests with locations
The following makes sure to annotate the tests generated by
switch lowering bit-clustering with locations which otherwise
can be completely lost even at -O0.

2022-03-28  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/105070
	* tree-switch-conversion.h
	(bit_test_cluster::hoist_edge_and_branch_if_true): Add location
	argument.
	* tree-switch-conversion.cc
	(bit_test_cluster::hoist_edge_and_branch_if_true): Annotate
	cond with location.
	(bit_test_cluster::emit): Annotate all generated expressions
	with location.
2022-03-28 11:34:06 +02:00
Andre Vieira
9f37d31324 aarch64: Update Neoverse N2 core definition
gcc/ChangeLog:

	* config/aarch64/aarch64-cores.def: Update Neoverse N2 core entry.
2022-03-28 09:27:01 +01:00
liuhongt
e4352a0fee Fix typo in vec_setv8hi_0.
pinsrw is available for both reg and mem operand under sse2.
pextrw requires sse4.1 for mem operands.

The patch change attr "isa" for pinsrw mem alternative from sse4_noavx
to noavx, will enable below optimization.

-        movzwl  (%rdi), %eax
         pxor    %xmm1, %xmm1
-        pinsrw  $0, %eax, %xmm1
+        pinsrw  $0, (%rdi), %xmm1
         movdqa  %xmm1, %xmm0

gcc/ChangeLog:

	PR target/105066
	* config/i386/sse.md (vec_set<mode>_0): Change attr "isa" of
	alternative 4 from sse4_noavx to noavx.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr105066.c: New test.
2022-03-28 16:14:37 +08:00
Jakub Jelinek
50f9148f7a predcom: Fix up component::component [PR105056]
The recent change didn't initialize comp_step while previously we used
XCNEW to allocate it.

I think RS_ANY is better than RS_INTERNAL (== 0) as the default.

2022-03-28  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/105056
	* tree-predcom.cc (component::component): Initialize also comp_step.
2022-03-28 09:51:28 +02:00
Richard Biener
f6819b7fea add missing dg-require alias to gcc.dg/torture/pr100786.c
2022-03-28  Richard Biener  <rguenther@suse.de>

	* gcc.dg/torture/pr100786.c: Add dg-require alias.
2022-03-28 09:49:10 +02:00
GCC Administrator
2c1c55d701 Daily bump. 2022-03-28 00:16:40 +00:00
H.J. Lu
08e6933288 x86: Use Yw constraint on *ssse3_pshufbv8qi3
Since AVX512VL and AVX512BW are required for AVX512 VPSHUFB, replace the
"Yv" register constraint with the "Yw" register constraint.

gcc/

	PR target/105068
	* config/i386/sse.md (*ssse3_pshufbv8qi3): Replace "Yv" with
	"Yw".

gcc/testsuite/

	PR target/105068
	* gcc.target/i386/pr105068.c: New test.
2022-03-27 11:54:09 -07:00
Jonathan Wakely
b78e0ce28b libstdc++: Define std::expected for C++23 (P0323R12)
Because this adds a new class template called std::unexpected, we have
to stop declaring the std::unexpected() function (which was deprecated
in C++11 and removed in C++17).

libstdc++-v3/ChangeLog:

	* doc/doxygen/user.cfg.in: Add new header.
	* include/Makefile.am: Likewise.
	* include/Makefile.in: Regenerate.
	* include/precompiled/stdc++.h: Add new header.
	* include/std/version (__cpp_lib_expected): Define.
	* libsupc++/exception [__cplusplus > 202002] (unexpected)
	(unexpected_handler, set_unexpected): Do not declare for C++23.
	* include/std/expected: New file.
	* testsuite/20_util/expected/assign.cc: New test.
	* testsuite/20_util/expected/cons.cc: New test.
	* testsuite/20_util/expected/illformed_neg.cc: New test.
	* testsuite/20_util/expected/observers.cc: New test.
	* testsuite/20_util/expected/requirements.cc: New test.
	* testsuite/20_util/expected/swap.cc: New test.
	* testsuite/20_util/expected/synopsis.cc: New test.
	* testsuite/20_util/expected/unexpected.cc: New test.
	* testsuite/20_util/expected/version.cc: New test.
2022-03-27 18:50:31 +01:00
GCC Administrator
d2906412ad Daily bump. 2022-03-27 00:16:33 +00:00
Thomas Schwinge
43911ddd18 Remove mysterious '-# Defining these options here in addition to common.opt is necessary' command-line option
Before:

    $ [...]/gcc '-# Defining these options here in addition to common.opt is necessary' -S -x c /dev/null && echo MYSTERIOUS
    MYSTERIOUS

After:

    $ [...]/gcc '-# Defining these options here in addition to common.opt is necessary' -S -x c /dev/null && echo MYSTERIOUS
    gcc: error: unrecognized command-line option ‘-# Defining these options here in addition to common.opt is necessary’

This commit changes:

    --- [...]/build-gcc/gcc/optionlist	2022-03-24 22:12:07.936746648 +0100
    +++ [...]/build-gcc/gcc/optionlist	2022-03-24 22:30:06.976737341 +0100
    @@ -1,4 +1,3 @@
    -# Defining these options here in addition to common.opt is necessary# in order for the default -Wall setting of -Wuse-after-free=2 to take# effect.
     ###Driver
     -all-warningsAda AdaWhy AdaSCIL Alias(Wall)
     -all-warningsC ObjC C++ ObjC++ Warning Alias(Wall)
    [...]

    --- [...]/build-gcc/gcc/options.cc	2022-03-24 22:12:09.548727738 +0100
    +++ [...]/build-gcc/gcc/options.cc	2022-03-24 22:30:08.904727249 +0100
    @@ -3222,15 +3222,6 @@
     const struct cl_option cl_options[] =
     {
      /* [0] = */ {
    -    "-# Defining these options here in addition to common.opt is necessary",
    -    "# effect.",
    -    NULL,
    -    NULL,
    -    NULL, NULL, N_OPTS, N_OPTS, 68, /* .neg_idx = */ -1,
    -    0,
    -    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    -    (unsigned short) -1, 0, CLVC_INTEGER, 0, -1, -1 },
    - /* [1] = */ {
         "-###",
         NULL,
         NULL,
    [...]

..., and re-numbers all following options.

    --- [...]/build-gcc/gcc/options.h	2022-03-21 23:24:25.894226828 +0100
    +++ [...]/build-gcc/gcc/options.h	2022-03-24 22:30:07.288735708 +0100
    @@ -9753,2118 +9753,2117 @@

     enum opt_code
     {
    -  OPT___Defining_these_options_here_in_addition_to_common_opt_is_necessary = 0,/* -# Defining these options here in addition to common.opt is necessary */
    [...]

..., and likewise re-numbers all following options.

Clean-up for commit 671a283636
"Add -Wuse-after-free [PR80532]".

	gcc/c-family/
	* c.opt: Properly quote comment.
2022-03-26 21:31:30 +01:00
Roger Sayle
41d1f11f5f PR middle-end/104885: Fix ICE with large stack frame on powerpc64.
My recent testcase for PR c++/84964.C stress tests the middle-end by
attempting to pass a UINT_MAX sized structure on the stack.  Although
my fix to PR84964 avoids the ICE after sorry on x86_64 and similar
targets, a related issue still exists on powerpc64 (and similar
ACCUMULATE_OUTGOING_ARGS/ARGS_GROW_DOWNWARD targets) which don't
issue a "sorry, unimplemented" message, but instead ICE elsewhere.

After attempting several alternate fixes, the simplest solution is
to just defensively check in mark_stack_region_used that the upper
bound of the region lies within the allocated stack_usage_map
array, which is of size highest_outgoing_arg_in_use.  When this isn't
the case, the code now follows the same path as for variable sized
regions, and uses stack_usage_watermark rather than a map.

2022-03-26  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
	PR middle-end/104885
	* calls.cc (mark_stack_region_used): Check that the region
	is within the allocated size of stack_usage_map.
2022-03-26 08:10:27 -10:00
Jakub Jelinek
6459e65376 ecog: Return 1 from insn_invalid_p if REG_INC reg overlaps some stored reg [PR103775]
The following testcase ICEs on aarch64-linux with -g and
assembles with a warning otherwise, because it emits
ldrb w0,[x0,16]!
instruction which sets the x0 register multiple times.
Due to disabled DCE (from -Og) we end up before REE with:
(insn 12 39 13 2 (set (reg:SI 1 x1 [orig:93 _2 ] [93])
        (zero_extend:SI (mem/c:QI (pre_modify:DI (reg/f:DI 0 x0 [114])
                    (plus:DI (reg/f:DI 0 x0 [114])
                        (const_int 16 [0x10]))) [1 u128_1+0 S1 A128]))) "pr103775.c":5:35 117 {*zero_extendqisi2_aarch64}
     (expr_list:REG_INC (reg/f:DI 0 x0 [114])
        (nil)))
(insn 13 12 14 2 (set (reg:DI 0 x0 [orig:112 _2 ] [112])
        (zero_extend:DI (reg:SI 1 x1 [orig:93 _2 ] [93]))) "pr103775.c":5:16 111 {*zero_extendsidi2_aarch64}
     (nil))
which is valid but not exactly efficient as x0 is dead after the
insn that auto-increments it.  REE turns it into:
(insn 12 39 44 2 (set (reg:DI 0 x0)
        (zero_extend:DI (mem/c:QI (pre_modify:DI (reg/f:DI 0 x0 [114])
                    (plus:DI (reg/f:DI 0 x0 [114])
                        (const_int 16 [0x10]))) [1 u128_1+0 S1 A128]))) "pr103775.c":5:35 119 {*zero_extendqidi2_aarch64}
     (expr_list:REG_INC (reg/f:DI 0 x0 [114])
        (nil)))
(insn 44 12 14 2 (set (reg:DI 1 x1)
        (reg:DI 0 x0)) "pr103775.c":5:35 -1
     (nil))
which is invalid because it sets x0 multiple times, one
in SET_DEST of the PATTERN and once in PRE_MODIFY.
As perhaps other passes than REE might suffer from it, IMHO it is better
to reject this during change validation.

2022-03-26  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/103775
	* recog.cc (check_invalid_inc_dec): New function.
	(insn_invalid_p): Return 1 if REG_INC operand overlaps
	any stored REGs.

	* gcc.dg/pr103775.c: New test.
2022-03-26 16:21:36 +01:00
Patrick Palka
ff465bd8a0 c++: diagnosing if-stmt with non-constant branches [PR105050]
When an if-stmt is determined to be non-constant because both of its
branches are non-constant, we issue a somewhat generic error which,
since the error also points to the 'if' token, misleadingly suggests
the condition is at fault:

  constexpr-105050.C:8:3: error: expression ‘<statement>’ is not a constant expression
      8 |   if (p != q && *p < 0)
        |   ^~

This patch clarifies the error message to instead read:

  constexpr-105050.C:8:3: error: neither branch of ‘if’ is a constant expression
      8 |   if (p != q && *p < 0)
        |   ^~

	PR c++/105050

gcc/cp/ChangeLog:

	* constexpr.cc (potential_constant_expression_1) <case IF_STMT>:
	Clarify error message when a if-stmt is non-constant because its
	branches are non-constant.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1y/constexpr-105050.C: New test.
2022-03-26 10:20:18 -04:00
Patrick Palka
04f19580e8 c++: ICE when building builtin operator->* set [PR103455]
Here when constructing the builtin operator->* candidate set according
to the available conversion functions for the operand types, we end up
considering a candidate with C1=T (through B's dependent conversion
function) and C2=F, during which we crash from DERIVED_FROM_P because
dependent_type_p sees a TEMPLATE_TYPE_PARM outside of a template
context.

Sidestepping the question of whether we should be considering such a
dependent conversion function here in the first place, it seems futile
to test DERIVED_FROM_P for anything other than an actual class type, so
this patch fixes this ICE by simply guarding the DERIVED_FROM_P test
with CLASS_TYPE_P instead of MAYBE_CLASS_TYPE_P.

	PR c++/103455

gcc/cp/ChangeLog:

	* call.cc (add_builtin_candidate) <case MEMBER_REF>: Test
	CLASS_TYPE_P instead of MAYBE_CLASS_TYPE_P.

gcc/testsuite/ChangeLog:

	* g++.dg/overload/builtin6.C: New test.
2022-03-26 10:20:16 -04:00
H.J. Lu
ede5f5224d x86: Use x constraint on KL patterns
Since KL instructions have no AVX512 version, replace the "v" register
constraint with the "x" register constraint.

	PR target/105058
	* config/i386/sse.md (loadiwkey): Replace "v" with "x".
	(aes<aesklvariant>u8): Likewise.
2022-03-26 07:15:39 -07:00
H.J. Lu
99591cf43f x86: Use x constraint on SSSE3 patterns with MMX operands
Since PHADDW/PHADDD/PHADDSW/PHSUBW/PHSUBD/PHSUBSW/PSIGNB/PSIGNW/PSIGND
have no AVX512 version, replace the "Yv" register constraint with the
"x" register constraint.

	PR target/105052
	* config/i386/sse.md (ssse3_ph<plusminus_mnemonic>wv4hi3):
	Replace "Yv" with "x".
	(ssse3_ph<plusminus_mnemonic>dv2si3): Likewise.
	(ssse3_psign<mode>3): Likewise.
2022-03-26 07:15:34 -07:00
David Malcolm
8c8993c753 analyzer: fix ICE on memset of untracked region [PR105057]
In r12-7809-g5f6197d7c197f9d2b7fb2e1a19dac39a023755e8 I added an
optimization to avoid tracking the state of certain memory regions
in the store.

Unfortunately, I didn't cover every way in which
store::get_or_create_cluster can be called for a base region, leading
to assertion failure ICEs in -fanalyzer on certain function calls
with certain params.

I've worked through all uses of store::get_or_create_cluster and found
four places where the assertion could fire.

This patch fixes them, and adds regression tests where possible.

gcc/analyzer/ChangeLog:
	PR analyzer/105057
	* store.cc (binding_cluster::make_unknown_relative_to): Reject
	attempts to create a cluster for untracked base regions.
	(store::set_value): Likewise.
	(store::fill_region): Likewise.
	(store::mark_region_as_unknown): Likewise.

gcc/testsuite/ChangeLog:
	PR analyzer/105057
	* gcc.dg/analyzer/fread-2.c: New test, as a regression test for
	ICE in store::set_value on untracked base region.
	* gcc.dg/analyzer/memset-2.c: Likewise, for ICE in
	store::fill_region.
	* gcc.dg/analyzer/strcpy-2.c: Likewise, for ICE in
	store::mark_region_as_unknown.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-03-26 09:05:30 -04:00
Jakub Jelinek
f0fdd92e9d Manually add entry for r12-7818-g3ab5c8cd03d92bf4ec41e351820349d92fbc40c4
Because update_version_git gave up on it.
2022-03-26 11:28:35 +01:00