Commit Graph

192045 Commits

Author SHA1 Message Date
Iain Buclaw 7e28750395 d: Merge upstream dmd 02a3fafc6, druntime 26b58167, phobos 16cb085b5.
D front-end changes:

    - Import dmd v2.099.0.
    - The deprecation period for D1-style operators has ended, any use
      of the D1 overload operators will now result in a compiler error.
    - `scope' as a type constraint on class, struct, union, and enum
      declarations has been deprecated.
    - Fix segmentation fault when emplacing a new front-end Expression
      node during CTFE (PR104835).

D runtime changes:

    - Import druntime v2.099.0.
    - Fix C bindings for stdint types (PR104738).
    - Fix bus error when allocating new array on the GC (PR104742).
    - Fix bus error when allocating new pointer on the GC (PR104745).

Phobos changes:

    - Import phobos v2.099.0.
    - New function `bind' in `std.functional'.

gcc/d/ChangeLog:

	* dmd/MERGE: Merge upstream dmd 02a3fafc6.
	* dmd/VERSION: Update version to v2.099.0.
	* imports.cc (ImportVisitor::visit (EnumDeclaration *)): Don't cache
	decl in front-end AST node.
	(ImportVisitor::visit (AggregateDeclaration *)): Likewise.
	(ImportVisitor::visit (ClassDeclaration *)): Likewise.

libphobos/ChangeLog:

	* libdruntime/MERGE: Merge upstream druntime 26b58167.
	* src/MERGE: Merge upstream phobos 16cb085b5.
2022-03-13 13:20:02 +01:00
Tobias Burnus 1b85638aff texi + c-target.def: Fix typos
gcc/c-family/ChangeLog:

	* c-target.def (check_string_object_format_arg): Fix description typo.

gcc/ChangeLog:

	* doc/invoke.texi: Fix typos.
	* doc/tm.texi.in: Remove duplicated word.
	* doc/tm.texi: Regenerate.

libgomp/ChangeLog:

	* libgomp.texi: Fix typo.
2022-03-13 10:23:07 +01:00
GCC Administrator 57eeedda23 Daily bump. 2022-03-13 00:16:20 +00:00
Patrick Palka d3b0dc686c c++: naming a dependently-scoped template for CTAD [PR104641]
In order to be able to perform CTAD for a dependently-scoped template
(such as A<T>::B in the testcase below), we need to permit a
typename-specifier to resolve to a template as per [dcl.type.simple]/3,
at least when it appears in a CTAD-enabled context.

This patch implements this using a new tsubst flag tf_tst_ok to control
when a TYPENAME_TYPE is allowed to name a template, and sets this flag
when substituting into the type of a CAST_EXPR, CONSTRUCTOR or VAR_DECL
(each of which is a CTAD-enabled context).

	PR c++/104641

gcc/cp/ChangeLog:

	* cp-tree.h (tsubst_flags::tf_tst_ok): New flag.
	* decl.cc (make_typename_type): Allow a typename-specifier to
	resolve to a template when tf_tst_ok, in which case return
	a CTAD placeholder for the template.
	* pt.cc (tsubst_decl) <case VAR_DECL>: Set tf_tst_ok when
	substituting the type.
	(tsubst): Clear tf_tst_ok and remember if it was set.
	<case TYPENAME_TYPE>: Pass tf_tst_ok to make_typename_type
	appropriately.
	(tsubst_copy) <case CAST_EXPR>: Set tf_tst_ok when substituting
	the type.
	(tsubst_copy_and_build) <case CAST_EXPR>: Likewise.
	<case CONSTRUCTOR>: Likewise.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1z/class-deduction107.C: New test.
2022-03-12 15:00:51 -05:00
Patrick Palka 03c83cf7aa c++: ICE with bad conversion shortcutting [PR104622]
When shortcutting bad argument conversions during overload resolution,
we assume conversions get computed in sequential order and that therefore
the conversion array is incomplete iff the last conversion is missing.
But this assumption turns out to be wrong for templates, because during
deduction check_non_deducible_conversion can compute an argument
conversion out of order.

So in the testcase below, at the end of add_template_candidate the
conversion array looks like {bad_conv, NULL, good_conv} where the last
conversion was computed during deduction and the first one later from
add_function_candidate.  We need to add this candidate to bad_fns since
not all of its argument conversions were computed, but we don't do so
because the last conversion isn't missing.

This patch fixes this by checking for a missing conversion exhaustively
instead.  In passing, this cleans up check_non_deducible_conversion given
that the only values of 'strict' we expect to see here the enumerators
of unification_kind_t.

	PR c++/104622

gcc/cp/ChangeLog:

	* call.cc (missing_conversion_p): Define.
	(add_candidates): Use it.
	* pt.cc (check_non_deducible_conversion): Change type of strict
	parameter to unification_kind_t and directly test for DEDUCE_CALL.

gcc/testsuite/ChangeLog:

	* g++.dg/template/conv18.C: New test.
2022-03-12 15:00:49 -05:00
Patrick Palka 9413bb5518 c++: return-type-req in constraint using only outer tparms [PR104527]
Here the template context for the atomic constraint has two levels of
template parameters, but since it depends only on the innermost parameter
T we use a single-level argument vector (built by get_mapped_args) during
substitution into the atom.  We eventually pass this vector to
do_auto_deduction as part of checking the return-type-requirement within
the atom, but do_auto_deduction expects outer_targs to be a full set of
arguments for sake of satisfaction.

This patch fixes this by making get_mapped_args always return an
argument vector whose depth corresponds to the template depth of the
context in which the atomic constraint expression was written, instead
of the highest parameter level that the expression happens to use.

	PR c++/104527

gcc/cp/ChangeLog:

	* constraint.cc (normalize_atom): Set
	ATOMIC_CONSTR_EXPR_FROM_CONCEPT_P appropriately.
	(get_mapped_args):  Make static, adjust parameters.  Always
	return a vector whose depth corresponds to the template depth of
	the context of the atomic constraint expression.  Micro-optimize
	by passing false as exact to safe_grow_cleared and by collapsing
	a multi-level depth-one argument vector.
	(satisfy_atom): Adjust call to get_mapped_args and
	diagnose_atomic_constraint.
	(diagnose_atomic_constraint): Replace map parameter with an args
	parameter.
	* cp-tree.h (ATOMIC_CONSTR_EXPR_FROM_CONCEPT_P): Define.
	(get_mapped_args): Remove declaration.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/concepts-return-req4.C: New test.
2022-03-12 15:00:40 -05:00
Patrick Palka ab71d3fe4b c++: ICE with non-constant satisfaction value [PR98644]
Here during satisfaction, the expression of the atomic constraint after
substitution is (int *) NON_LVALUE_EXPR <1> != 0B, which is not a C++
constant expression due to the reinterpret_cast, but TREE_CONSTANT is
set since its value is otherwise effectively constant.  We then call
maybe_constant_value on it, which proceeds via its fail-fast path to
exit early without clearing TREE_CONSTANT.  But satisfy_atom relies
on checking TREE_CONSTANT of the result of maybe_constant_value in order
to detect non-constant satisfaction.

This patch fixes this by making the fail-fast path of maybe_constant_value
clear TREE_CONSTANT in this case, like cxx_eval_outermost_constant_expr
in the normal path would have done.

	PR c++/98644

gcc/cp/ChangeLog:

	* constexpr.cc (mark_non_constant): Define, split out from ...
	(cxx_eval_outermost_constant_expr): ... here.
	(maybe_constant_value): Use it.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/concepts-pr98644.C: New test.
	* g++.dg/parse/array-size2.C: Remove expected diagnostic about a
	narrowing conversion.

Co-authored-by: Jason Merrill <jason@redhat.com>
2022-03-12 14:57:59 -05:00
Patrick Palka 28750ac276 c++: give fold expressions a location
This improves diagnostic quality for unsatisfied atomic constraints
that consist of a fold expression, e.g. in concepts/diagnostic3.C
the "evaluated to false" diagnostic now points to the expression:

  .../diagnostic3.C:10:22: note: the expression ‘(foo<Ts> && ...) [with Ts = {int, char}]’ evaluated to ‘false’
     10 | requires (foo<Ts> && ...)
        |          ~~~~~~~~~~~~^~~~

gcc/cp/ChangeLog:

	* semantics.cc (finish_unary_fold_expr): Use input_location
	instead of UNKNOWN_LOCATION.
	(finish_binary_fold_expr): Likewise.

gcc/testsuite/ChangeLog:

	* g++.dg/concepts/diagnostic3.C: Adjusted expected location of
	"evaluated to false" diagnostics.
2022-03-12 14:57:56 -05:00
Segher Boessenkool 80fcc4b6af rs6000: Do not use rs6000_cpu for .machine ppc and ppc64 (PR104829)
Fixes: 77eccbf39e

rs6000.h has
  #define PROCESSOR_POWERPC   PROCESSOR_PPC604
  #define PROCESSOR_POWERPC64 PROCESSOR_RS64A
which means that if you use things like  -mcpu=powerpc -mvsx  it will no
longer work after my latest .machine patch.  This causes GCC build errors
in some cases, not a good idea (even if the errors are actually
pre-existing: using -mvsx with a machine that does not have VSX cannot
work properly).

2022-03-11  Segher Boessenkool  <segher@kernel.crashing.org>

	PR target/104829
	* config/rs6000/rs6000.cc (rs6000_machine_from_flags): Don't output
	"ppc" and "ppc64" based on rs6000_cpu.
2022-03-12 16:02:19 +00:00
Thomas Schwinge a07b8f4fb7 OpenACC 'kernels' decomposition: resolve wrong-code cases unless manually making certain variables addressable [PR100280, PR104892]
Currently in OpenACC 'kernels' decomposition, there is special handling of
'GOMP_MAP_FORCE_TOFROM', documented to be done to avoid "internal compiler
errors in later passes".  For performance reasons, the current repetitive
to/from device copying for every region is not ideal, compared to using
'present' clauses, as done for almost all other 'GOMP_MAP_*'.  Also, the
current special handling (incomplete, evidently) is the reason for the PR104892
misbehavior.  For PR100280 etc. we've resolved all such known ICEs -- removing
the special handling for 'GOMP_MAP_FORCE_TOFROM' now resolves PR104892.

	PR middle-end/100280
	PR middle-end/104892
	gcc/
	* omp-oacc-kernels-decompose.cc (omp_oacc_kernels_decompose_1):
	Remove special handling of 'GOMP_MAP_FORCE_TOFROM'.
	gcc/testsuite/
	* c-c++-common/goacc/kernels-decompose-2.c: Adjust.
	* c-c++-common/goacc/kernels-decompose-pr100400-1-1.c: Likewise.
	* c-c++-common/goacc/kernels-decompose-pr100400-1-2.c: Likewise.
	* c-c++-common/goacc/kernels-decompose-pr100400-1-3.c: Likewise.
	* c-c++-common/goacc/kernels-decompose-pr100400-1-4.c: Likewise.
	* c-c++-common/goacc/kernels-decompose-pr104061-1-1.c: Likewise.
	* c-c++-common/goacc/kernels-decompose-pr104061-1-2.c: Likewise.
	* c-c++-common/goacc/kernels-decompose-pr104061-1-3.c: Likewise.
	* c-c++-common/goacc/kernels-decompose-pr104061-1-4.c: Likewise.
	* c-c++-common/goacc/kernels-decompose-pr104132-1.c: Likewise.
	* c-c++-common/goacc/kernels-decompose-pr104133-1.c: Likewise.
	* c-c++-common/goacc/kernels-decompose-pr104774-1.c: Likewise.
	* gfortran.dg/goacc/classify-kernels.f95: Likewise.
	* gfortran.dg/goacc/kernels-decompose-2.f95: Likewise.
	libgomp/
	* testsuite/libgomp.oacc-c-c++-common/declare-vla.c: Adjust.
	* testsuite/libgomp.oacc-c-c++-common/default-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/kernels-reduction-1.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/parallel-dims.c: Likewise.
	* testsuite/libgomp.oacc-fortran/asyncwait-1.f90: Likewise.
	* testsuite/libgomp.oacc-fortran/kernels-reduction-1.f90:
	Likewise.
2022-03-12 15:37:27 +01:00
Thomas Schwinge 535afbd959 OpenACC 'kernels' decomposition: wrong-code cases unless manually making certain variables addressable [PR104892]
Document a few examples of the status quo.

	PR middle-end/104892
	libgomp/
	* testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c: Point
	to PR104892.
	* testsuite/libgomp.oacc-c-c++-common/default-1.c: Likewise,
	enable '--param=openacc-kernels=decompose' and adjust.
	* testsuite/libgomp.oacc-c-c++-common/kernels-reduction-1.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/parallel-dims.c: Likewise.
	* testsuite/libgomp.oacc-fortran/kernels-reduction-1.f90:
	Likewise.
2022-03-12 15:37:27 +01:00
Thomas Schwinge 2e53fa7bb2 Enhance further testcases to verify handling of OpenACC privatization level [PR90115]
As originally introduced in commit 11b8286a83
"[OpenACC privatization] Largely extend diagnostics and corresponding testsuite
coverage [PR90115]".

	PR middle-end/90115
	libgomp/
	* testsuite/libgomp.oacc-c-c++-common/default-1.c: Enhance.
	* testsuite/libgomp.oacc-c-c++-common/kernels-reduction-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/parallel-dims.c: Likewise.
	* testsuite/libgomp.oacc-fortran/kernels-reduction-1.f90: Likewise.
2022-03-12 14:00:46 +01:00
Thomas Schwinge 337ed336d7 OpenACC 'kernels' decomposition: Mark variables used in 'present' clauses as addressable [PR100280, PR104086]
... like in recent commit 9b32c1669a
"OpenACC 'kernels' decomposition: Mark variables used in synthesized
data clauses as addressable [PR100280]".  Otherwise, we may run into
'gcc/omp-low.cc:lower_omp_target':

    13125                       else if (is_gimple_reg (var))
    13126                         {
    13127                           gcc_assert (offloaded);

	PR middle-end/100280
	PR middle-end/104086
	gcc/
	* omp-oacc-kernels-decompose.cc (omp_oacc_kernels_decompose_1):
	Mark variables used in 'present' clauses as addressable.
	* omp-low.cc (scan_sharing_clauses) <OMP_CLAUSE_MAP>: Gracefully
	handle duplicate 'OMP_CLAUSE_MAP_DECL_MAKE_ADDRESSABLE'.
	gcc/testsuite/
	* c-c++-common/goacc/kernels-decompose-pr104086-1.c: Adjust,
	extend.
	libgomp/
	* testsuite/libgomp.oacc-c-c++-common/declare-vla-kernels-decompose-ice-1.c:
	Merge this...
	* testsuite/libgomp.oacc-c-c++-common/declare-vla-kernels-decompose.c:
	..., and this...
	* testsuite/libgomp.oacc-c-c++-common/declare-vla.c: ... into
	this, and adjust.
	* testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c:
	Extend.
2022-03-12 13:02:55 +01:00
Thomas Schwinge 9781ae3a25 Add 'c-c++-common/goacc/kernels-decompose-pr104086-1.c' [PR104086]
..., currently XFAILed with 'dg-ice', as it runs into
'gcc/omp-low.cc:lower_omp_target':

    13125			else if (is_gimple_reg (var))
    13126			  {
    13127			    gcc_assert (offloaded);

This means, the recent PR100280 etc. changes are still not sufficient.

	gcc/testsuite/
	PR middle-end/104086
	* c-c++-common/goacc/kernels-decompose-pr104086-1.c: New file.
2022-03-12 12:58:48 +01:00
Thomas Schwinge 828335beb7 Add 'gcc/tree.cc:user_omp_clause_code_name' [PR65095]
Re PR65095 "Adapt OpenMP diagnostic messages for OpenACC", move C/C++
front end 'gcc/c-family/c-omp.cc:c_omp_map_clause_name' to generic
'gcc/tree.cc:user_omp_clause_code_name' .  No functional change.

	PR other/65095
	gcc/
	* tree-core.h (user_omp_claus_code_name): Declare function.
	* tree.cc (user_omp_clause_code_name): New function.
	gcc/c/
	* c-typeck.cc (handle_omp_array_sections_1)
	(c_oacc_check_attachments): Call 'user_omp_clause_code_name'
	instead of 'c_omp_map_clause_name'.
	gcc/cp/
	* semantics.cc (handle_omp_array_sections_1)
	(cp_oacc_check_attachments): Call 'user_omp_clause_code_name'
	instead of 'c_omp_map_clause_name'.
	gcc/c-family/
	* c-common.h (c_omp_map_clause_name): Remove.
	* c-omp.cc (c_omp_map_clause_name): Remove.
2022-03-12 11:05:29 +01:00
Roger Sayle 72c243017d PR middle-end/98420: Don't fold x - x to 0.0 with -frounding-math
This patch addresses PR middle-end/98420, which is inappropriate constant
folding of x - x to 0.0 (in match.pd) when -frounding-math is specified.
Specifically, x - x may be -0.0 with FE_DOWNWARD as the rounding mode.

To summarize, the desired IEEE behaviour, x - x for floating point x,
(1) can't be folded to 0.0 by default, due to the possibility of NaN or Inf
(2) can be folded to 0.0 with -ffinite-math-only
(3) can't be folded to 0.0 with -ffinite-math-only -frounding-math
(4) can be folded with -ffinite-math-only -frounding-math -fno-signed-zeros

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

gcc/ChangeLog
	PR middle-end/98420
	* match.pd (minus @0 @0): Additional checks for -fno-rounding-math
	(the defaut) or -fno-signed-zeros.

gcc/testsuite/ChangeLog
	PR middle-end/98420
	* gcc.dg/pr98420.c: New test case.
2022-03-12 09:20:52 +00:00
Michael Meissner 3cb27b85a7 Fix DImode to TImode sign extend issue
PR target/104868 had had an issue where my code that updated the DImode to
TImode sign extension for power10 failed.  In looking at the failure
message, the reason is when extendditi2 tries to split the insn, it
generates an insn that does not satisfy its constraints:

	(set (reg:V2DI 65 1)
	     (vec_duplicate:V2DI (reg:DI 0)))

The reason is vsx_splat_v2di does not allow GPR register 0 when the will
be generating a mtvsrdd instruction.  In the definition of the mtvsrdd
instruction, if the RA register is 0, it means clear the upper 64 bits of
the vector instead of moving register GPR 0 to those bits.

When I wrote the extendditi2 pattern, I forgot that mtvsrdd had that
behavior so I used a 'r' constraint instead of 'b'.  In the rare case
where the value is in GPR register 0, this split will fail.

This patch uses the right constraint for extendditi2.

2022-03-11   Michael Meissner  <meissner@linux.ibm.com>

gcc/
	PR target/104868
	* config/rs6000/vsx.md (extendditi2): Use a 'b' constraint when
	moving from a GPR register to an Altivec register.
2022-03-11 19:47:09 -05:00
GCC Administrator b00f9761b9 Daily bump. 2022-03-12 00:16:27 +00:00
Iain Buclaw 42d9ff3ac8 d: Cache generated import declarations in a hash_map
Originally, these were cached in the front-end AST node field `isym'.
However, this field is due to be removed in the future.

gcc/d/ChangeLog:

	* imports.cc (imported_decls): Define.
	(class ImportVisitor): Add result_ field.
	(ImportVisitor::result): New method.
	(ImportVisitor::visit (Module *)): Store decl to result_.
	(ImportVisitor::visit (Import *)): Likewise.
	(ImportVisitor::visit (AliasDeclaration *)): Don't cache decl in
	front-end AST node.
	(ImportVisitor::visit (OverDeclaration *)): Likewise.
	(ImportVisitor::visit (FuncDeclaration *)): Likewise.
	(ImportVisitor::visit (Declaration *)): Likewise.
	(build_import_decl): Use imported_decls to cache and lookup built
	declarations.
2022-03-11 23:34:59 +01:00
Iain Buclaw 7a6ba7c7cb d: Fix mistakes in strings to be translated [PR104552]
Address comments made in PR104552 about documented D language options.

gcc/d/ChangeLog:

	PR translation/104552
	* lang.opt (fdump-cxx-spec=): Fix typo in argument handle.
	(fpreview=fixaliasthis): Quote `alias this' as code.
2022-03-11 23:34:59 +01:00
Roger Sayle 251ea6dfbd PR tree-optimization/98335: New peephole2 xorl;movb -> movzbl
This patch is the backend piece of my proposed fix to PR tree-opt/98335,
to allow C++ partial struct initialization to be as efficient/optimized
as full struct initialization.

With the middle-end patch just posted to gcc-patches, the test case
in the PR compiles on x86_64-pc-linux-gnu with -O2 to:

        xorl    %eax, %eax
        movb    c(%rip), %al
        ret

with this additional peephole2 (actually four peephole2s):

        movzbl  c(%rip), %eax
        ret

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

gcc/ChangeLog
	PR tree-optimization/98335
	* config/i386/i386.md (peephole2): Eliminate redundant insv.
	Combine movl followed by movb.  Transform xorl followed by
	a suitable movb or movw into the equivalent movz[bw]l.

gcc/testsuite/ChangeLog
	PR tree-optimization/98335
	* g++.target/i386/pr98335.C: New test case.
	* gcc.target/i386/pr98335.c: New test case.
2022-03-11 17:57:12 +00:00
Roger Sayle c5288df751 PR tree-optimization/98335: Improvements to DSE's compute_trims.
This patch is the main middle-end piece of a fix for PR tree-opt/98335,
which is a code-quality regression affecting mainline.  The issue occurs
in DSE's (dead store elimination's) compute_trims function that determines
where a store to memory can be trimmed.  In the testcase given in the
PR, this function notices that the first byte of a DImode store is dead,
and replaces the 8-byte store at (aligned) offset zero, with a 7-byte store
at (unaligned) offset one.  Most architectures can store a power-of-two
bytes (up to a maximum) in single instruction, so writing 7 bytes requires
more instructions than writing 8 bytes.  This patch follows Jakub Jelinek's
suggestion in comment 5, that compute_trims needs improved heuristics.

On x86_64-pc-linux-gnu with -O2 the new test case in the PR goes from:

        movl    $0, -24(%rsp)
        movabsq $72057594037927935, %rdx
        movl    $0, -21(%rsp)
        andq    -24(%rsp), %rdx
        movq    %rdx, %rax
        salq    $8, %rax
        movb    c(%rip), %al
        ret

to

        xorl    %eax, %eax
        movb    c(%rip), %al
        ret

2022-03-11  Roger Sayle  <roger@nextmovesoftware.com>
	    Richard Biener  <rguenther@suse.de>

gcc/ChangeLog
	PR tree-optimization/98335
	* builtins.cc (get_object_alignment_2): Export.
	* builtins.h (get_object_alignment_2): Likewise.
	* tree-ssa-alias.cc (ao_ref_alignment): New.
	* tree-ssa-alias.h (ao_ref_alignment): Declare.

	* tree-ssa-dse.cc (compute_trims): Improve logic deciding whether
	to align head/tail, writing more bytes but using fewer store insns.

gcc/testsuite/ChangeLog
	PR tree-optimization/98335
	* g++.dg/pr98335.C: New test case.
	* gcc.dg/pr86010.c: New test case.
	* gcc.dg/pr86010-2.c: New test case.
2022-03-11 17:51:18 +00:00
Roger Sayle 098c538ae8 [Committed] Update g++.dg/other/pr84964.C for ia32 (and similar) targets.
The "sorry, unimplemented" message in the new g++.dg/other/pr84964.C is
apparently dependent upon whether the target passes multi-gigabyte
arguments on the stack.  This tweaks the testcase to just confirm that
it no longer ICEs, not the specific set of warnings/errors triggered.

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

gcc/testsuite/ChangeLog
	PR c++/84964
	* g++.dg/other/pr84964.C: Tweak test to check for the ICE, not for
	the (target-dependent) sorry.
2022-03-11 17:35:21 +00:00
Richard Biener eb5edcf3f3 tree-optimization/104880 - update-address-taken and cmpxchg
The following addresses optimistic non-addressable marking of
an argument of __atomic_compare_exchange_n which broke when
I added DECL_NOT_GIMPLE_REG_P since we cannot guarantee we can
rewrite it when TREE_ADDRESSABLE is unset.  Instead we have to
restore TREE_ADDRESSABLE in that case.

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

	PR tree-optimization/104880
	* tree-ssa.cc (execute_update_address_taken): Remember if we
	optimistically made something not addressable and
	prepare to undo it.

	* g++.dg/opt/pr104880.cc: New testcase.
2022-03-11 14:12:06 +01:00
Richard Biener 69619acd8d target/104762 - vectorization costs of CONSTRUCTORs
After accounting for GPR -> XMM move cost for vec_construct the
base cost needs adjustments to not double-cost those.  This also
lowers the cost when such move is not necessary.

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

	PR target/104762
	* config/i386/i386.cc (ix86_builtin_vectorization_cost): Do not
	cost the first lane of SSE pieces as inserts for vec_construct.
2022-03-11 14:11:59 +01:00
Tobias Burnus db494fd68d lto-plugin: Honor link_output_name for -foffload-objects file name
lto-plugin/ChangeLog:

	* lto-plugin.c (all_symbols_read_handler): With -save-temps, use
	link_output_name for -foffload-objects's file name, if available.
2022-03-11 13:02:00 +01:00
Rainer Orth 1375e2b623 libphobos: Enable on Solaris/SPARC or with /bin/as [PR 103528]
libphobos is currently only enabled on Solaris/x86 with gas.  As
discovered when gdc was switched to the dmd frontend, this initially
broke bootstrap for the other Solaris configurations.

However, it's now well possible to enable it both for Solaris/x86 with
as and Solaris/SPARC (both as and gas) since the original problems (x86
as linelength limit, among others) are long gone.

The following patch does just that.

Tested on i386-pc-solaris2.11 and sparc-sun-solaris2.11 (both as and
gas) with gdc 9.3.0 (x86) resp. 9.4.0 (sparc, configured with
--enable-libphobos) as bootstrap compilers.

2021-12-01  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	libphobos:
	PR d/103528
	* configure.ac <x86_64-*-solaris2.* | i?86-*-solaris2.*>: Remove
	gas requirement.
	* configure: Regenerate.
	* configure.tgt (sparc*-*-solaris2.11*): Mark supported.
2022-03-11 09:37:44 +01:00
Tobias Burnus 41bda0036c Fortran: OpenMP/OpenACC avoid uninit access in size calc for mapping
gcc/fortran/ChangeLog:

	* trans-openmp.cc (gfc_trans_omp_clauses, gfc_omp_finish_clause):
	Obtain size for mapping only if allocatable array is allocated.

gcc/testsuite/ChangeLog:

	* gfortran.dg/goacc/array-with-dt-1.f90: Update/add comments;
	remove dg-warning for 'is used uninitialized'.
	* gfortran.dg/goacc/pr93464.f90: Likewise.
	* gfortran.dg/goacc/array-with-dt-1a.f90: New; copied from
	gfortran.dg/goacc/array-with-dt-1.f90 but run with -O0. Update
	dg-warning for 'may be used uninitialized'.
	* gfortran.dg/goacc/pr93464-2.f90: Likewise; copied from
	gfortran.dg/goacc/pr93464.f90.
2022-03-11 08:48:58 +01:00
GCC Administrator 5e28be8966 Daily bump. 2022-03-11 00:16:39 +00:00
Roger Sayle a717376e99 PR c++/84964: Middle-end patch to expand_call for ICE after sorry.
This patch resolves PR c++/84969 which is an ICE in the middle-end after
emitting a "sorry, unimplemented" message, and is a regression from
earlier releases of GCC.  This issue is that after encountering a
function call requiring an unreasonable amount of stack space, the
code continues and falls foul of an assert checking that stack pointer
has been correctly updated.  The fix is to (locally) consider aborted
function calls as "no return", which skips this downstream sanity check.

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

gcc/ChangeLog
	PR c++/84964
	* calls.cc (expand_call): Ignore stack adjustments after sorry.

gcc/testsuite/ChangeLog
	PR c++/84964
	* g++.dg/other/pr84964.C: New test case.
2022-03-10 23:49:15 +00:00
Jonathan Wakely a8db9b9043 libstdc++: Do not use fast_float for 16-bit size_t [PR104870]
The preprocessor condition for using fast_float should match the one in
the header, and require at least 32-bit size_t.

libstdc++-v3/ChangeLog:

	PR libstdc++/104870
	* src/c++17/floating_from_chars.cc: Check __SIZE_WIDTH__ >= 32
	before using fast_float.
2022-03-10 23:45:03 +00:00
David Malcolm d016dd7dbb analyzer: fix ICE with -fanalyzer-transitivity [PR104863]
gcc/analyzer/ChangeLog:
	PR analyzer/104863
	* constraint-manager.cc (constraint_manager::add_constraint):
	Refresh the EC IDs when adding constraints implied by offsets.

gcc/testsuite/ChangeLog:
	PR analyzer/104863
	* gcc.dg/analyzer/torture/pr104863.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-03-10 16:52:01 -05:00
Vladimir N. Makarov d8e5fff6b7 [PR103074] LRA: Check new conflicts when splitting hard reg live range.
Splitting hard register live range can create (artificial)
conflict of the hard register with another pseudo because of simplified
conflict calculation in LRA.  We should check such conflict on the next
assignment sub-pass and spill and reassign the pseudo if necessary.
The patch implements this.

gcc/ChangeLog:

	PR target/103074
	* lra-constraints.cc (split_reg): Set up
	check_and_force_assignment_correctness_p when splitting hard
	register live range.

gcc/testsuite/ChangeLog:

	PR target/103074
	* gcc.target/i386/pr103074.c: New.
2022-03-10 16:16:49 -05:00
Detlef Vollmann b5417a0ba7 libstdc++: Move closing brace outside #endif [PR104866]
libstdc++-v3/ChangeLog:

	PR libstdc++/104866
	* include/bits/this_thread_sleep.h: Fix order of #endif and
	closing brace of namespace.
2022-03-10 21:04:01 +00:00
Hafiz Abid Qadeer 7c2ac3cebd Fix multiple issue in the testcase allocate-1.f90.
1. Thomas reported in
https://gcc.gnu.org/pipermail/gcc-patches/2022-January/589039.html
that this testcase is randomly failing. The problem was fixed pool
size which was exhausted when there were a lot of threads. Fixed it
by removing pool_size trait which causes default pool size to be used
which should be big enough.

2. Array indices have been changed to check the last element in the
array.

3. Remove a redundant assignment and move some code to better match
C testcase.

libgomp/ChangeLog:

	* testsuite/libgomp.fortran/allocate-1.f90: Remove pool_size
	trait.  Test last index in w and v array.  Remove redundant
	assignment to V(1).  Move alignment checks at the end of
	parallel region.
2022-03-10 18:43:50 +00:00
Marek Polacek 4602a494e9 c++: ->template and implicit typedef [PR104608]
Here we have a forward declaration of Parameter for which we create
an implicit typedef, which is a TYPE_DECL.  Then, when looking it up
at template definition time, cp_parser_template_id gets (since r12-6754)
this TYPE_DECL which it can't handle.

This patch defers lookup for TYPE_DECLs that cp_parser_template_id can't
handle, a la r12-6879.

	PR c++/104608

gcc/cp/ChangeLog:

	* parser.cc (cp_parser_template_name): Repeat lookup of
	TYPE_DECLs.

gcc/testsuite/ChangeLog:

	* g++.dg/parse/template-keyword3.C: New test.
	* g++.dg/parse/template-keyword4.C: New test.
2022-03-10 11:23:41 -05:00
Marek Polacek 97f76b5fc4 c++: Don't allow type-constraint auto(x) [PR104752]
104752 points out that

  template<class T>
  concept C = true;
  auto y = C auto(1);

is ill-formed as per [dcl.type.auto.deduct]: "For an explicit type conversion,
T is the specified type, which shall be auto." which doesn't allow
type-constraint auto.

	PR c++/104752

gcc/cp/ChangeLog:

	* semantics.cc (finish_compound_literal): Disallow auto{x} for
	is_constrained_auto.
	* typeck2.cc (build_functional_cast_1): Likewise.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp23/auto-fncast12.C: New test.
2022-03-10 11:22:40 -05:00
Marek Polacek ac8310dd12 c++: ICE with operator delete [PR104846]
This is an ICE-on-invalid with "auto operator delete[] (void *)" whose
return type must be void.  The return type is checked in coerce_delete_type
but we never got there in this test, because we took the wrong path in
grokdeclarator, set type to error_mark_node, ended up creating a FIELD_DECL
with build_decl, and confused grokmethod by giving it a FIELD_DECL.

Fixed by not taking the data member path for a FUNCTION_TYPE.

	PR c++/104846

gcc/cp/ChangeLog:

	* decl.cc (grokdeclarator): Check FUNC_OR_METHOD_TYPE_P before giving
	data member errors.

gcc/testsuite/ChangeLog:

	* g++.dg/init/delete5.C: New test.
2022-03-10 09:31:34 -05:00
Jakub Jelinek e46843ff75 c++: allow variadic operator[] for C++23 [PR103460]
wg21.link/p2128 removed "with exactly one parameter" from over.sub
section.  grok_op_properties has for that the last 2 lines in:
    case OVL_OP_FLAG_BINARY:
      if (arity != 2)
        {
          if (operator_code == ARRAY_REF && cxx_dialect >= cxx23)
            break;
but unfortunately it isn't enough, we reject variadic operator[]
earlier.  The following patch accepts variadic operator[] for C++23
too.

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

	PR c++/103460
	* decl.cc (grok_op_properties): Allow variadic operator[] for
	C++23.

	* g++.dg/cpp23/subscript7.C: New test.
2022-03-10 15:28:20 +01:00
Jonathan Wakely 73f3b8a53e libstdc++: Fix std::strong_order to handle NaN on VAX
I mistakenly believed that VAX floats do not support NaN, but with GCC
__builtin_isnan(__builtin_nan("")) is true. That means my previous
change to <compare> is wrong, because it fails to handle NaN.

When std::numeric_limits<floating-point-type>::is_iec559 is false, as on
VAX, the standard only requires an ordering that is consistent with the
ordering observed by comparison operators. With this change the ordering
is -NaN < numbers < +NaN, and there is no support for different NaN bit
patterns (as I'm not even sure if GCC supports any for VAX).

libstdc++-v3/ChangeLog:

	* libsupc++/compare (_Strong_order::_S_fp_cmp) [__vax__]:
	Handle NaN.
2022-03-10 14:25:46 +00:00
David Malcolm c65d3c7f9d analyzer: add notes to write-to-const/string from access attr [PR104793]
The previous patch extended
  -Wanalyzer-write-to-const
  -Wanalyzer-write-to-string-literal
to make use of __attribute__ ((access, ....), but the results could be
inscrutable.

This patch adds notes to such diagnostics to give the user a reason for
why the analyzer is complaining.

Example output:

test.c: In function 'main':
test.c:15:13: warning: write to string literal [-Wanalyzer-write-to-string-literal]
   15 |         if (getrandom((char *)test, sizeof(buf), GRND_RANDOM))
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  'main': event 1
    |
    |   15 |         if (getrandom((char *)test, sizeof(buf), GRND_RANDOM))
    |      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    |      |             |
    |      |             (1) write to string literal here
    |
test.c:3:5: note: parameter 1 of 'getrandom' marked with attribute 'access (write_only, 1, 2)'
    3 | int getrandom (void *__buffer, size_t __length,
      |     ^~~~~~~~~

Unfortunately we don't have location information for the attributes
themselves, just the function declaration, and there doesn't seem to be
a good way of getting at the location of the individual parameters from
the middle end (the C and C++ FEs both have get_fndecl_argument_location,
but the implementations are different).

gcc/analyzer/ChangeLog:
	PR analyzer/104793
	* analyzer.h (class pending_note): New forward decl.
	* diagnostic-manager.cc (saved_diagnostic::saved_diagnostic):
	Initialize m_notes.
	(saved_diagnostic::operator==): Compare m_notes.
	(saved_diagnostic::add_note): New.
	(saved_diagnostic::emit_any_notes): New.
	(diagnostic_manager::add_note): New.
	(diagnostic_manager::emit_saved_diagnostic): Call emit_any_notes
	after emitting the warning.
	* diagnostic-manager.h (saved_diagnostic::add_note): New decl.
	(saved_diagnostic::emit_any_notes): New decl.
	(saved_diagnostic::m_notes): New field.
	(diagnostic_manager::add_note): New decl.
	* engine.cc (impl_region_model_context::add_note): New.
	* exploded-graph.h (impl_region_model_context::add_note): New
	decl.
	* pending-diagnostic.h (class pending_note): New.
	(class pending_note_subclass): New template.
	* region-model.cc (class reason_attr_access): New.
	(check_external_function_for_access_attr): Add class
	annotating_ctxt and use it when checking region.
	(noop_region_model_context::add_note): New.
	* region-model.h (region_model_context::add_note): New vfunc.
	(noop_region_model_context::add_note): New decl.
	(class region_model_context_decorator): New.
	(class note_adding_context): New.

gcc/testsuite/ChangeLog:
	PR analyzer/104793
	* gcc.dg/analyzer/write-to-const-2.c: Add dg-message directives
	for expected notes.
	* gcc.dg/analyzer/write-to-function-1.c: Likewise.
	* gcc.dg/analyzer/write-to-string-literal-2.c: Likewise.
	* gcc.dg/analyzer/write-to-string-literal-3.c: Likewise.
	* gcc.dg/analyzer/write-to-string-literal-4.c: Likewise.
	* gcc.dg/analyzer/write-to-string-literal-5.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-03-10 09:09:40 -05:00
David Malcolm b6eaf90c64 analyzer: check for writes to consts via access attr [PR104793]
This patch extends:
  -Wanalyzer-write-to-const
  -Wanalyzer-write-to-string-literal
so that they will check for __attribute__ ((access, ....) on calls to
externally-defined functions, and complain about read-only regions
pointed to by arguments marked with a "write_only" or "read_write"
attribute.

gcc/analyzer/ChangeLog:
	PR analyzer/104793
	* region-model.cc
	(region_model::check_external_function_for_access_attr): New.
	(region_model::handle_unrecognized_call): Call it.
	* region-model.h
	(region_model::check_external_function_for_access_attr): New decl.
	(region_model::handle_unrecognized_call): New decl.

gcc/testsuite/ChangeLog:
	PR analyzer/104793
	* gcc.dg/analyzer/write-to-const-2.c: New test.
	* gcc.dg/analyzer/write-to-function-1.c: New test.
	* gcc.dg/analyzer/write-to-string-literal-2.c: New test.
	* gcc.dg/analyzer/write-to-string-literal-3.c: New test.
	* gcc.dg/analyzer/write-to-string-literal-4.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-03-10 09:04:03 -05:00
David Malcolm 708646de75 analyzer: fix duplicates in check_for_tainted_size_arg
gcc/analyzer/ChangeLog:
	* sm-taint.cc (taint_state_machine::check_for_tainted_size_arg):
	Avoid generating duplicate saved_diagnostics by only handling the
	rdwr_map entry for the ptrarg, not the duplicate entry for the
	sizarg.

gcc/testsuite/ChangeLog:
	* gcc.dg/analyzer/taint-size-access-attr-1.c: Add
	-fanalyzer-show-duplicate-count to options; verify that a
	duplicate was not created for the tainted size.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-03-10 09:02:18 -05:00
Martin Jambor e671e48e35
ipa-cp: Avoid adjusting references through self-recursion (PR 104813)
When writing the patch that downgrades address-taken references to
load references when IPA-CP can prove that all uses of the taken
address ends up in loads, I unfortunately did not take into account
that find_more_scalar_values_for_callers_subset now happily adds
self-recursive edges to the set of callers which should be immediately
redirected (originally recursion was meant to be handled as edge
redirection in a second pass over the SCC).

The code as it is can now decrement the referece counters too many
times.  This can remedied by removing self-recursive edges earlier, we
already do it because of thunk expansion issues, and so this patch
does exactly that.

gcc/ChangeLog:

2022-03-07  Martin Jambor  <mjambor@suse.cz>

	PR ipa/104813
	* ipa-cp.cc (create_specialized_node): Move removal of
	self-recursive calls from callers vector before refrence
	adjustments.

gcc/testsuite/ChangeLog:

2022-03-07  Martin Jambor  <mjambor@suse.cz>

	PR ipa/104813
	* gcc.dg/ipa/pr104813.c: New test.
2022-03-10 14:50:54 +01:00
Richard Biener ee34ffa429 tree-optimization/102943 - use tree form for sbr_sparse_bitmap
The following arranges to remove an indirection do the bitvector
in sbr_sparse_bitmap by embedding bitmap_head instead of bitmap
and using the tree form (since we only ever set/query individual
aligned bit chunks).  That shaves off 6 seconds from 70 seconds
of the slowest 521.wrf_r LRANS unit build.

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

	PR tree-optimization/102943
	* gimple-range-cache.cc (sbr_sparse_bitmap::bitvec):
	Make a bitmap_head.
	(sbr_sparse_bitmap::sbr_sparse_bitmap): Adjust and switch
	to tree view.
	(sbr_sparse_bitmap::set_bb_range): Adjust.
	(sbr_sparse_bitmap::get_bb_range): Likewise.
2022-03-10 13:43:19 +01:00
Richard Biener 9467e73311 ada/104861 - use target_noncanonial for Target_Name
The following arranges for s-oscons.ads to record target_noncanonical
for Target_Name, matching the install directory layout and what
gcc -dumpmachine says.  This fixes build issues with gprbuild.

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

	PR ada/104861
gcc/ada/
	* gcc-interface/Makefile.in (target_noncanonical): Substitute.
	(OSCONS_CPP): Pass target_noncanonical as TARGET.
2022-03-10 13:40:25 +01:00
Richard Biener 83bc478d3b tree-optimization/102943 - avoid (re-)computing dominance bitmap
Currently back_propagate_equivalences tries to optimize dominance
queries in a smart way but it fails to notice that when fast indexes
are available the dominance query is fast (when called from DOM).
It also re-computes the dominance bitmap for each equivalence recorded
on an edge, which for FP are usually several.  Finally it fails to
use the tree bitmap view for efficiency.  Overall this cuts 7
seconds of compile-time from originally 77 in the slowest LTRANS
unit when building 521.wrf_r.

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

	PR tree-optimization/102943
	* tree-ssa-dom.cc (back_propagate_equivalences): Only
	populate the dominance bitmap if fast queries are not
	available.  Use a tree view bitmap.
	(record_temporary_equivalences): Cache the dominance bitmap
	across all equivalences on the edge.
2022-03-10 13:40:25 +01:00
Jonathan Wakely cfaa2fac42 libstdc++: Support VAX floats in std::strong_order
The VAX float and double format does not support NaN, so the
std::partial_ordering returned by <=> will never be 'unordered'. We can
just use the partial_ordering value as the strong_ordering.

libstdc++-v3/ChangeLog:

	* libsupc++/compare (_Strong_ordering::_S_fp_cmp) [__vax__]: Use
	<=> comparison.
2022-03-10 11:49:00 +00:00
Jonathan Wakely d563b0bff1 contrib: Fix non-portable shell commands in gcc-git-customization.sh [PR102664]
Use printf instead of echo -n. Use Basic Regular Expressions instead of
sed -r. Check for error from ancient Git versions that don't support the
--git-path option for git-rev-parse. Remove -c flag from install
command, as it's ignored by GNU and BSD install, but means something
different for Solaris and AIX.

contrib/ChangeLog:

	PR other/102664
	* gcc-git-customization.sh: Fix non-portable commands.
2022-03-10 11:48:59 +00:00
Tom de Vries 3357878ef5 [nvptx] Use no,yes for attribute predicable
The documentation states about the predicable instruction attribute:
...
This attribute must be a boolean (i.e. have exactly two elements in its
list-of-values), with the possible values being no and yes.
...

The nvptx port has instead:
...
(define_attr "predicable" "false,true"
  (const_string "true"))
...

Fix this by updating to:
...
(define_attr "predicable" "no,yes"
  (const_string "yes"))
...

Tested on nvptx.

gcc/ChangeLog:

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

	PR target/104840
	* config/nvptx/nvptx.md (define_attr "predicable"): Use no,yes instead
	of false,true.
2022-03-10 12:21:30 +01:00