184445 Commits

Author SHA1 Message Date
Hans-Peter Nilsson
07b27384de gcc.dg/analyzer/data-model-1.c: Inverse xfail for cris-*-*, PR99212
See PR99212.  Now, cris-elf isn't the only target for which this line
shows a failure; pru-unknown-elf and m68k-unknown-linux-gnu are two
others.  I'll leave adjustments to the respective maintainers, but
trivially appending more triplets should work: no extra bracketing needed.
A specific effective_target specifier would as always be perferable, but I
couldn't without accountable effort find out what was the common factor.

Besides cris-elf, sanity-checked for native x86_64-*-linux*.

gcc/testsuite:
	PR analyzer/99212
	* gcc.dg/analyzer/data-model-1.c (test_45): Inverse xfail at
	line 971 for cris-*-*.
2021-04-13 04:21:01 +02:00
David Malcolm
17f3c2b8ac gimple UIDs, LTO and -fanalyzer [PR98599]
gimple.h has this comment for gimple's uid field:

  /* UID of this statement.  This is used by passes that want to
     assign IDs to statements.  It must be assigned and used by each
     pass.  By default it should be assumed to contain garbage.  */
  unsigned uid;

and gimple_set_uid has:

   Please note that this UID property is supposed to be undefined at
   pass boundaries.  This means that a given pass should not assume it
   contains any useful value when the pass starts and thus can set it
   to any value it sees fit.

which suggests that any pass can use the uid field as an arbitrary
scratch space.

PR analyzer/98599 reports a case where this error occurs in LTO mode:
  fatal error: Cgraph edge statement index out of range
on certain inputs with -fanalyzer.

The error occurs in the LTRANS phase after -fanalyzer runs in the
WPA phase.  The analyzer pass writes to the uid fields of all stmts.

The error occurs when LTRANS is streaming callgraph edges back in.
The LTO format uses stmt uids to associate call stmts with callgraph
edges between WPA and LTRANS.
For example, in lto-cgraph.c, lto_output_edge writes out the
gimple_uid, and input_edge reads it back in.

lto_prepare_function_for_streaming has code to renumber the stmt UIDs
when the code is streamed back out, but for some reason this isn't
called for clones:
    307	  /* Do body modifications needed for streaming before we fork out
    308	     worker processes.  */
    309	  FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (node)
    310	    if (!node->clone_of && gimple_has_body_p (node->decl))
    311	      lto_prepare_function_for_streaming (node);

Hence the combination of -fanalyzer and -flto will fail in LTRANS's
stream-in if any function clones are encountered.

It's not fully clear to me why this isn't done for clones, and what the
correct fix should be to allow arbitrary changes to uids within WPA
passes.

In the meantime, this patch works around the issue by updating the
analyzer to save and restore the UIDs, fixing the error.

gcc/analyzer/ChangeLog:
	PR analyzer/98599
	* supergraph.cc (saved_uids::make_uid_unique): New.
	(saved_uids::restore_uids): New.
	(supergraph::supergraph): Replace assignments to stmt->uid with
	calls to m_stmt_uids.make_uid_unique.
	(supergraph::~supergraph): New.
	* supergraph.h (class saved_uids): New.
	(supergraph::~supergraph): New decl.
	(supergraph::m_stmt_uids): New field.

gcc/testsuite/ChangeLog:
	PR analyzer/98599
	* gcc.dg/analyzer/pr98599-a.c: New test.
	* gcc.dg/analyzer/pr98599-b.c: New test.
2021-04-12 21:13:40 -04:00
GCC Administrator
287ad814d7 Daily bump. 2021-04-13 00:16:21 +00:00
Jakub Jelinek
ffc4155b6e combine: Fix up expand_compound_operation [PR99905]
The following testcase is miscompiled on x86_64-linux.
expand_compound_operation is called on
(zero_extract:DI (mem/c:TI (reg/f:DI 16 argp) [3 i+0 S16 A128])
    (const_int 16 [0x10])
    (const_int 63 [0x3f]))
so mode is DImode, inner_mode is TImode, pos 63, len 16 and modewidth 64.

A couple of lines above the problematic spot we have:
  if (modewidth >= pos + len)
    {
      tem = gen_lowpart (mode, XEXP (x, 0));
where the code uses gen_lowpart and then shift left/right to extract it
in mode.  But the guarding condition is false - 64 >= 63 + 16
and so we enter the next condition, where the code shifts XEXP (x, 0)
right by pos and then adds AND.  It does so incorrectly though.
Given the modewidth < pos + len, inner_mode must be necessarily larger
than mode and XEXP (x, 0) has the innermode, but it was calling
simplify_shift_const with mode rather than inner_mode, which meant
inconsistent arguments to simplify_shift_const and in this case made
a DImode MEM shift out of it.

The following patch fixes it, by doing the shift in inner_mode properly
and then after the shift doing the lowpart subreg and masking already
in mode.

2021-04-13  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/99905
	* combine.c (expand_compound_operation): If pos + len > modewidth,
	perform the right shift by pos in inner_mode and then convert to mode,
	instead of trying to simplify a shift of rtx with inner_mode by pos
	as if it was a shift in mode.

	* gcc.target/i386/pr99905.c: New test.
2021-04-13 01:01:45 +02:00
Jakub Jelinek
9c1c8ad833 combine: Don't fold away side-effects in simplify_and_const_int_1 [PR99830]
Here is an alternate patch for the PR99830 bug.
As discussed on IRC and in the PR, the reason why a (clobber:TI (const_int 0))
has been propagated into the debug insns is that it got optimized away
during simplification from the i3 instruction pattern.

And that happened because
simplify_and_const_int_1 (SImode, varop, 255)
with varop of
(ashift:SI (subreg:SI (and:TI (clobber:TI (const_int 0 [0]))
                              (const_int 255 [0xff])) 0)
           (const_int 16 [0x10]))
was called and through nonzero_bits determined that (whatever << 16) & 255
is const0_rtx.
It is, but if there are side-effects in varop and such clobbers are
considered as such, we shouldn't optimize those away.

2021-04-13  Jakub Jelinek  <jakub@redhat.com>

	PR debug/99830
	* combine.c (simplify_and_const_int_1): Don't optimize varop
	away if it has side-effects.

	* gcc.dg/pr99830.c: New test.
2021-04-13 01:00:48 +02:00
Ian Lance Taylor
eb49f7de93 libgo: update to Go1.16.3 release
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/309490
2021-04-12 15:23:16 -07:00
Jason Merrill
84081e2c6b c++: premature overload resolution [PR93085]
We can't resolve the call to foo<42> before instantiation of G, because the
template parameter of #1 has dependent type.  But we were missing that in
our dependency check, because the tree walk of DECL_TEMPLATE_PARMS doesn't
look into the types of template parameters.  So look at them directly.

gcc/cp/ChangeLog:

	PR c++/93085
	* pt.c (uses_outer_template_parms): Handle non-type and template
	template parameters specifically.

gcc/testsuite/ChangeLog:

	PR c++/93085
	* g++.dg/template/dependent-tmpl1.C: New test.
2021-04-12 17:29:54 -04:00
Joseph Myers
7650259de8 Update gcc sv.po.
* sv.po: Update.
2021-04-12 21:01:32 +00:00
Martin Liska
8f17d44ad9 docs: fix content of smallexample
gcc/ChangeLog:

	* doc/extend.texi: Escape @smallexample content.
2021-04-12 16:14:25 +02:00
Stefan Schulze Frielinghaus
46c47420a5 IBM Z: Add alternative to *movdi_{31,64} in order to load a DFP zero
gcc/ChangeLog:

	* config/s390/s390.md ("*movdi_31", "*movdi_64"): Add
	  alternative in order to load a DFP zero.
2021-04-12 16:08:42 +02:00
Martin Liska
bb8f2c3230 docs: update symver attribute description
gcc/ChangeLog:

	* doc/extend.texi: Be more precise in documentation
	of symver attribute.
2021-04-12 15:32:32 +02:00
Jonathan Wakely
7569ce583f libstdc++: Implement LWG 3404 for C++20 subrange [PR 100044]
These deduction guides became useless with LWG 3282 (implemented in
commit r10-6741) and so were removed by LWG 3404.

libstdc++-v3/ChangeLog:

	PR libstdc++/100044
	* include/bits/ranges_util.h (__detail::__iterator_sentinel_pair):
	Remove helper concept.
	(subrange(_Pr), subrange(Pr, __make_unsigned_like<...>)): Remove
	deduction guides, as per LWG 3404.
	* testsuite/std/ranges/subrange/lwg3282_neg.cc: Check that class
	template argument deduction fails.
2021-04-12 13:31:17 +01:00
Martin Liska
1c35444b91 gcc-changelog: do not allow space in long line
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Do not allow space in long lines.
2021-04-12 14:11:27 +02:00
Martin Liska
598359f627 ASAN: do not unpoison in OpenMP context
gcc/ChangeLog:

	PR sanitizer/99877
	* gimplify.c (gimplify_expr): Right now, we unpoison all
	variables before a goto <dest>. We should not do it if we are
	in a omp context.

gcc/testsuite/ChangeLog:

	PR sanitizer/99877
	* g++.dg/asan/pr99877.C: New test.
2021-04-12 13:34:02 +02:00
Jonathan Wakely
91dd7954c4 libstdc++: Fix some tests that fail in C++20 mode
The linear_congruential_engine negative tests fail with a different
error in C++20 mode, because double is no longer an invalid type for
NTTP. Adjust the expected errors.

libstdc++-v3/ChangeLog:

	* testsuite/26_numerics/random/linear_congruential_engine/requirements/non_uint_neg.cc:
	Adjust expected error for C++20 mode.
	* testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/non_uint_neg.cc:
	Likewise.
2021-04-12 12:30:07 +01:00
Martin Liska
a694a02125 mklog: support long filenames
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Support long filenames
	in entries.
	* gcc-changelog/test_email.py: Test it.
	* gcc-changelog/test_patches.txt: Likewise.
2021-04-12 13:16:50 +02:00
Jonathan Wakely
29046e02b8 libstdc++: Fix test that fails in C++20 mode [PR 99995]
The 17_intro/headers/c++1998/49745.cc test fails for C++20 mode with PCH
enabled, because PCH makes it include <bits/stdc++.h>, which includes
<atomic>, and that includes <unistd.h> in C++20 mode. The <unistd.h>
dependency should go away when C++20 atomic waiting is stable, but will
probably remain while the feature is experimental. Change the test to
always include <bits/stdc++.h>, and XFAIL for C++20 and later.

libstdc++-v3/ChangeLog:

	PR libstdc++/99995
	* testsuite/17_intro/headers/c++1998/49745.cc: Include all
	standard headers and XFAIL for effective-target c++20.
2021-04-12 11:34:19 +01:00
Cui,Lili
c02c39fad0 Add rocketlake to gcc.
gcc/
	* common/config/i386/cpuinfo.h (get_intel_cpu): Handle
	rocketlake.
	* common/config/i386/i386-common.c (processor_names): Add
	rocketlake.
	(processor_alias_table): Add rocketlake.
	* common/config/i386/i386-cpuinfo.h (processor_subtypes): Add
	INTEL_COREI7_ROCKETLAKE.
	* config.gcc: Add -march=rocketlake.
	* config/i386/i386-c.c (ix86_target_macros_internal): Handle
	rocketlake.
	* config/i386/i386-options.c (m_ROCKETLAKE)  : Define.
	(processor_cost_table): Add rocketlake cost.
	* config/i386/i386.h (ix86_size_cost) : Define
	TARGET_ROCKETLAKE.
	(processor_type) : Add PROCESSOR_ROCKETLAKE.
	(PTA_ROCKETLAKE): Ditto.
	* doc/extend.texi: Add rocketlake.
	* doc/invoke.texi: Add rocketlake.

gcc/testsuite/
	* gcc.target/i386/funcspec-56.inc: Handle new march.
	* g++.target/i386/mv16.C: Handle new march
2021-04-12 15:42:26 +08:00
Cui,Lili
f2be08339b Change march=alderlake ISA list and add m_ALDERLAKE to m_CORE_AVX2
Alder Lake Intel Hybrid Technology will not support Intel® AVX-512. ISA
features such as Intel® AVX, AVX-VNNI, Intel® AVX2, and UMONITOR/UMWAIT/TPAUSE
are supported.

gcc/ChangeLog

	* config/i386/i386.h (PTA_ALDERLAKE): Change alderlake ISA list.
	* config/i386/i386-options.c (m_CORE_AVX2): Add m_ALDERLAKE.
	* common/config/i386/cpuinfo.h (get_intel_cpu): Add AlderLake model.
	* doc/invoke.texi: Change alderlake ISA list.
2021-04-12 15:39:52 +08:00
GCC Administrator
a0ecde220d Daily bump. 2021-04-12 00:16:27 +00:00
Hafiz Abid Qadeer
ac200799ac [OpenACC] Fix an ICE where a loop with GT condition is collapsed.
We have seen an ICE both on trunk and devel/omp/gcc-10 branches which can
be reprodued with this simple testcase.  It occurs if an OpenACC loop has
a collapse clause and any of the loop being collapsed uses GT or GE
condition.  This issue is specific to OpenACC.

int main (void)
{
  int ix, iy;
  int dim_x = 16, dim_y = 16;
  {
       for (iy = dim_y - 1; iy > 0; --iy)
       for (ix = dim_x - 1; ix > 0; --ix)
        ;
  }
}

The problem is caused by a failing assertion in expand_oacc_collapse_init.
It checks that cond_code for fd->loop should be same as cond_code for all
the loops that are being collapsed.  As the cond_code for fd->loop is
LT_EXPR with collapse clause (set at the end of omp_extract_for_data),
this assertion forces that all the loop in collapse clause should use
< operator.

There does not seem to be anything in the code which demands this
condition as loop with > condition works ok otherwise.  I digged old
mailing list a bit but could not find any discussion on this change.
Looking at the code, expand_oacc_for checks that fd->loop->cond_code is
either LT_EXPR or GT_EXPR.  I guess the original intention was to have
similar checks on the loop which are being collapsed. But the way check
was written does not acheive that.

I have fixed it by modifying the check in the assertion to be same as
check on fd->loop->cond_code.

I tested goacc and libgomp (with nvptx offloading) and did not see any
regression.  I have added new tests to check collapse with GT/GE condition.

	PR middle-end/98088
	gcc/
	* omp-expand.c (expand_oacc_collapse_init): Update condition in
	a gcc_assert.

	gcc/testsuite/
	* c-c++-common/goacc/collapse-2.c: New.

	libgomp/
	* testsuite/libgomp.oacc-c-c++-common/collapse-2.c: Add check
	for loop with GT/GE condition.
	* testsuite/libgomp.oacc-c-c++-common/collapse-3.c: Likewise.
2021-04-11 14:44:22 +01:00
Hafiz Abid Qadeer
cdb23bba5c MAINTAINERS: Add myself for write after approval
ChangeLog:

2021-04-11  Hafiz Abid Qadeer  <abidh@codesourcery.com>

	* MAINTAINERS (Write After Approval): Add myself.
2021-04-11 12:09:11 +01:00
Gerald Pfeifer
c660464a9e ada: Avoid invalid "up" link in manual
gcc/ada/
	* gnat_ugn.texi (Top): Avoid invalid "up" link.
2021-04-11 11:26:54 +02:00
Jason Merrill
936d500dfc c++: ICE with anonymous union [PR97974]
Here lookup got confused by finding a conversion operator from
lookup_anon_field.  Let's avoid this by pruning functions from
CLASSTYPE_MEMBER_VEC as well as TYPE_FIELDS.

gcc/cp/ChangeLog:

	PR c++/97974
	* decl.c (fixup_anonymous_aggr): Prune all functions from
	CLASSTYPE_MEMBER_VEC.

gcc/testsuite/ChangeLog:

	PR c++/97974
	* g++.dg/lookup/pr84962.C: Adjust diagnostic.
	* g++.dg/other/anon-union5.C: New test.
2021-04-10 23:52:07 -04:00
GCC Administrator
1d54b13841 Daily bump. 2021-04-11 00:16:24 +00:00
Jason Merrill
82198676c8 c++: ICE with invalid use of 'this' with static memfn [PR98800]
Here instantiation of the fake 'this' parameter we used when parsing the
trailing return type of func() was failing because there is no actual 'this'
parameter in the instantiation.  For PR97399 I told Patrick to do the 'this'
injection even for statics, but now I think I was wrong; the out-of-class
definition case I was concerned about does not break with this patch.  And
we don't set current_class_ptr in the body of a static member function.

And the OMP code should continue to parse 'this' and complain about it
rather than give a syntax error.

gcc/cp/ChangeLog:

	PR c++/98800
	PR c++/97399
	* parser.c (cp_parser_direct_declarator): Don't
	inject_this_parameter if static_p.
	(cp_parser_omp_var_list_no_open): Parse 'this' even if
	current_class_ptr isn't set for a better diagnostic.

gcc/testsuite/ChangeLog:

	PR c++/98800
	* g++.dg/gomp/this-1.C: Adjust diagnostic.
	* g++.dg/cpp0x/constexpr-this1.C: New test.
2021-04-10 16:33:11 -04:00
David Malcolm
ec633d3777 analyzer: fix ICE on assignment from STRING_CST when building path [PR100011]
gcc/analyzer/ChangeLog:
	PR analyzer/100011
	* region-model.cc (region_model::on_assignment): Avoid NULL
	dereference if ctxt is NULL when assigning from a STRING_CST.

gcc/testsuite/ChangeLog:
	PR analyzer/100011
	* gcc.dg/analyzer/pr100011.c: New test.
2021-04-10 16:23:23 -04:00
Jakub Jelinek
9f7d77bd6d c: Avoid clobbering TREE_TYPE (error_mark_node) [PR99990]
The following testcase ICEs during error recovery, because finish_decl
overwrites TREE_TYPE (error_mark_node), which better should stay always
to be error_mark_node.

2021-04-10  Jakub Jelinek  <jakub@redhat.com>

	PR c/99990
	* c-decl.c (finish_decl): Don't overwrite TREE_TYPE of
	error_mark_node.

	* gcc.dg/pr99990.c: New test.
2021-04-10 17:01:54 +02:00
Iain Buclaw
0344b5b822 d: Merge upstream dmd 0450061c8
D front-end changes:

 - Fix ICE in forward referenced type members of structs.

 - Fix ICE passing a member template mixin identifier as alias argument.

 - Fix ICE when `__traits' prints error involving a Parameter.

 - Fix bugs found in `__traits(allMembers)' returning wrong result.

 - Detect and shortcut Alias and AliasSeq template patterns.

Reviewed-on: https://github.com/dlang/dmd/pull/12405
	     https://github.com/dlang/dmd/pull/12411

gcc/d/ChangeLog:

	* dmd/MERGE: Merge upstream dmd 0450061c8.
2021-04-10 15:02:07 +02:00
Iain Buclaw
d118ec221d libphobos: Build runtime library with -ffunction-sections -fdata-sections
Tests for `-ffunction-sections -fdata-sections' and sets SECTION_FLAGS
accordingly.  If there is no warning when using it, take advantage of
the smaller executables that can be had with `--gc-sections'.

libphobos/ChangeLog:

	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Call DRUNTIME_SECTION_FLAGS.
	* libdruntime/Makefile.am: Add SECTION_FLAGS to AM_DFLAGS.
	* libdruntime/Makefile.in: Regenerate.
	* m4/druntime.m4 (DRUNTIME_SECTION_FLAGS): New macro.
	* src/Makefile.am: Add SECTION_FLAGS to AM_DFLAGS.
	* src/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.
2021-04-10 15:02:07 +02:00
Iain Buclaw
32703b80f6 libphobos: Add section support code for MACHO and PE/COFF
This replaces the original and untested support for Windows and OSX, and
is the 90% of the work needed to support libphobos on those targets.

The core.thread interface has been updated to accomodate for the same
function might be implemented by any of the platform-dependent modules.

libphobos/ChangeLog:

	* libdruntime/Makefile.am (DRUNTIME_DSOURCES): Removed
	gcc/sections/android.d, elf_shared.d, osx.d, win32.d, and win64.d.
	Added gcc/sections/common.d, elf.d macho.d, and pecoff.d.
	* libdruntime/Makefile.in: Regenerate.
	* libdruntime/core/thread/osthread.d: Update externDFunc FQDN names to
	use platform independant section function names.
	* libdruntime/gcc/sections/elf_shared.d: Renamed to...
	* libdruntime/gcc/sections/elf.d: ...this.  Mangle functions for
	core.thread interface as if they come from the gcc.sections module.
	* libdruntime/gcc/sections/package.d: Update public imports, declare
	functions for core.thread interface.
	* libdruntime/gcc/sections/android.d: Removed.
	* libdruntime/gcc/sections/osx.d: Removed.
	* libdruntime/gcc/sections/win32.d: Removed.
	* libdruntime/gcc/sections/win64.d: Removed.
	* libdruntime/gcc/sections/common.d: New file.
	* libdruntime/gcc/sections/macho.d: New file.
	* libdruntime/gcc/sections/pecoff.d: New file.
2021-04-10 15:02:07 +02:00
Iain Buclaw
385ee099ee libphobos: Explicitly use -static-libphobos in druntime and phobos tests
Linking to libphobos statically is the default in the driver, however
this may change in future.  Be explicit that the static libphobos is
what's being tested.

libphobos/ChangeLog:

	* testsuite/libphobos.druntime/druntime.exp: Compile all tests with
	-static-libphobos.
	* testsuite/libphobos.phobos/phobos.exp: Likewise.
2021-04-10 15:02:06 +02:00
Iain Buclaw
2b77874831 libphobos: Remove is-effective-target static from druntime and phobos tests
This test isn't compiling with `-static', it's there to verify that the
libphobos is functional when linked in statically.

libphobos/ChangeLog:

	* testsuite/libphobos.druntime/druntime.exp: Remove
	is-effective-target static.
	* testsuite/libphobos.phobos/phobos.exp: Likewise.
2021-04-10 15:02:06 +02:00
Iain Buclaw
38258326dc libphobos: Re-add -fno-moduleinfo flag to dg-runtest [PR99812]
libphobos/ChangeLog:

	PR d/99812
	* testsuite/libphobos.druntime_shared/druntime_shared.exp: Re-add
	-fno-moduleinfo flag to dg-runtest.
	* testsuite/libphobos.phobos_shared/phobos_shared.exp: Likewise.
2021-04-10 15:02:06 +02:00
H.J. Lu
71958f740f x86: Define _serialize as macro
Define _serialize as macro for callers with general-regs-only target
attribute to avoid inline failure with always_inline attribute.

gcc/

	PR target/99744
	* config/i386/serializeintrin.h (_serialize): Defined as macro.

gcc/testsuite/

	PR target/99744
	* gcc.target/i386/pr99744-2.c: New test.
2021-04-10 05:59:09 -07:00
Jakub Jelinek
22aede7a12 expand: Fix up LTO ICE with COMPOUND_LITERAL_EXPR [PR99849]
The gimplifier optimizes away COMPOUND_LITERAL_EXPRs, but they can remain
in the form of ADDR_EXPR of COMPOUND_LITERAL_EXPRs in static initializers.
By the TREE_STATIC check I meant to check that the underlying decl of
the compound literal is a global rather than automatic variable which
obviously can't be referenced in static initializers, but unfortunately
with LTO it might end up in another partition and thus be DECL_EXTERNAL
instead.

2021-04-10  Jakub Jelinek  <jakub@redhat.com>

	PR lto/99849
	* expr.c (expand_expr_addr_expr_1): Test is_global_var rather than
	just TREE_STATIC on COMPOUND_LITERAL_EXPR_DECLs.

	* gcc.dg/lto/pr99849_0.c: New test.
2021-04-10 12:49:01 +02:00
Jakub Jelinek
3e350d8539 gimple-ssa-warn-alloca: Always initialize limit [PR99989]
This PR is about a -W*uninitialized warning on riscv64.
alloca_type_and_limit is documented to have limit member only defined
when type is ALLOCA_BOUND_MAYBE_LARGE or ALLOCA_BOUND_DEFINITELY_LARGE
and otherwise just default constructs limit, which for wide_int means
no initialization at all.  IMHO it is fine not to use the limit
member otherwise, but trying to not initialize it when it can be e.g.
copied around and then invoke UB doesn't look like a good idea.

2021-04-10  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/99989
	* gimple-ssa-warn-alloca.c
	(alloca_type_and_limit::alloca_type_and_limit): Initialize limit to
	0 with integer precision unconditionally.
2021-04-10 12:48:04 +02:00
Jakub Jelinek
7a493fcd27 rtlanal: Another fix for VOIDmode MEMs [PR98601]
This is a sequel to the PR85022 changes, inline-asm can (unfortunately)
introduce VOIDmode MEMs and in PR85022 they have been changed so that
we don't pretend we know their size (as opposed to assuming they have
zero size).

This time we ICE in rtx_addr_can_trap_p_1 because it assumes that
all memory but BLKmode has known size.  The patch just treats VOIDmode
MEMs like BLKmode in that regard.  And, the STRICT_ALIGNMENT change
is needed because VOIDmode has GET_MODE_SIZE of 0 and we don't want to
check if something is a multiple of 0.

2021-04-10  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/98601
	* rtlanal.c (rtx_addr_can_trap_p_1): Allow in assert unknown size
	not just for BLKmode, but also for VOIDmode.  For STRICT_ALIGNMENT
	unaligned_mems handle VOIDmode like BLKmode.

	* gcc.dg/torture/pr98601.c: New test.
2021-04-10 12:46:09 +02:00
Jan Hubicka
1c9744fb3b Do not release body of declare_variant_alt
gcc/ChangeLog:

2021-04-10  Jan Hubicka  <hubicka@ucw.cz>

	PR lto/99857
	* tree.c (free_lang_data_in_decl): Do not release body of
	declare_variant_alt.
2021-04-10 11:17:56 +02:00
Jason Merrill
1a19d334ce c++: deduction guide using alias [PR99180]
alias_ctad_tweaks was expecting that all deduction guides for the class
would be suitable for deduction from the alias definition; in this case, the
deduction guide uses 'true' and the alias B uses 'false', so deduction
fails.  But that's OK, we just don't use that deduction guide.  I also
noticed that we were giving up on deduction entirely if substitution failed
for some guide; we should only give up on that particular deduction guide.

We ought to give a better diagnostic about this case when deduction fails,
but that can wait.

gcc/cp/ChangeLog:

	PR c++/99180
	PR c++/93295
	PR c++/93867
	PR c++/99118
	PR c++/96873
	* pt.c (alias_ctad_tweaks): Handle failure better.

gcc/testsuite/ChangeLog:

	PR c++/99180
	PR c++/93295
	PR c++/93867
	PR c++/95486
	* g++.dg/cpp2a/class-deduction-alias5.C: New test.
	* g++.dg/cpp2a/class-deduction-alias6.C: New test.
	* g++.dg/cpp2a/class-deduction-alias7.C: New test.
	* g++.dg/cpp2a/class-deduction-alias8.C: New test.
2021-04-10 00:06:55 -04:00
Jason Merrill
e89055f90c c++: pack in base-specifier in lambda [PR100006]
Normally cp_parser_base_clause prevents unexpanded packs, but in a lambda
check_for_bare_parameter_packs allows it.  Then we weren't finding the
pack when scanning the lambda body.

This doesn't fix a valid variant like

  template <class... Ts> void sink (Ts&&...);
  template <class... Ts>
  void f() {
    sink ([] { struct S : Ts { }; }...);
  }
  int main() {
    f<int>();
  }

but that's a much bigger project.

gcc/cp/ChangeLog:

	PR c++/100006
	* pt.c (find_parameter_packs_r) [TAG_DEFN]: Look into bases.

gcc/testsuite/ChangeLog:

	PR c++/100006
	* g++.dg/cpp0x/lambda/lambda-variadic13.C: New test.
2021-04-10 00:06:55 -04:00
GCC Administrator
3115aba8d8 Daily bump. 2021-04-10 00:16:23 +00:00
Patrick Palka
b2576d75ed c++: Use a TEMPLATE_INFO to hold regenerated-lambda info
A TEMPLATE_INFO is a natural fit for what LAMBDA_EXPR_REGENERATED_FROM
and LAMBDA_EXPR_REGENERATING_TARGS hold, so let's use it instead.

gcc/cp/ChangeLog:

	* cp-tree.h (LAMBDA_EXPR_REGENERATED_FROM)
	(LAMBDA_EXPR_REGENERATING_TARGS): Replace these with ...
	(LAMBDA_EXPR_REGEN_INFO): ... this.
	(tree_lambda_expr::regenerated_from)
	(tree_lambda_expr::regenerating_targs): Replace these with ...
	(tree_lambda_expr::regen_info): ... this.
	* constraint.cc (satisfy_declaration_constraints): Adjust
	accordingly.
	* lambda.c (build_lambda_expr): Likewise.
	* pt.c (regenerated_lambda_fn_p): Likewise.
	(most_general_lambda): Likewise.
	(tsubst_lambda_expr): Likewise.
2021-04-09 17:03:04 -04:00
François Dumont
cc79682046 libstdc++: [_GLIBCXX_DEBUG] Fix management of __dp_sign_max_size [PR 99402]
__dp_sign precision indicates that we found out what iterator comes first or
last in the range. __dp_sign_max_size is the same plus it gives the information
of the max size of the range that is to say the max_size value such that
distance(lhs, rhs) < max_size.
Thanks to this additional information we are able to tell when a copy of n elements
to that range will fail even if we do not know exactly how large it is.

This patch makes sure that we are properly using this information.

libstdc++-v3/ChangeLog:

	PR libstdc++/99402
	* include/debug/helper_functions.h (__can_advance(_InputIterator,
	const std::pair<_Diff, _Distance_precision>&, int)): New.
	(__can_advance(const _Safe_iterator<>&,
	const std::pair<_Diff, _Distance_precision>&, int)): New.
	* include/debug/macros.h (__glibcxx_check_can_increment_dist): New,
	use latter.
	(__glibcxx_check_can_increment_range): Adapt to use latter.
	(__glibcxx_check_can_decrement_range): Likewise.
	* include/debug/safe_iterator.h
	(_Safe_iterator<>::_M_can_advance(const std::pair<_Diff, _Distance_precision>&,
	int)): New.
	(__can_advance(const _Safe_iterator<>&,
	const std::pair<_Diff, _Distance_precision>&, int)): New.
	* include/debug/safe_iterator.tcc
	(_Safe_iterator<>::_M_can_advance(const std::pair<_Diff, _Distance_precision>&,
	int)): New.
	(_Safe_iterator<>::_M_valid_range(const _Safe_iterator<>&,
	std::pair<difference_type, _Distance_precision>&, bool)): Adapt for
	__dp_sign_max_size.
	(__copy_move_a): Adapt to use __glibcxx_check_can_increment_dist.
	(__copy_move_backward_a): Likewise.
	(__equal_aux): Likewise.
	* include/debug/stl_iterator.h (__can_advance(const std::reverse_iterator<>&,
	const std::pair<_Diff, _Distance_precision>&, int)): New.
	(__can_advance(const std::move_iterator<>&,
	const std::pair<_Diff, _Distance_precision>&, int)): New.
	* testsuite/25_algorithms/copy/debug/99402.cc: New test.
2021-04-09 21:46:35 +02:00
Martin Sebor
b04093adb2 PR middle-end/55288 - Improve handling/suppression of maybe-uninitialized warnings
gcc/testsuite/ChangeLog:
	PR middle-end/55288
	* g++.dg/warn/uninit-pr55288.C: New test.
2021-04-09 11:40:48 -06:00
Richard Sandiford
1a5c82919c aarch64: Fix push/pop_options with --with-cpu
If a toolchain is configured with --with-cpu=X and gcc is
then run with an explicit -march=Y option, we ignore the
X cpu setting and tune for generic Y code:

  if (!selected_cpu)
    {
      if (selected_arch)
        {
------>   selected_cpu = &all_cores[selected_arch->ident];
          aarch64_isa_flags = arch_isa;
          explicit_arch = selected_arch->arch;
        }
      else
        {
          /* Get default configure-time CPU.  */
          selected_cpu = aarch64_get_tune_cpu (aarch64_none);
          aarch64_isa_flags = TARGET_CPU_DEFAULT >> 6;
        }

      if (selected_tune)
        explicit_tune_core = selected_tune->ident;
    }
  …
  if (!selected_tune)
    selected_tune = selected_cpu;

But after a push/pop_options pair, we simply did:

  selected_tune = aarch64_get_tune_cpu (ptr->x_explicit_tune_core);

In the above scenario, ptr->x_explicit_tune_core is aarch64_none,
so we fall back on the default configure-time CPU.  This means
that before the push_options we tuned for generic Y but after
the pop_options we tuned for X.

This was picked up by an assertion failure in cl_optimization_compare.
The ICE itself is a GCC 11 regression, but the problem that it shows
up is much older.

gcc/
	* config/aarch64/aarch64.c (aarch64_option_restore): If the
	architecture was specified explicitly and the tuning wasn't,
	tune for the architecture rather than the configured default CPU.
2021-04-09 18:24:00 +01:00
Patrick Palka
00c3c31be4 c++: Add testcase for already fixed PR [PR90215]
We accept this testcase after r11-7985.

gcc/testsuite/ChangeLog:

	PR c++/90215
	* g++.dg/cpp1z/fold-lambda4.C: New test.
2021-04-09 11:37:42 -04:00
Thomas Schwinge
ffa0ae6eee Add 'libgomp.oacc-c-c++-common/static-variable-1.c' [PR84991, PR84992, PR90779]
libgomp/
	PR middle-end/84991
	PR middle-end/84992
	PR middle-end/90779
	* testsuite/libgomp.oacc-c-c++-common/static-variable-1.c: New.
2021-04-09 17:28:32 +02:00
Marek Polacek
625dadaf5d c++: Fix two issues with auto function parameter [PR99806]
When we have a member function with auto parameter like this:

  struct S {
    void f(auto);
  };

cp_parser_member_declaration -> grokfield produces a FUNCTION_DECL
"void S::foo(auto:1)", and then finish_fully_implicit_template turns
that FUNCTION_DECL into a TEMPLATE_DECL.  The bug here is that we only
call cp_parser_save_default_args for a FUNCTION_DECL.  As a consequence,
abbrev10.C is rejected because we complain that the default argument has
not been defined, and abbrev11.C ICEs, because we don't re-parse the
delayed noexcept, so the DEFERRED_PARSE tree leaks into tsubst* where we
crash.  This patch fixes both issues.

gcc/cp/ChangeLog:

	PR c++/99806
	* parser.c (cp_parser_member_declaration): Call
	cp_parser_save_default_args even for function templates.  Use
	STRIP_TEMPLATE on the declaration we're passing.

gcc/testsuite/ChangeLog:

	PR c++/99806
	* g++.dg/concepts/abbrev10.C: New test.
	* g++.dg/concepts/abbrev11.C: New test.
2021-04-09 10:23:30 -04:00
Richard Sandiford
2dd7c570e6 testsuite: Guard gcc.target/aarch64/pr70398.c
Not all hosts can link static executables.  It depends on which
development libraries are installed.

gcc/testsuite/
	* gcc.target/aarch64/pr70398.c: Require a target that can link
	static executables.
2021-04-09 13:43:20 +01:00