Commit Graph

192409 Commits

Author SHA1 Message Date
Richard Sandiford
14814e2016 aarch64: Fix -fpack-struct + <arm_neon.h> [PR103147]
This PR is about -fpack-struct causing a crash when <arm_neon.h>
is included.  The new register_tuple_type code was expecting a
normal unpacked structure layout instead of a packed one.

For SVE we got around this by temporarily suppressing -fpack-struct,
so that the tuple types always have their normal ABI.  However:

(a) The SVE ACLE tuple types are defined to be abstract.  The fact
    that GCC uses structures is an internal implementation detail.

(b) In contrast, the ACLE explicitly defines the Advanced SIMD
    tuple types to be particular structures.

(c) Clang and previous versions of GCC are consistent in applying
    -fpack-struct to these tuple structures.

This patch therefore honours -fpack-struct and -fpack-struct=.  It also
adds tests for some other combinations, such as -mgeneral-regs-only and
-fpack-struct -mstrict-align.

gcc/
	PR target/103147
	* config/aarch64/aarch64-protos.h (aarch64_simd_switcher): New class.
	* config/aarch64/aarch64-sve-builtins.h (sve_switcher): Inherit
	from aarch64_simd_switcher.
	* config/aarch64/aarch64-builtins.cc (aarch64_simd_tuple_modes):
	New variable.
	(aarch64_lookup_simd_builtin_type): Use it instead of TYPE_MODE.
	(register_tuple_type): Add more asserts.  Expect the alignment
	of the structure to be subject to flag_pack_struct and
	maximum_field_alignment.  Set aarch64_simd_tuple_modes.
	(aarch64_simd_switcher::aarch64_simd_switcher): New function.
	(aarch64_simd_switcher::~aarch64_simd_switcher): Likewise.
	(handle_arm_neon_h): Hold an aarch64_simd_switcher throughout.
	(aarch64_general_init_builtins): Hold an aarch64_simd_switcher
	while calling aarch64_init_simd_builtins.
	* config/aarch64/aarch64-sve-builtins.cc (sve_switcher::sve_switcher)
	(sve_switcher::~sve_switcher): Remove code now performed by
	aarch64_simd_switcher.

gcc/testsuite/
	PR target/103147
	* gcc.target/aarch64/pr103147-1.c: New test.
	* gcc.target/aarch64/pr103147-2.c: Likewise.
	* gcc.target/aarch64/pr103147-3.c: Likewise.
	* gcc.target/aarch64/pr103147-4.c: Likewise.
	* gcc.target/aarch64/pr103147-5.c: Likewise.
	* gcc.target/aarch64/pr103147-6.c: Likewise.
	* gcc.target/aarch64/pr103147-7.c: Likewise.
	* gcc.target/aarch64/pr103147-8.c: Likewise.
	* gcc.target/aarch64/pr103147-9.c: Likewise.
	* gcc.target/aarch64/pr103147-10.c: Likewise.
	* g++.target/aarch64/pr103147-1.C: Likewise.
	* g++.target/aarch64/pr103147-2.C: Likewise.
	* g++.target/aarch64/pr103147-3.C: Likewise.
	* g++.target/aarch64/pr103147-4.C: Likewise.
	* g++.target/aarch64/pr103147-5.C: Likewise.
	* g++.target/aarch64/pr103147-6.C: Likewise.
	* g++.target/aarch64/pr103147-7.C: Likewise.
	* g++.target/aarch64/pr103147-8.C: Likewise.
	* g++.target/aarch64/pr103147-9.C: Likewise.
	* g++.target/aarch64/pr103147-10.C: Likewise.
2022-04-05 17:31:35 +01:00
Richard Sandiford
e8bc70cc17 aarch64: Use error_n for plural text [PR104897]
Use error_n rather than error_at for “%d vectors”, so that
translators can pick different translations based on the
number (2 vs more than 2, etc.)

gcc/
	PR target/104897
	* config/aarch64/aarch64-sve-builtins.cc
	(function_resolver::infer_vector_or_tuple_type): Use error_n
	for "%d vectors" messages.
2022-04-05 17:31:35 +01:00
Jason Merrill
5d583d2420 c++: alias template equivalence and CTAD [PR103852]
I had been thinking about DR1286 "equivalence" as meaning generally
interchangeable, but looking back at the proposed resolution in the context
of this PR, I see that it's just about use as a template argument.  So let's
give a pedwarn if we look through a renaming alias.

	PR c++/103852
	DR 1286

gcc/cp/ChangeLog:

	* pt.cc (do_class_deduction): Pedwarn for renaming alias in C++17.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1z/class-deduction-alias1.C: Expect warning.
2022-04-05 12:29:33 -04:00
Jason Merrill
1de6612d99 c++: elaborated-type-spec in requires-expr [PR101677]
We were failing to declare class S in the global namespace because we were
treating the requires-expression parameter scope as a normal block scope, so
the implicit declaration went there.

It seems to me that the requires parameter scope is more like a function
parameter scope (not least in the use of the word "parameter"), so let's
change the scope kind.  But then we need to adjust the prohibition on
placeholders declaring implicit template parameters.

	PR c++/101677

gcc/cp/ChangeLog:

	* name-lookup.h (struct cp_binding_level): Add requires_expression
	bit-field.
	* parser.cc (cp_parser_requires_expression): Set it.
	(synthesize_implicit_template_parm): Check it.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/concepts-pr67178.C: Adjust error.
	* g++.dg/cpp2a/concepts-requires28.C: New test.
2022-04-05 12:28:59 -04:00
Jason Merrill
5c8d22b00a c++: adjust testcase
This test was failing with -std=c++23 -fimplicit-constexpr (not tested by
default) due to different wording in the error message.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/noexcept34.C: Allow more wording variation.
2022-04-05 12:21:36 -04:00
Chung-Lin Tang
b0af8e3a50 OpenMP: Fix nested use_device_ptr
This patch fixes a bug in lower_omp_target, where for Fortran arrays,
the expanded sender assignment is wrongly using the variable in the
current ctx, instead of the one looked-up outside, which is causing
use_device_ptr/addr to fail to work when used inside an omp-parallel
(where the omp child_fn is split away from the original).

The fix is inside omp-low.cc, though because the omp_array_data langhook
is used only by Fortran, this is essentially Fortran-specific.

2022-04-05  Chung-Lin Tang  <cltang@codesourcery.com>

gcc/ChangeLog:

	* omp-low.cc (lower_omp_target): Use outer context looked-up 'var' as
	argument to lang_hooks.decls.omp_array_data, instead of 'ovar' from
	current clause.

libgomp/ChangeLog:

	* testsuite/libgomp.fortran/use_device_ptr-4.f90: New testcase.
2022-04-05 08:31:34 -07:00
Richard Biener
e68f5c90ba c/105151 - move early walloca pass
When the walloca pass gained support for ranger the early pass
was not moved to a place where SSA form is available but remained
in the lowering pipeline.  For the testcase in this bug this is
a problem because for errorneous input we still run the lowering
pipeline but here have broken SSA form which ranger does not like.
The solution is to rectify the mistake with using ranger without
SSA form and move the pass which solves both issues.

2022-04-05  Richard Biener  <rguenther@suse.de>

	PR c/105151
	* passes.def (pass_walloca): Move early instance into
	pass_build_ssa_passes to make SSA form available.

	* gcc.dg/gimplefe-error-14.c: New testcase.
2022-04-05 09:54:46 +02:00
Robin Dapp
2874772c4b testsuite/s390: Adapt test expections.
Some tests expect a convert instruction but nowadays
(r12-4475-g247c407c83f001) the conversion is already done at compile
time.  This results in a literal-pool load.  Change the tests accordingly.

gcc/testsuite/ChangeLog:

	* gcc.target/s390/zvector/vec-double-compile.c: Expect vl
	  instead of vc*.
	* gcc.target/s390/zvector/vec-float-compile.c: Dito.
	* gcc.target/s390/zvector/vec-signed-compile.c: Dito.
	* gcc.target/s390/zvector/vec-unsigned-compile.c: Dito.
2022-04-05 08:43:45 +02:00
Robin Dapp
042f853466 testsuite/s390: Change nle -> h in ifcvt tests.
We have been emitting the "higher" variantes instead of the "not less or equal"
ones for a while.  Change the test expectations accordingly.

gcc/testsuite/ChangeLog:

	* gcc.target/s390/ifcvt-two-insns-bool.c: Change nle to h.
	* gcc.target/s390/ifcvt-two-insns-int.c: Dito.
	* gcc.target/s390/ifcvt-two-insns-long.c: Dito.
2022-04-05 08:43:45 +02:00
Robin Dapp
321d1dcf61 testsuite: Add -fno-tree-loop-distribute-patterns.
In gcc.dg/Wuse-after-free-2.c we try to detect a use-after-free.  The
test's while loop is converted into a rawmemchr builtin making
it impossible to determine that the pointers *p and *q are related.

Therefore, disable the tree loop distribute patterns pass for this test.

gcc/testsuite/ChangeLog:

	* gcc.dg/Wuse-after-free-2.c:
	Add -fno-tree-loop-distribute-patterns in order to avoid
	rawmemchr.
2022-04-05 08:43:39 +02:00
liuhongt
e3174d6183 Split vector load from parm_del to elemental loads to avoid STLF stalls.
Since cfg is freed before machine_reorg, just do a rough calculation
of the window according to the layout.
Also according to an experiment on CLX, set window size to 64.

Currently only handle V2DFmode load since it doesn't need any scratch
registers, and it's sufficient to recover cray performance for -O2
compared to GCC11.

gcc/ChangeLog:

	PR target/101908
	* config/i386/i386.cc (ix86_split_stlf_stall_load): New
	function
	(ix86_reorg): Call ix86_split_stlf_stall_load.
	* config/i386/i386.opt (-param=x86-stlf-window-ninsns=): New
	param.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr101908-1.c: New test.
	* gcc.target/i386/pr101908-2.c: New test.
	* gcc.target/i386/pr101908-3.c: New test.
2022-04-05 12:51:37 +08:00
Alexandre Oliva
418967ca27 try multi-reg dest in default_zero_call_used_regs
When the mode of regno_reg_rtx is not hard_regno_mode_ok for the
target, try grouping the register with subsequent ones.  This enables
s16 to s31 and their hidden pairs to be zeroed with the default logic
on some arm variants.


for  gcc/ChangeLog

	* targhooks.cc (default_zero_call_used_regs): Attempt to group
	regs that the target refuses to use in their natural modes.
	(zcur_select_mode_rtx): New.
	* regs.h (struct target_regs): Add x_hard_regno_max_nregs.
	(hard_regno_max_nregs): Define.
	* reginfo.cc (init_reg_modes_target): Set hard_regno_max_nregs.
2022-04-05 01:28:20 -03:00
GCC Administrator
5e09bb1b2e Daily bump. 2022-04-05 00:16:20 +00:00
Joseph Myers
d8ac63e4c6 Update gcc sv.po
* sv.po: Update.
2022-04-04 20:02:16 +00:00
Alex Coplan
74e243ec99 doc: Fix typos in match.pd documentation
This patch fixes some spelling and grammar issues in the match.pd
documentation.

gcc/ChangeLog:

	* doc/match-and-simplify.texi: Fix typos.
2022-04-04 17:41:53 +01:00
Jason Merrill
3afc7c4eea c++: repeated friend template [PR101894]
Since olddecl isn't a definition, it doesn't get DECL_FRIEND_CONTEXT, so we
need to copy it from newdecl when we merge the declarations.

	PR c++/101894

gcc/cp/ChangeLog:

	* decl.cc (duplicate_decls): Copy DECL_FRIEND_CONTEXT.

gcc/testsuite/ChangeLog:

	* g++.dg/lookup/friend22.C: New test.
2022-04-04 10:44:06 -04:00
Jason Merrill
a11f204e5a c++: alias-tmpl equivalence and default targs [PR103852]
The suggested resolution for CWG1286, which we implemented, ignores default
template arguments, but this PR is an example of why that doesn't make
sense: the templates aren't functionally equivalent.

	PR c++/103852
	DR 1286

gcc/cp/ChangeLog:

	* pt.cc (get_underlying_template): Compare default template args.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/alias-decl-dr1286a.C: Default args now matter.
	* g++.dg/cpp1z/class-deduction-alias1.C: New test.
2022-04-04 10:43:33 -04:00
Jakub Jelinek
2f0610acbc aarch64: Restrict aarch64-tune.md regeneration to --enable-maintainer-mode [PR105144]
Normally updates to the source directory files are guarded with
--enable-maintainer-mode, e.g. we don't regenerate configure, config.h,
Makefile.in in directories that use automake etc. unless gcc is configured
that way.  Otherwise the source tree can't be e.g. stored on a read-only
filesystem etc.
In gcc/Makefile.in we use @MAINT@ for that but that works because
gcc/Makefile is generated by configure.  In config/*/t-* files we need to
check $(ENABLE_MAINTAINER_RULES):
 # The following provides the variable ENABLE_MAINTAINER_RULES that can
 # be used in language Make-lang.in makefile fragments to enable
 # maintainer rules.  So, ENABLE_MAINTAINER_RULES is 'true' in
 # maintainer mode, and '' otherwise.
 @MAINT@ ENABLE_MAINTAINER_RULES = true

On Mon, Apr 04, 2022 at 11:10:14AM +0100, Richard Sandiford wrote:
> I guess the risk is that it will become even easier to forget
> to commit an updated aarch64-tune.md.  Perhaps we should have a
> non-maintainer rule to build aarch64-tune.md locally and check it
> against the source-directory version, and fail the build if there's
> a mismatch.  Or maybe we should just generate aarch64-tune.md in the
> build directory and remove the source directory version.

I've tried if aarch64-tune.md will be read from the build dir, but it is
not.  The gen* files can use -I options to add additional directories, but
they don't use them.

Here is a variant patch which will complain and fail if there is a change
and --enable-maintainer-mode is not enabled.

2022-04-04  Jakub Jelinek  <jakub@redhat.com>

	PR target/105144
	* config/aarch64/t-aarch64 (s-aarch64-tune-md): Do move-if-change
	only if configured with --enable-maintainer-mode, otherwise compare
	tmp-aarch64-tune.md with $(srcdir)/config/aarch64/aarch64-tune.md and
	if they differ, emit a message and fail.
2022-04-04 13:56:32 +02:00
Tom de Vries
88cffa1a07 [libgomp/testsuite] Fix libgomp.fortran/examples-4/declare_target-{1,2}.f90
The test-cases libgomp.fortran/examples-4/declare_target-{1,2}.f90 mean to
set an nvptx-specific limit using offload_target_nvptx, but also change
behaviour for amd.

That is, there is now a difference in behaviour between:
- a compiler configured for GCN offloading, and
- a compiler configured for both GCN and nvptx offloading.

Fix this by using instead on_device_arch_nvptx.

Tested on x86_64 with nvptx accelerator.

libgomp/ChangeLog:

2022-04-04  Tom de Vries  <tdevries@suse.de>

	* testsuite/libgomp.fortran/examples-4/declare_target-1.f90: Use
	on_device_arch_nvptx instead of offload_target_nvptx.
	* testsuite/libgomp.fortran/examples-4/declare_target-2.f90: Same.
2022-04-04 13:37:19 +02:00
Jakub Jelinek
376cf6d19c aarch64: Fix aarch64-tune.md (re)generation [PR105144]
As I wrote in the PR, our Fedora trunk gcc builds likely after r12-7842
change are now failing (lto1 crashes).
What happens is that when one bootstraps into an empty build directory
(or set of them), mddeps.mk doesn't exist yet and so Makefile doesn't
include it.  When building from an empty dir, that is usually not a big
issue, it is enough when various build directory files depend on just
$(srcdir)/config/aarch64/aarch64.md, those files don't exist and
aarch64.md does, so they are built, so is mddeps.mk.
But because the other dependencies aren't there (in particular
$(srcdir)/config/aarch64/aarch64-tune.md ), the
s-aarch64-tune-md rule isn't invoked to regenerate that file and the
r12-7842 commit reordered aarch64-cores.def entries but didn't commit
regenerated aarch64-tune.md.  Because it is just reordering in
aarch64-tune.md, it actually doesn't matter and bootstraps succeeds.
But then during make install, mddeps.mk exists already in gcc/ directory,
it sees that aarch64-cores.def is newer than aarch64-tune.md (unless
gen_update is used, that just touches aarch64-tune.md to make sure it
is newer) and regenerates it and as it is different, make install rebuilds
a large subset of the *.o files, but this time with the system g++
rather than previous stage one.  And during lto linking of it there
are differences in LTO bytecode between the compilers and we crash.

The following patch fixes that by regenerating aarch64-tune.md
(what was forgotten in r12-7842) and by adding a dependency from
s-mddeps to s-aarch64-tune-md, which makes sure that even when mddeps.mk
doesn't exist yet make sees the dependency and regenerates aarch64-tune.md
if needed.

2022-04-04  Jakub Jelinek  <jakub@redhat.com>

	PR target/105144
	* config/aarch64/t-aarch64 (s-mddeps): Depend on s-aarch64-tune-md.
	* config/aarch64/aarch64-tune.md: Regenerated.
2022-04-04 12:09:26 +02:00
Richard Biener
3eda57b4ae tree-optimization/105132 - add missing checking in vectorizable_operation
The following adds missing verification that the input vectors
have the same number of elements for vectorizable_operation.

2022-04-04  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/105132
	* tree-vect-stmts.cc (vectorizable_operation): Check that
	the input vectors have the same number of elements.

	* gcc.dg/torture/pr105132.c: New testcase.
2022-04-04 11:34:25 +02:00
Richard Biener
eaaf77dd85 middle-end/105140 - fix bogus recursion in fold_convertible_p
fold_convertible_p expects an operand and a type to convert to
but recurses with two vector component types.  Fixed by allowing
types instead of an operand as well.

2022-04-04  Richard Biener  <rguenther@suse.de>

	PR middle-end/105140
	* fold-const.cc (fold_convertible_p): Allow a TYPE_P arg.

	* gcc.dg/pr105140.c: New testcase.
2022-04-04 11:34:25 +02:00
Iain Buclaw
f6b786d749 d: Compile simd_ctfe.d only on avx_runtime or vect_sizes_16B_8B targets
PR d/104740

gcc/testsuite/ChangeLog:

	* gdc.dg/simd_ctfe.d: Compile with target avx_runtime or
	vect_sizes_16B_8B.
2022-04-04 11:21:44 +02:00
Martin Liska
447ac3c570 Add ChangeLog entries for 86d8e0c065.
gcc/cp/ChangeLog:

	* ChangeLog: Add entry for
	86d8e0c065.

gcc/testsuite/ChangeLog:

	* ChangeLog: Add entry for
	86d8e0c065.
2022-04-04 10:19:35 +02:00
GCC Administrator
8af4270d3f Daily bump. 2022-04-04 08:00:40 +00:00
Martin Liska
865e36a08b gcc-changelog: ignore one more revision
Ignore:

Checking 86d8e0c065: FAILED
ERR: line should start with a tab: "This reverts commits r12-7804 and r12-7929."
ERR: could not deduce ChangeLog file

contrib/ChangeLog:

	* gcc-changelog/git_update_version.py: Ignore the revision.
2022-04-04 09:37:15 +02:00
Jeff Law
0364465e37 [committed][PR target/104987] Avoid "likely" forms of bbi[n] on iq2000.
The iq2000 port is mis-compiling its mulsi3 libgcc2 function.

AFAICT, the iq2000 has delay slots and can use "branch-likely" forms of conditional branches to annul-false the slot.   There's a support routine that handles creation of the  likely form.  However, that routine is not used by the bbi[n] instructions.

If I manually add the likely extension to the bbi[b] instructions, the assembler complains  After a fair amount of digging it appears that the likely forms of bbi[n] are only supported on the IQ10 variant.

Given this is a dead processor and has been so for a while it seems reasonable to just disallow annul-false slots for the bbi[n] instructions rather than try to handle them just for the IQ10 (which we don't have real support for anyway).

This (of course) fixes the vrp13 regression.  But it also fixes nearly a thousand execution test failures in the testsuite (Yow!).

gcc/
	PR target/104987
	* config/iq2000/iq2000.md (bbi): New attribute,  default to no.
	(delay slot descripts): Use different delay slot description when
	the insn as the "bbi" attribute.
	(bbi, bbin patterns): Set the bbi attribute to yes.
2022-04-03 18:24:23 -04:00
Jakub Jelinek
e1a74058b7 i386: Fix up ix86_expand_vector_init_general [PR105123]
The following testcase is miscompiled on ia32.
The problem is that at -O0 we end up with:
  vector(4) short unsigned int _1;
  short unsigned int u.0_3;
...
  _1 = {u.0_3, u.0_3, u.0_3, u.0_3};
statement (dead) which is wrongly expanded.
elt is (subreg:HI (reg:SI 83 [ u.0_3 ]) 0), tmp_mode SImode,
so after convert_mode we start with word (reg:SI 83 [ u.0_3 ]).
The intent is to manually broadcast that value to 2 SImode parts,
but because we pass word as target to expand_simple_binop, it will
overwrite (reg:SI 83 [ u.0_3 ]) and we end up with 0:
   10: {r83:SI=r83:SI<<0x10;clobber flags:CC;}
   11: {r83:SI=r83:SI|r83:SI;clobber flags:CC;}
   12: {r83:SI=r83:SI<<0x10;clobber flags:CC;}
   13: {r83:SI=r83:SI|r83:SI;clobber flags:CC;}
   14: clobber r110:V4HI
   15: r110:V4HI#0=r83:SI
   16: r110:V4HI#4=r83:SI
as the two ors do nothing and two shifts each by 16 left shift it all
away.
The following patch fixes that by using NULL_RTX target, so we expand it as
   10: {r110:SI=r83:SI<<0x10;clobber flags:CC;}
   11: {r111:SI=r110:SI|r83:SI;clobber flags:CC;}
   12: {r112:SI=r83:SI<<0x10;clobber flags:CC;}
   13: {r113:SI=r112:SI|r83:SI;clobber flags:CC;}
   14: clobber r114:V4HI
   15: r114:V4HI#0=r111:SI
   16: r114:V4HI#4=r113:SI
instead.

Another possibility would be to pass NULL_RTX only when word == elt
and word otherwise, where word would necessarily be a pseudo from the first
shift after passing NULL_RTX there once or pass NULL_RTX for the shift and
word for ior.

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

	PR target/105123
	* config/i386/i386-expand.cc (ix86_expand_vector_init_general): Avoid
	using word as target for expand_simple_binop when doing ASHIFT and
	IOR.

	* gcc.target/i386/pr105123.c: New test.
2022-04-03 21:50:43 +02:00
Iain Buclaw
243e649dcb d: Remove Wtemplates warnings from the code generation pass
These have been superceded by the front-end's own internal tracking of
instantiations, exposed by `-ftransition=templates'.

gcc/d/ChangeLog:

	* d-lang.cc: Include dmd/template.h.
	(d_parse_file): Call printTemplateStats when vtemplates is set.
	* decl.cc (start_function): Remove OPT_Wtemplates warning.
	* lang.opt (Wtemplates): Remove.
2022-04-03 15:16:39 +02:00
Benno Evers
0847ad33b9 c++: Fix ICE due to shared BLOCK node in coroutine generation [PR103328]
When finishing a function that is a coroutine, the function is
transformed into a "ramp" function, and the original user-provided
function body gets moved into a newly created "actor" function.

In this case `current_function_decl` points to the ramp function,
but `current_binding_level->blocks` would still point to the
scope block of the user-provided function body in the actor function,
so when the ramp function was finished during `poplevel()` in decl.cc,
we could end up with that block being reused as the `DECL_INITIAL()` of
the ramp function:

   subblocks = functionbody >= 0 ? current_binding_level->blocks : 0;
   // [...]
   DECL_INITIAL (current_function_decl) = block ? block : subblocks;

This block would then be independently modified by subsequent passes
touching either the ramp or the actor function, potentially causing
an ICE depending on the order and function of these passes.

gcc/cp/ChangeLog:

	PR c++/103328
	* coroutines.cc (morph_fn_to_coro): Reset
	current_binding_level->blocks.

gcc/testsuite/ChangeLog:

	PR c++/103328
	* g++.dg/coroutines/pr103328.C: New test.

Co-Authored-By: Iain Sandoe <iain@sandoe.co.uk>
2022-04-03 10:10:13 +01:00
Iain Buclaw
235d5a96cb d: Merge upstream dmd 47871363d, druntime, c52e28b7, phobos 99e9c1b77.
D front-end changes:

    - Import dmd v2.099.1-beta.1.
    - The address of NRVO variables is now stored in scoped closures
      when they have nested references.
    - Using `__traits(parameters)' in foreach loops now always returns
      the parameters to the function the foreach appears within.
      Previously, when used inside a `foreach' using an overloaded
      `opApply', the trait would yield the parameters to the delegate.
    - The deprecation period of unannotated `asm' blocks has been ended.
    - The `inout' attribute no longer implies the `return' attribute.
    - Added new `D_PreConditions', `D_PostConditions', and
      `D_Invariants' version identifiers.

D runtime changes:

    - Import druntime v2.099.1-beta.1.

Phobos changes:

    - Import phobos v2.099.1-beta.1.
    - `Nullable' in `std.typecons' can now act as a range.
    - std.experimental.logger default level changed to `info' instead of
      `warning'.

gcc/d/ChangeLog:

	* dmd/MERGE: Merge upstream dmd 47871363d.
	* d-builtins.cc (d_init_versions): Add predefined version identifiers
	D_PreConditions, D_PostConditions, and D_Invariants.
	* d-codegen.cc (d_build_call): Update for new front-end interface.
	(build_frame_type): Generate reference field for NRVO variables with
	nested references.
	(build_closure): Generate assignment of return address to closure.
	* d-tree.h (DECL_INSTANTIATED): Use DECL_LANG_FLAG_2.
	(bind_expr): Remove.
	* decl.cc (DeclVisitor::visit (FuncDeclaration *)): Update for new
	front-end interface.
	(get_symbol_decl): Likewise.
	(get_decl_tree): Check DECL_LANG_FRAME_FIELD before DECL_LANG_NRVO.
	Dereference the field when both are set.
	* expr.cc (ExprVisitor::visit (DeleteExp *)): Update for new front-end
	interface.
	* modules.cc (get_internal_fn): Likewise.
	* toir.cc (IRVisitor::visit (ReturnStatement *)): Likewise.

libphobos/ChangeLog:

	* libdruntime/MERGE: Merge upstream druntime c52e28b7.
	* libdruntime/Makefile.am (DRUNTIME_DSOURCES_OPENBSD): Add
	core/sys/openbsd/pwd.d.
	* libdruntime/Makefile.in: Regenerate.
	* src/MERGE: Merge upstream phobos 99e9c1b77.
	* testsuite/libphobos.exceptions/message_with_null.d: New test.

gcc/testsuite/ChangeLog:

	* gdc.dg/nrvo1.d: New test.
2022-04-02 23:56:52 +02:00
Xi Ruoyao
be07535d0f
mips: Fix an ICE caused by r12-7962
DECL_SIZE(x) is NULL if x is a flexible array member, but I forgot to
check it in r12-7962.  Then if we increase the size of a struct with
flexible array member (by using aligned attribute), the code will
dereference NULL trying to use the "size" of the flexible array member.

gcc/

	* config/mips/mips.cc (mips_function_arg): Check if DECL_SIZE is
	NULL before dereferencing it.

gcc/testsuite/

	* gcc.target/mips/pr102024-4.c: New test.
2022-04-02 19:16:03 +08:00
Jakub Jelinek
2a82301d40 libstdc++: Tweak source_location for clang trunk [PR105128]
Apparently clang trunk implemented __builtin_source_location(), but the
using __builtin_ret_type = decltype(__builtin_source_location());
which has been added for it isn't enough, they also need the
std::source_location::__impl class to be defined (but incomplete seems
to be good enough) before the builtin is used.

The following has been tested on godbolt with clang trunk (old version
fails with
error: 'std::source_location::__impl' was not found; it must be defined before '__builtin_source_location' is called
and some follow-up errors), getting back to just void * instead of
__builtin_ret_type and commenting out using doesn't work either and
just struct __impl; before using __builtin_ret_type doesn't work too.

2022-04-02  Jakub Jelinek  <jakub@redhat.com>

	PR libstdc++/105128
	* include/std/source_location (std::source_location::__impl): Move
	definition before using __builtin_ret_type.
2022-04-02 12:49:38 +02:00
Alexandre Oliva
f0ccbe10f1 fixed-point/composite-type: add -Wno-array-parameter
On machines that support fixed-point and the test runs, it's failing
because of warnings issued by -Warray-parameter=[12], enabled by
-Wall.

The warnings state "mismatch in bound 1 of argument 1 declared as...",
referring to the redeclaration of f2_##NAME.  The purpose of the
redeclaration is not clear to me.

It doesn't look like the test intends to catch mismatches between
parameter's array lengths, despite the explicit array bound and the
incompatible calls, so I'm adding -Wno-array-parameter to avoid this
distraction and enable the test to pass.


for gcc/testsuite/ChangeLog

	* gcc.dg/fixed-point/composite-type.c: Add -Wno-array-parameter.
2022-04-01 23:18:34 -03:00
Patrick Palka
95533fe4f0 c++: deducing from class type of NTTP [PR105110]
Here when attempting to deduce T in the NTTP type A<T> from the argument
type 'const A<int>', we give up due to the const:

  types ‘A<T>’ and ‘const A<int>’ have incompatible cv-qualifiers

But since the type of an NTTP cannot be cv-qualified, it seems natural
to ignore cv-qualifiers on the argument type before attempting to unify
the two types.

	PR c++/105110

gcc/cp/ChangeLog:

	* pt.cc (unify) <case TEMPLATE_PARM_INDEX>: Drop cv-quals from
	the argument type of an NTTP before deducing from it.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/nontype-class52.C: New test.
2022-04-01 14:56:20 -04:00
Joseph Myers
e9ea121da7 Regenerate gcc.pot
* gcc.pot: Regenerate.
2022-04-01 17:32:15 +00:00
Joseph Myers
c742a8688f Update gcc hr.po
* hr.po: Update.
2022-04-01 17:27:27 +00:00
Qing Zhao
31933f4f78 Add an assertion: the zeroed_hardregs set is a subset of all call used regs.
We should make sure that the hard register set that is actually cleared by
the target hook zero_call_used_regs should be a subset of all call used
registers.

At the same time, update documentation for the target hook
TARGET_ZERO_CALL_USED_REGS.

This new assertion identified a bug in the i386 implemenation, which
incorrectly set the zeroed_hardregs for stack registers. Fixed this bug
in i386 implementation.

gcc/ChangeLog:

2022-04-01  Qing Zhao  <qing.zhao@oracle.com>

	* config/i386/i386.cc (zero_all_st_registers): Return the value of
	num_of_st.
	(ix86_zero_call_used_regs): Update zeroed_hardregs set according to
	the return value of zero_all_st_registers.
	* doc/tm.texi: Update the documentation of TARGET_ZERO_CALL_USED_REGS.
	* function.cc (gen_call_used_regs_seq): Add an assertion.
	* target.def: Update the documentation of TARGET_ZERO_CALL_USED_REGS.
2022-04-01 16:09:43 +00:00
Xi Ruoyao
413187b0b3
mips: Ignore zero width fields in arguments and issue -Wpsabi warning about C zero-width field ABI changes [PR102024]
gcc/
	PR target/102024
	* config/mips/mips.cc (mips_function_arg): Ignore zero-width
	fields, and inform if it causes a psABI change.

gcc/testsuite/
	PR target/102024
	* gcc.target/mips/pr102024-1.c: New test.
	* gcc.target/mips/pr102024-2.c: New test.
	* gcc.target/mips/pr102024-3.c: New test.
2022-04-01 22:37:58 +08:00
Xi Ruoyao
0d4b97f1ee
mips: Emit psabi diagnostic for return values affected by C++ zero-width bit-field ABI change [PR 102024]
gcc/
	PR target/102024
	* config/mips/mips.cc (mips_fpr_return_fields): Detect C++
	zero-width bit-fields and set up an indicator.
	(mips_return_in_msb): Adapt for mips_fpr_return_fields change.
	(mips_function_value_1): Diagnose when the presense of a C++
	zero-width bit-field changes function returning in GCC 12.

gcc/testsuite/
	PR target/102024
	* g++.target/mips/mips.exp: New test supporting file.
	* g++.target/mips/pr102024.C: New test.
2022-04-01 22:37:43 +08:00
Jason Merrill
86d8e0c065 Revert "c++: delayed parse DMI [PR96645]"
The breakage from r12-7804 (in WebKit, particularly) is more of a can of
worms than I think we can address in GCC 12, so let's return to the GCC 11
status quo for now and try again in stage 1.

I think the change was correct for the current standard, but the standard
needs a fix in this area; this is CWG issue 2335.

	PR c++/96645

This reverts commits r12-7804 and r12-7929.
2022-04-01 10:00:26 -04:00
David Malcolm
1a172da8a3 jit: further doc fixes
Further jit doc fixes, which fix links to
gcc_jit_function_type_get_param_type and gcc_jit_struct_get_field.

gcc/jit/ChangeLog:
	* docs/topics/expressions.rst: Fix formatting.
	* docs/topics/types.rst: Likewise.
	* docs/_build/texinfo/libgccjit.texi: Regenerate

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-04-01 09:19:41 -04:00
Petter Tomner
aed0f01478 jit: Update docs
Update docs concerning linking and fix formatting errors.

gcc/jit/ChangeLog:
	* docs/topics/compatibility.rst: Add 19 tag
	* docs/topics/compilation.rst: Linking
	* docs/topics/contexts.rst: Linking example
	* docs/topics/expressions.rst: Fix formatting and dropped 's'

Signed-off-by: Petter Tomner	2022-02-19	<tomner@kth.se>
2022-04-01 09:17:00 -04:00
Jonathan Wakely
babaabbcc8 libstdc++: Implement std::unreachable() for C++23 (P0627R6)
This defines std::unreachable as an assertion for debug mode, a trap
when _GLIBCXX_ASSERTIONS is defined, and __builtin_unreachable()
otherwise.

The reason for only using __builtin_trap() in the second case is to
avoid the overhead of setting up a call to __glibcxx_assert_fail that
should never happen.

UBsan can detect if __builtin_unreachable() is executed, so if a feature
test macro for that sanitizer is added, we could change just use
__builtin_unreachable() when the sanitizer is enabled.

While thinking about what the debug assertion failure should print, I
noticed that the __glibcxx_assert_fail function doesn't check for null
pointers. This adds a check so we don't try to print them if null.

libstdc++-v3/ChangeLog:

	* include/std/utility (unreachable): Define for C++23.
	* include/std/version (__cpp_lib_unreachable): Define.
	* src/c++11/debug.cc (__glibcxx_assert_fail): Check for valid
	arguments. Handle only the function being given.
	* testsuite/20_util/unreachable/1.cc: New test.
	* testsuite/20_util/unreachable/version.cc: New test.
2022-04-01 13:17:18 +01:00
Jonathan Wakely
944da70a5d libstdc++: Fix mismatched noexcept-specifiers in Filesystem TS
The copy_file fix should have been part of r12-7063-gda72e0fd20f87b.

The path::begin() fix should have been part of r12-3930-gf2b7f56a15d9cb.
Thanks to Timm Bäder for reporting this one.

libstdc++-v3/ChangeLog:

	* include/experimental/bits/fs_fwd.h (copy_file): Remove
	incorrect noexcept from declaration.
	* include/experimental/bits/fs_path.h (path::begin, path::end):
	Add noexcept to declarations, to match definitions.
2022-04-01 13:17:18 +01:00
Tom de Vries
bfa9f660d2 [libgomp, testsuite, nvptx] Limit recursion in declare_target-{1,2}.f90
When running testcases libgomp.fortran/examples-4/declare_target-{1,2}.f90 on
an RTX A2000 (sm_86) with driver 510.60.02 and with GOMP_NVPTX_JIT=-O0 I run
into:
...
FAIL: libgomp.fortran/examples-4/declare_target-1.f90 -O0 \
  -DGOMP_NVPTX_JIT=-O0 execution test
FAIL: libgomp.fortran/examples-4/declare_target-2.f90 -O0 \
  -DGOMP_NVPTX_JIT=-O0 execution test
...

Fix this by further limiting recursion depth in the test-cases for nvptx.

Furthermore, make the recursion depth limiting nvptx-specific.

Tested on x86_64 with nvptx accelerator.

libgomp/ChangeLog:

2022-04-01  Tom de Vries  <tdevries@suse.de>

	* testsuite/libgomp.fortran/examples-4/declare_target-1.f90: Define
	and use REC_DEPTH.
	* testsuite/libgomp.fortran/examples-4/declare_target-2.f90: Same.
2022-04-01 13:23:16 +02:00
Tom de Vries
065e25f633 [libgomp, testsuite, nvptx] Fix dg-output test in vector-length-128-7.c
When running test-case libgomp.oacc-c-c++-common/vector-length-128-7.c on an
RTX A2000 (sm_86) with driver 510.60.02 I run into:
...
FAIL: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-7.c \
  -DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -foffload=nvptx-none  -O0  \
  output pattern test
...

The failing check verifies the launch dimensions:
...
/* { dg-output "nvptx_exec: kernel main\\\$_omp_fn\\\$0: \
                launch gangs=1, workers=8, vectors=128" } */
...
which fails because (as we can see with GOMP_DEBUG=1) the actual num_workers
is 6:
...
  nvptx_exec: kernel main$_omp_fn$0: launch gangs=1, workers=6, vectors=128
...

This is due to the result of cuOccupancyMaxPotentialBlockSize (which suggests
'a launch configuration with reasonable occupancy') printed just before:
...
cuOccupancyMaxPotentialBlockSize: grid = 52, block = 768
...
[ Note: 6 * 128 == 768. ]

Fix this by updating the check to allow num_workers in the range 1 to 8.

Tested on x86_64 with nvptx accelerator.

libgomp/ChangeLog:

2022-04-01  Tom de Vries  <tdevries@suse.de>

	* testsuite/libgomp.oacc-c-c++-common/vector-length-128-7.c: Fix
	num_workers check.
2022-04-01 13:22:07 +02:00
Timm Bäder
1e9c026848 libstdc++: Fix filenames in Doxygen @file comments
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/fs_ops.h: Fix filename in Doxygen comment.
	* include/experimental/bits/fs_ops.h: Likewise.
2022-04-01 11:34:43 +01:00
Jakub Jelinek
d9c03fc27d phiopt: Improve value_replacement [PR104645]
The following patch fixes the P1 regression by reusing existing
value_replacement code.  That function already has code to
handle simple preparation statements (casts, and +,&,|,^ binary
assignments) before a final binary assignment (which can be
much wider range of ops).  When we have e.g.
      if (y_3(D) == 0)
        goto <bb 4>;
      else
        goto <bb 3>;
     <bb 3>:
      y_4 = y_3(D) & 31;
      _1 = (int) y_4;
      _6 = x_5(D) r<< _1;
     <bb 4>:
      # _2 = PHI <x_5(D)(2), _6(3)>
the preparation statements y_4 = y_3(D) & 31; and
_1 = (int) y_4; are handled by constant evaluation, passing through
y_3(D) = 0 initially and propagating that through the assignments
with checking that UB isn't invoked.  But the final
_6 = x_5(D) r<< _1; assign is handled differently, either through
neutral_element_p or absorbing_element_p.
In the first function below we now have:
  <bb 2> [local count: 1073741824]:
  if (i_2(D) != 0)
    goto <bb 3>; [50.00%]
  else
    goto <bb 4>; [50.00%]

  <bb 3> [local count: 536870913]:
  _3 = i_2(D) & 1;
  iftmp.0_4 = (int) _3;

  <bb 4> [local count: 1073741824]:
  # iftmp.0_1 = PHI <iftmp.0_4(3), 0(2)>
where in GCC 11 we had:
  <bb 2> :
  if (i_3(D) != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  i.1_1 = (int) i_3(D);
  iftmp.0_5 = i.1_1 & 1;

  <bb 4> :
  # iftmp.0_2 = PHI <iftmp.0_5(3), 0(2)>
Current value_replacement can handle the latter as the last
stmt of middle_bb is a binary op that in this case satisfies
absorbing_element_p.
But the former we can't handle, as the last stmt in middle_bb
is a cast.

The patch makes it work in that case by pretending all of middle_bb
are the preparation statements and there is no binary assign at the
end, so everything is handled through the constant evaluation.
We simply set at the start of middle_bb the lhs of comparison
virtually to the rhs, propagate it through and at the end
see if virtually the arg0 of the PHI is equal to arg1 of it.

For GCC 13, I think we just should throw away all the neutral/absorbing
element stuff and do the constant evaluation of the whole middle_bb
and handle that way all the ops we currently handle in neutral/absorbing
element.

2022-04-01  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/104645
	* tree-ssa-phiopt.cc (value_replacement): If assign has
	CONVERT_EXPR_CODE_P rhs_code, treat it like a preparation
	statement with constant evaluation.

	* gcc.dg/tree-ssa/pr104645.c: New test.
2022-04-01 11:50:41 +02:00
Jakub Jelinek
e0ce885851 testsuite: Add further zero size elt passing tests [PR102024]
As discussed in PR102024, zero width bitfields might not be the only ones
causing ABI issues at least on mips, zero size arrays or (in C only) zero
sized (empty) structures can be problematic too.

The following patch adds some coverage for it too.

Tested on x86_64-linux with
make check-gcc check-g++ RUNTESTFLAGS='ALT_CC_UNDER_TEST=gcc ALT_CXX_UNDER_TEST=g++ --target_board=unix\{-m32,-m64\} compat.exp=pr102024*'
make check-gcc check-g++ RUNTESTFLAGS='ALT_CC_UNDER_TEST=clang ALT_CXX_UNDER_TEST=clang++ --target_board=unix\{-m32,-m64\} compat.exp=pr102024*'
with gcc/g++ 10.3 and clang 11.  Everything but (expectedly)
FAIL: gcc.dg/compat/pr102024 c_compat_x_tst.o-c_compat_y_alt.o execute
FAIL: gcc.dg/compat/pr102024 c_compat_x_alt.o-c_compat_y_tst.o execute
for -m64 ALT_CC_UNDER_TEST=gcc passes.

2022-04-01  Jakub Jelinek  <jakub@redhat.com>

	PR target/102024
	* gcc.dg/compat/pr102024_test.h: Add further tests with zero sized
	structures and arrays.
	* g++.dg/compat/pr102024_test.h: Add further tests with zero sized
	arrays.
2022-04-01 11:49:40 +02:00