Jakub Jelinek [Thu, 6 Oct 2022 22:16:11 +0000 (00:16 +0200)]
libgcc, arc: Fix build
Missed one spot in the r13-3108-g146e45914032 change (my sed script
didn't expect nested []s).
2022-10-07 Jakub Jelinek <jakub@redhat.com>
* config/arc/linux-unwind.h (arc_fallback_frame_state): Use
fs->regs.how[X] instead of fs->regs.reg[X].how.
Jason Merrill [Fri, 30 Sep 2022 14:04:22 +0000 (10:04 -0400)]
c++: fix broken conversion in coroutines
You can't use CONVERT_EXPR to convert between two class types.
VIEW_CONVERT_EXPR takes liberties with the C++ type system, but is probably
safe in this context. Let's also only use it when the type isn't already
what we want.
gcc/cp/ChangeLog:
* coroutines.cc (expand_one_await_expression): Change conversion
to VIEW_CONVERT_EXPR.
* cp-gimplify.cc (cp_genericize_r) [CONVERT_EXPR]: Add assert.
Aldy Hernandez [Thu, 6 Oct 2022 17:11:08 +0000 (19:11 +0200)]
[PR107170] Avoid copying incompatible types in legacy VRP.
Legacy VRP is calling ranger deep inside the bowels, and then trying to
copy an incompatible type. My previous patch in this area assumed that
the only possibility out of vr_values::get_value_range for an
unsupported type was VARYING, but UNDEFINED can also be returned.
PR tree-optimization/107170
gcc/ChangeLog:
* vr-values.cc (vr_values::range_of_expr): Do not die on
unsupported types.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/pr107170.c: New test.
David Malcolm [Thu, 6 Oct 2022 19:46:49 +0000 (15:46 -0400)]
analyzer: fix another ICE in PR 107158
I overreduced PR analyzer/107158 in r13-3096-gef878564140cbc, and there
was another ICE in the original reproducer, which this patch fixes.
gcc/analyzer/ChangeLog:
PR analyzer/107158
* store.cc (store::replay_call_summary_cluster): Eliminate
special-casing of RK_HEAP_ALLOCATED in favor of sharing code with
RK_DECL, avoiding an ICE due to attempting to bind a
compound_svalue into a binding_cluster when an svalue in the
summary cluster converts to a compound_svalue in the caller.
gcc/testsuite/ChangeLog:
PR analyzer/107158
* gcc.dg/analyzer/call-summaries-pr107158-2.c: New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
David Malcolm [Thu, 6 Oct 2022 19:46:20 +0000 (15:46 -0400)]
analyzer: fixes to call_summary_replay::dump_to_pp
gcc/analyzer/ChangeLog:
* call-summary.cc (call_summary_replay::dump_to_pp): Bulletproof
against NULL caller regions/svalues.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Tobias Burnus [Thu, 6 Oct 2022 16:42:32 +0000 (18:42 +0200)]
openmp: Map holds clause to IFN_ASSUME for Fortran
Same as r13-3107-g847f5addc4d07a2f3b95f5daa50ab4a64dfd957d did for C/C++.
Convert '!$omp assume holds(cond)' to IFN_ASSUME (cond).
gcc/fortran/
* trans-openmp.cc (gfc_trans_omp_assume): New.
(gfc_trans_omp_directive): Call it.
gcc/testsuite/
* gfortran.dg/gomp/assume-3.f90: New test.
* gfortran.dg/gomp/assume-4.f90: New test.
Joseph Myers [Thu, 6 Oct 2022 14:26:21 +0000 (14:26 +0000)]
c: C2x typeof
C2x adds typeof as a standard feature. In general this follows
existing GNU C semantics very closely, but there are various ways in
which the implementation involves more than simply enabling the
keyword for C2x:
* As well as typeof, there is a typeof_unqual variant, which removes
all qualifiers and _Atomic from the resulting type (whereas typeof
preserves qualifiers and _Atomic on qualified or atomic (lvalue or
type name) operands).
* The typeof keyword is disabled by -fno-asm, so enabling it for C2x
needs to be implemented in a way that preserves the disabling by
-fno-asm for older standard versions (which having -fno-asm having
no effect on it in C2x mode). This is done via adding a new D_EXT11
mask (which is also where the C++ front-end change comes from, to
handle D_EXT11 appropriately there for -fno-asm and
-fno-gnu-keywords).
* GNU typeof treats the noreturn property of a function (as specified
in standard C with _Noreturn or [[noreturn]]) as being part of the
type of a pointer to function, but it is not part of the type in
standard terms. Thus a special case is needed in the typeof
implementation, just like in the _Generic implementation, to avoid
treating it as a type for standard typeof. It seems plausible this
is being used when copying the type of one object to another using
typeof, so the existing semantics are preserved for __typeof__, and
for typeof in pre-C2x modes, while typeof for C2x or later has the
standard semantics.
* It turns out that, even after Martin Uecker's changes in this area,
there were still cases where rvalues could wrongly have a qualified
or atomic type in GCC. This applied to ++ and -- increment and
decrement expressions, and also to calls to functions returning an
atomic type. (For the latter, the working draft doesn't actually
explicitly exclude the function call expression having an atomic
type, but given all the changes that have gone into C17 and C2x to
avoid rvalues ever having qualified types, and given that
lvalue-to-rvalue conversion removes both qualifiers and _Atomic, it
seems unlikely that this (or casts, where GCC already removes
_Atomic) is actually intended as a route to allow an
_Atomic-qualified rvalue; I've noted this to raise as an NB comment
on the CD ballot.)
Bootstrapped with no regressions for x86_64-pc-linux-gnu. OK to
commit (C+
gcc/
* doc/invoke.texi (-fno-asm): Update description of effects on
typeof keyword.
gcc/c-family/
* c-common.cc (c_common_reswords): Mark typeof as D_EXT11. Add
typeof_unqual.
* c-common.h (enum rid): Add RID_TYPEOF_UNQUAL.
(D_EXT11): New macro. Values of subsequent macros updated.
gcc/c/
* c-parser.cc (c_parse_init): Add D_EXT11 to mask if flag_no_asm
and not C2x.
(c_keyword_starts_typename, c_token_starts_declspecs)
(c_parser_declspecs, c_parser_objc_selector): Handle
RID_TYPEOF_UNQUAL.
(c_parser_typeof_specifier): Handle RID_TYPEOF_UNQUAL.
Distinguish typeof for C2x from __typeof__ for all standard
versions and typeof before C2x.
* c-typeck.cc (build_function_call_vec): Use unqualified version
of non-void return type.
(build_unary_op): Use unqualified type for increment and
decrement.
gcc/cp/
* lex.cc (init_reswords): Handle D_EXT11.
gcc/testsuite/
* gcc.dg/c11-typeof-1.c, gcc.dg/c2x-typeof-1.c,
gcc.dg/c2x-typeof-2.c, gcc.dg/c2x-typeof-3.c,
gcc.dg/gnu11-typeof-1.c, gcc.dg/gnu11-typeof-2.c,
gcc.dg/gnu2x-typeof-1.c: New tests.
Patrick Palka [Thu, 6 Oct 2022 14:04:52 +0000 (10:04 -0400)]
c++: remove optimize_specialization_lookup_p
Roughly speaking, optimize_specialization_lookup_p returns true for a
non-template member function of a class template, e.g.
template<class T> struct A { int f(); };
The idea behind the optimization guarded by this predicate is that if
we want to look up the specialization A<T>::f [with T=int], then we can
just do a name lookup for f in A<int> and avoid having to add a
spec_entry for f in the decl_specializations table.
But the benefit of this optimization seems questionable because in
order to do the name lookup we first need to look up A<T> [with T=int]
in the type_specializations table, which is as expensive as the
decl_specializations lookup we're avoiding. And according to some
experiments (using stdc++.h, range-v3 and libstdc++ tests) the compiler
is slightly (<1%) _faster_ if we disable this optimization.
Additionally, this optimization means we won't record an explicit
specialization in decl_specializations for such a template either, which
is an unfortunate inconsistency that apparently breaks the below modules
testcase.
So since this optimization doesn't improve performance, and complicates
the explicit specialization story which causes issues with modules, this
patch proposes to remove it.
gcc/cp/ChangeLog:
* pt.cc (optimize_specialization_lookup_p): Remove.
(retrieve_specialization): Assume the above returns false
and simplify accordingly.
(register_specialization): Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/modules/indirect-3_b.C: Expect that the entity
foo::TPL<0>::frob is tagged as a specialization instead
of as a declaration.
* g++.dg/modules/tpl-spec-8_a.H: New test.
* g++.dg/modules/tpl-spec-8_b.C: New test.
Eric Botcazou [Thu, 6 Oct 2022 13:13:50 +0000 (15:13 +0200)]
Fix wrong code generated by unroll-and-jam pass
There is a loophole in the unroll-and-jam pass that can quickly result in
wrong code generation. The code reads:
if (!compute_data_dependences_for_loop (outer, true, &loop_nest,
&datarefs, &dependences))
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Cannot analyze data dependencies\n");
free_data_refs (datarefs);
free_dependence_relations (dependences);
continue;
}
but compute_data_dependences_for_loop may return true even if the analysis
is reported as failing by compute_affine_dependence for a dependence pair:
(compute_affine_dependence
ref_a: data[_14], stmt_a: data[_14] = i_59;
ref_b: data[_14], stmt_b: data[_14] = i_59;
Data ref a:
Data ref b:
affine dependence test not usable: access function not affine or constant.
) -> dependence analysis failed
Note that this is a self-dependence pair and the code for them reads:
/* Nothing interesting for the self dependencies. */
if (dra == drb)
continue;
This means that the pass may reorder "complex" accesses to the same memory
location in successive iterations, which is OK for reads but not for writes.
gcc/
* gimple-loop-jam.cc (tree_loop_unroll_and_jam): Bail out for a self
dependency that is a write-after-write if the access function is not
affine or constant.
gcc/testsuite/
* gcc.c-torture/execute/
20221006-1.c: New test.
Eric Botcazou [Thu, 6 Oct 2022 13:12:53 +0000 (15:12 +0200)]
Minor cleanup in DF code
No functional changes.
gcc/
* df-scan.cc (df_ref_create_structure): Minor cleanup.
Richard Biener [Thu, 6 Oct 2022 09:48:03 +0000 (11:48 +0200)]
middle-end/107115 - avoid bogus redundant store removal during RTL expansion
The following preserves the (premature) redundant store removal
done in store_expr by appropriately guarding it with
mems_same_for_tbaa_p. The testcase added needs scheduling disabled
for now since there's a similar bug there still present.
PR middle-end/107115
* expr.cc (store_expr): Check mems_same_for_tbaa_p before
eliding a seemingly redundant store.
* gcc.dg/torture/pr107115.c: New testcase.
Kyrylo Tkachov [Thu, 6 Oct 2022 11:09:28 +0000 (12:09 +0100)]
aarch64: Remove redundant zero-extends with LDAR
Like other loads in AArch64, the LDARB,LDARH,LDAR instructions clear out the top part of their
destination register and we can thus avoid having to explicitly zero-extend it.
We were missing a combine pattern that this patch adds.
For one of the examples in the testcase we generated:
load_uint8_t_ext_uint16_t:
adrp x0, .LANCHOR0
add x0, x0, :lo12:.LANCHOR0
ldarb w0, [x0]
and w0, w0, 255
ret
but now generate:
load_uint8_t_ext_uint16_t:
adrp x0, .LANCHOR0
add x0, x0, :lo12:.LANCHOR0
ldarb w0, [x0]
ret
Bootstrapped and tested on aarch64-none-linux-gnu.
gcc/ChangeLog:
* config/aarch64/atomics.md (*atomic_load<ALLX:mode>_zext<SD_HSDI:mode>):
New pattern.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/ldar_2.c: New test.
Kyrylo Tkachov [Thu, 6 Oct 2022 11:08:40 +0000 (12:08 +0100)]
aarch64: Add test for LDAR generation from __atomic_load_n
I'd like a test to check the generation of LDAR for atomic_load_n.
No new functionality added.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/ldar_1.c: New test.
Philipp Tomsich [Sun, 7 Aug 2022 22:30:52 +0000 (00:30 +0200)]
aarch64: update Ampere-1 core definition
This brings the extensions detected by -mcpu=native on Ampere-1 systems
in sync with the defaults generated for -mcpu=ampere1.
Note that some early kernel versions on Ampere1 may misreport the
presence of PAUTH and PREDRES (i.e., -mcpu=native will add 'nopauth'
and 'nopredres').
gcc/ChangeLog:
* config/aarch64/aarch64-cores.def (AARCH64_CORE): Update
Ampere-1 core entry.
Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
Philipp Tomsich [Mon, 3 Oct 2022 19:59:50 +0000 (21:59 +0200)]
aarch64: fix off-by-one in reading cpuinfo
Fixes:
341573406b39
Don't subtract one from the result of strnlen() when trying to point
to the first character after the current string. This issue would
cause individual characters (where the 128 byte buffers are stitched
together) to be lost.
gcc/ChangeLog:
* config/aarch64/driver-aarch64.cc (readline): Fix off-by-one.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/cpunative/info_18: New test.
* gcc.target/aarch64/cpunative/native_cpu_18.c: New test.
Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
Richard Biener [Thu, 6 Oct 2022 09:20:16 +0000 (11:20 +0200)]
tree-optimization/107107 - tail-merging VN wrong-code
The following fixes an unintended(?) side-effect of the special
MODIFY_EXPR expression entries we add for tail-merging during VN.
We shouldn't value-number the virtual operand differently here.
PR tree-optimization/107107
* tree-ssa-sccvn.cc (visit_reference_op_store): Do not
affect value-numbering when doing the tail merging
MODIFY_EXPR lookup.
* gcc.dg/pr107107.c: New testcase.
Eric Botcazou [Fri, 23 Sep 2022 10:18:22 +0000 (12:18 +0200)]
ada: Implementation of support for storage models in gigi
It is based on a new LOAD_EXPR node in GENERIC that is later turned into
a bona-fide temporary during gimplification.
gcc/ada/
* gcc-interface/ada-tree.def (LOAD_EXPR): New expression code.
* gcc-interface/gigi.h (build_storage_model_load): Declare.
(build_storage_model_store): Likewise.
(instantiate_load_in_expr): Likewise.
(INSTANTIATE_LOAD_IN_EXPR): New macro.
(instantiate_load_in_array_ref): Declare.
* gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Record_Type>: Set a
fake discriminant number on the fields of the template type.
(gnat_to_gnu_field): Use integer for DECL_DISCRIMINANT_NUMBER.
* gcc-interface/misc.cc (gnat_init_ts): Mark LOAD_EXPR as typed.
* gcc-interface/trans.cc (fold_constant_decl_in_expr) <ARRAY_REF>:
Also preserve the 4th operand.
(Attribute_to_gnu): Deal with LOAD_EXPR of unconstrained array type.
<Attr_Size>: Call INSTANTIATE_LOAD_IN_EXPR for a storage model.
<Attr_Length>: Likewise.
<Attr_Bit_Position>: Likewise.
(get_storage_model): New function.
(get_storage_model_access): Likewise.
(storage_model_access_required_p): Likewise.
(Call_to_gnu): Add GNAT_STORAGE_MODEL parameter and deal with it.
Also deal with actual parameters that have a storage model.
(gnat_to_gnu) <N_Object_Declaratio>: Adjust call to Call_to_gnu.
<N_Explicit_Dereference>: Deal with a storage model access.
<N_Indexed_Component>: Likewise.
<N_Slice>: Likewise.
<N_Selected_Component>: Likewise.
<N_Assignment_Statement>: Adjust call to Call_to_gnu. Deal with a
storage model access either on the LHS, on the RHS or on both.
<N_Function_Cal>: Adjust call to Call_to_gnu.
<N_Free_Statement>: Deal with a pool that is a storage model.
Replace test for UNCONSTRAINED_ARRAY_REF with test on the type.
(gnat_gimplify_expr) <CALL_EXPR>: Tidy up.
<LOAD_EXPR>: New case.
<UNCONSTRAINED_ARRAY_REF>: Move down.
* gcc-interface/utils.cc (maybe_unconstrained_array): Deal with a
LOAD_EXPR by recursing on its first operand.
* gcc-interface/utils2.cc (build_allocator): Deal with a pool that
is a storage model.
(build_storage_model_copy): New function.
(build_storage_model_load): Likewise.
(build_storage_model_store): Likewise.
(instantiate_load_in_expr): Likewise.
(instantiate_load_in_array_ref): Likewise.
(gnat_rewrite_reference) <ARRAY_REF>: Also preserve the 4th operand.
(get_inner_constant_reference) <ARRAY_REF>: Remove useless test.
(gnat_invariant_expr) <ARRAY_REF>: Rewrite test.
Steve Baird [Fri, 30 Sep 2022 18:14:20 +0000 (11:14 -0700)]
ada: Minor potential bug in sem_ch6.adb
In sem_ch6.adb, the procedure Analyze_Procedure_Call is preceded with a
comment:
-- WARNING: This routine manages Ghost regions. Return statements must be
-- replaced by gotos that jump to the end of the routine and restore the
-- Ghost mode.
Correct a violation of this comment. This is a one-line change.
gcc/ada/
* sem_ch6.adb
(Analyze_Procedure_Call): Replace "return;" with "goto Leave;", as
per comment preceding body of Analyze_Procedure_Call.
Piotr Trojanek [Mon, 3 Oct 2022 14:49:19 +0000 (16:49 +0200)]
ada: Reject conditional goto in lock-free protected subprograms
In lock-free protected subprograms we don't allow goto statements;
likewise, we now reject conditional goto statements.
This fix only affects semantic checking mode with switch -gnatc.
In ordinary compilation we already rejected conditional goto after
it was expanded into ordinary goto.
gcc/ada/
* sem_ch9.adb (Allows_Lock_Free_Implementation): Reject
conditional goto statements.
Piotr Trojanek [Mon, 3 Oct 2022 14:45:49 +0000 (16:45 +0200)]
ada: Cleanup related to lock-free protected subprograms
Cleanup code and documentation; semantics is unaffected.
gcc/ada/
* doc/gnat_rm/implementation_defined_pragmas.rst
(Lock_Free): Remove inconsistent periods that end item
descriptions.
* sem_ch9.adb
(Allows_Lock_Free_Implementation): Remove unnecessary guard
against an empty list of parameters; replace low-level entity kind
membership test with a high-level query; refill error message.
* gnat_rm.texi: Regenerate.
Alexandre Oliva [Thu, 8 Sep 2022 02:49:58 +0000 (23:49 -0300)]
ada: hardened conditionals: exemplify codegen changes
gcc/ada/
* doc/gnat_rm/security_hardening_features.rst: Add examples of
codegen changes in hardened conditionals.
* gnat_rm.texi: Regenerate.
Alexandre Oliva [Thu, 8 Sep 2022 03:15:19 +0000 (00:15 -0300)]
ada: hardened booleans: exemplify codegen changes
Show the sort of code that is to be expected from using hardened
booleans in Ada code. Mention that C traps instead of raising
exceptions.
gcc/ada/
* doc/gnat_rm/security_hardening_features.rst: Add examples of
codegen changes in hardened booleans. Mention that C traps where
Ada raises exceptions.
* gnat_rm.texi: Regenerate.
Alexandre Oliva [Thu, 8 Sep 2022 03:33:15 +0000 (00:33 -0300)]
ada: stack scrubbing: exemplify codegen changes
gcc/ada/
* doc/gnat_rm/security_hardening_features.rst: Add examples of
codegen changes in stack scrubbing.
* gnat_rm.texi: Regenerate.
Piotr Trojanek [Fri, 30 Sep 2022 14:56:37 +0000 (16:56 +0200)]
ada: Fix inserting of validity checks in lock-free protected subprograms
Validity checks for statements in a lock-free implementation of
protected subprogram were wrongly inserted in front of the original
statements. This happened because the lock-free implementation was
created as a shallow copy, where only the protected body statements were
copied while its children still had the Parent pointing to the original
statements.
gcc/ada/
* exp_ch9.adb (Build_Lock_Free_Protected_Subprogram_Body): Replace
shallow copy of protected statements with a deep copy.
Marc Poulhiès [Thu, 28 Jul 2022 13:57:46 +0000 (15:57 +0200)]
ada: Add C declarations for Storage Model support
Add needed C declarations for Storage Model support in gigi.
gcc/ada/
* fe.h (Has_Storage_Model_Type_Aspect)
(Has_Designated_Storage_Model_Aspect, Storage_Model_Object)
(Storage_Model_Copy_From, Storage_Model_Copy_To): Add
declarations.
* sem_util.ads: Add WARNING markers for functions for which a new
C declaration has been added in fe.h
Steve Baird [Wed, 28 Sep 2022 17:32:00 +0000 (10:32 -0700)]
ada: Incorrect inferences drawn from if/elsif/while conditions with -gnatVo
Within the first (respectively, second) statement list of this if statement
declare
X : constant Integer := ... ;
begin
if X > 0 then
...;
else
...;
end if;
end;
we can safely assume that X is greater (respectively, not greater) than 0.
Fix a bug that incorrectly computed the region in which such assumptions
can be made to include the condition of the if-statement. This bug usually
had no effect because semantic analysis/simplification of the condition was
already complete before the code containing the bug was executed.
Unfortunately, this is not true in some cases involving -gnatVo validity
checking. In these cases, the bug could result in incorrect simplification
of the condition at compile time. This, in turn, could lead to incorrect
unconditional execution of one arm of the if-statement at run time. Similar
errors appear to be possible for the conditions of an elsif or a while loop;
the fix addresses these cases as well, although corresponding problems with
these constructs have not been demonstrated.
gcc/ada/
* exp_util.adb
(Get_Current_Value_Condition): Treat references occurring within
the condition of an if statement, an elsif, or a while loop in the
same way as references that occur before the start of that
enclosing construct.
Gary Dismukes [Wed, 28 Sep 2022 17:22:26 +0000 (13:22 -0400)]
ada: Accessibility error incorrectly flagged on call within Pre'Class expression
The compiler was wrongly reporting an error on a function call within
a Pre'Class expression when a formal of the aspect's subprogram was
passed to an aliased formal. This occurred due to the call appearing
with the return statement of the wrapper function created for the
precondition, but the accessibility error check should only be done
for return statements that appear in the source program.
gcc/ada/
* sem_ch4.adb (Analyze_Call): Add test of Comes_From_Source on the
enclosing subprogram's Entity_Id for determining whether to
perform the compile-time accessibility check on actuals passed to
aliased formals in a function call occurring within a return
statement. That test excludes cases where the call occurs within
the return statement of a Pre'Class wrapper function.
Bob Duff [Wed, 28 Sep 2022 15:24:49 +0000 (11:24 -0400)]
ada: Clean up slice-of-component optimization
In the recursive case of Volatile_Or_Independent = False for array
types, fall through into later checks, so for example we check
the type of the prefix of a slice. The pattern here is "return True
in certain cases, otherwise fall through into the final 'return False'".
Remove check for "Ndim = 1"; if Slices is True, then the number of
dimensions is necessarily 1, because Ada doesn't have multi-dimensional
slices.
gcc/ada/
* exp_ch5.adb
(Expand_Assign_Array_Loop_Or_Bitfield): Minor cleanups.
Yannick Moy [Fri, 23 Sep 2022 15:14:52 +0000 (17:14 +0200)]
ada: Do not issue compiler warnings in GNATprove mode
Use of pragma Warning with a string literal to set warning
switches, should not impact GNATprove which is not subject
to these switches.
gcc/ada/
* sem_prag.adb (Analyze_Pragma): Ignore one variant of pragma
Warnings in GNATprove mode.
Bob Duff [Tue, 27 Sep 2022 16:10:21 +0000 (12:10 -0400)]
ada: Disable slice-of-component optimization in some cases
This patch disables the Fast_Copy_Bitfield optimization in certain rare
cases that currently do not work (crash in gigi). We could improve
Expand_Assign_Array_Bitfield_Fast to handle these cases properly, but
that change is delicate, so for now, we simply disable the optimization.
gcc/ada/
* exp_ch5.adb
(Expand_Assign_Array_Loop_Or_Bitfield): Disable the
Fast_Copy_Bitfield optimization in certain cases.
Piotr Trojanek [Mon, 26 Sep 2022 10:51:41 +0000 (12:51 +0200)]
ada: Fix spurious warning on unreferenced refinement constituents
Listing an object as a state refinement constituent shouldn't be
considered to be a reference, at least from the point of view of the
machinery for detecting objects that are never referenced or written
without being referenced.
This patch fixes a spurious warning that rarely occurred in practice but
was annoyingly emitted for minimal reproducers for issues related to
state abstractions.
Note: there are other pragmas that should be similarly recognized (e.g.
Depends, Global and their refined variants), but recognizing them
efficiently probably requires a dedicated utility routine (i.e. to avoid
traversal of the parent chain for every kind of pragma).
gcc/ada/
* sem_prag.adb
(Sig_Pragma): Change flag for pragma Refined_State to mean "not
significant"; this is primarily for documentation, because the
exact value of the flag is not really taken into account for
Refined_State.
(Is_Non_Significant_Pragma_Reference): Add special handling for
pragma Refined_State.
Martin Liska [Thu, 6 Oct 2022 09:14:48 +0000 (11:14 +0200)]
git_update_version: add robust logging
contrib/ChangeLog:
* gcc-changelog/git_update_version.py: Use logging module
and provide robust debugging output.
Claudiu Zissulescu [Thu, 6 Oct 2022 08:36:31 +0000 (11:36 +0300)]
arc: Remove max-page-size and common-page-size forced setting
Max page size is defined in the ARC's BFD file, and the common page
size is also set by the appropriate binutils macros. Remove them from
LINK_SPEC.
2022-10-06 Claudiu Zissulescu <claziss@synopsys.com>
* config/arc/linux.h (LINK_SPEC): Remove max-page-size and
common-pave-size.
Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
Jakub Jelinek [Thu, 6 Oct 2022 09:04:52 +0000 (11:04 +0200)]
libgcc: Decrease size of _Unwind_FrameState and even more size of cleared area in uw_frame_state_for
The following patch implements something that has Florian found as
low hanging fruit in our unwinder and has been discussed in the
https://gcc.gnu.org/wiki/cauldron2022#cauldron2022talks.inprocess_unwinding_bof
talk.
_Unwind_FrameState type seems to be (unlike the pre-GCC 3 frame_state
which has been part of ABI) private to unwind-dw2.c + unwind.inc it
includes, it is always defined on the stack of some entrypoints, initialized
by static uw_frame_state_for and the address of it is also passed to other
static functions or the static inlines handling machine dependent unwinding,
but it isn't fortunately passed to any callbacks or public functions, so I
think we can safely change it any time we want.
Florian mentioned that the structure is large even on x86_64, 384 bytes
there, starts with 328 bytes long element with frame_state_reg_info type
which then starts with an array with __LIBGCC_DWARF_FRAME_REGISTERS__ + 1
elements, each of them is 16 bytes long, on x86_64
__LIBGCC_DWARF_FRAME_REGISTERS__ is just 17 but even that is big, on say
riscv __LIBGCC_DWARF_FRAME_REGISTERS__ is I think 128, on powerpc 111,
on sh 153 etc. And, we memset to zero the whole fs variable with the
_Unwind_FrameState type at the start of the unwinding.
The reason why each element is 16 byte (on 64-bit arches) is that it
contains some pointer or pointer sized integer and then an enum (with just
7 different enumerators) + padding.
The following patch decreases it by moving the enum into a separate
array and using just one byte for each register in that second array.
We could compress it even more, say 4 bits per register, but I don't
want to uglify the code for it too much and make the accesses slower.
Furthermore, the clearing of the object can clear only thos how array
and members after it, because REG_UNSAVED enumerator (0) doesn't actually
need any pointer or pointer sized integer, it is just the other kinds
that need to have there something.
By doing this, on x86_64 the above numbers change to _Unwind_FrameState
type being now 264 bytes long, frame_state_reg_info 208 bytes and we
don't clear the first 144 bytes of the object, so the memset is 120 bytes,
so ~ 31% of the old clearing size. On riscv 64-bit assuming it has same
structure layout rules for the few types used there that would be
~ 2160 bytes of _Unwind_FrameState type before and ~ 1264 bytes after,
with the memset previously ~ 2160 bytes and after ~ 232 bytes after.
We've also talked about possibly adding a number of initially initialized
regs and initializing the rest lazily, but at least for x86_64 with
18 elements in the array that doesn't seem to be worth it anymore,
especially because return address column is 16 there and that is usually the
first thing to be touched. It might theory help with lots of registers if
they are usually untouched, but would uglify and complicate any stores to
how by having to check there for the not initialized yet cases and lazy
initialization, and similarly for all reads of how to do there if below
last initialized one, use how, otherwise imply REG_UNSAVED.
The disadvantage of the patch is that touching reg[x].loc and how[x]
now means 2 cachelines rather than one as before, and I admit beyond
bootstrap/regtest I haven't benchmarked it in any way.
2022-10-06 Jakub Jelinek <jakub@redhat.com>
* unwind-dw2.h (REG_UNSAVED, REG_SAVED_OFFSET, REG_SAVED_REG,
REG_SAVED_EXP, REG_SAVED_VAL_OFFSET, REG_SAVED_VAL_EXP,
REG_UNDEFINED): New anonymous enum, moved from inside of
struct frame_state_reg_info.
(struct frame_state_reg_info): Remove reg[].how element and the
anonymous enum there. Add how element.
* unwind-dw2.c: Include stddef.h.
(uw_frame_state_for): Don't clear first
offsetof (_Unwind_FrameState, regs.how[0]) bytes of *fs.
(execute_cfa_program, __frame_state_for, uw_update_context_1,
uw_update_context): Use fs->regs.how[X] instead of fs->regs.reg[X].how
or fs.regs.how[X] instead of fs.regs.reg[X].how.
* config/sh/linux-unwind.h (sh_fallback_frame_state): Likewise.
* config/bfin/linux-unwind.h (bfin_fallback_frame_state): Likewise.
* config/pa/linux-unwind.h (pa32_fallback_frame_state): Likewise.
* config/pa/hpux-unwind.h (UPDATE_FS_FOR_SAR, UPDATE_FS_FOR_GR,
UPDATE_FS_FOR_FR, UPDATE_FS_FOR_PC, pa_fallback_frame_state):
Likewise.
* config/alpha/vms-unwind.h (alpha_vms_fallback_frame_state):
Likewise.
* config/alpha/linux-unwind.h (alpha_fallback_frame_state): Likewise.
* config/arc/linux-unwind.h (arc_fallback_frame_state,
arc_frob_update_context): Likewise.
* config/riscv/linux-unwind.h (riscv_fallback_frame_state): Likewise.
* config/nios2/linux-unwind.h (NIOS2_REG): Likewise.
* config/nds32/linux-unwind.h (NDS32_PUT_FS_REG): Likewise.
* config/s390/tpf-unwind.h (s390_fallback_frame_state): Likewise.
* config/s390/linux-unwind.h (s390_fallback_frame_state): Likewise.
* config/sparc/sol2-unwind.h (sparc64_frob_update_context,
MD_FALLBACK_FRAME_STATE_FOR): Likewise.
* config/sparc/linux-unwind.h (sparc64_fallback_frame_state,
sparc64_frob_update_context, sparc_fallback_frame_state): Likewise.
* config/i386/sol2-unwind.h (x86_64_fallback_frame_state,
x86_fallback_frame_state): Likewise.
* config/i386/w32-unwind.h (i386_w32_fallback_frame_state): Likewise.
* config/i386/linux-unwind.h (x86_64_fallback_frame_state,
x86_fallback_frame_state): Likewise.
* config/i386/freebsd-unwind.h (x86_64_freebsd_fallback_frame_state):
Likewise.
* config/i386/dragonfly-unwind.h
(x86_64_dragonfly_fallback_frame_state): Likewise.
* config/i386/gnu-unwind.h (x86_gnu_fallback_frame_state): Likewise.
* config/csky/linux-unwind.h (csky_fallback_frame_state): Likewise.
* config/aarch64/linux-unwind.h (aarch64_fallback_frame_state):
Likewise.
* config/aarch64/freebsd-unwind.h
(aarch64_freebsd_fallback_frame_state): Likewise.
* config/aarch64/aarch64-unwind.h (aarch64_frob_update_context):
Likewise.
* config/or1k/linux-unwind.h (or1k_fallback_frame_state): Likewise.
* config/mips/linux-unwind.h (mips_fallback_frame_state): Likewise.
* config/loongarch/linux-unwind.h (loongarch_fallback_frame_state):
Likewise.
* config/m68k/linux-unwind.h (m68k_fallback_frame_state): Likewise.
* config/xtensa/linux-unwind.h (xtensa_fallback_frame_state):
Likewise.
* config/rs6000/darwin-fallback.c (set_offset): Likewise.
* config/rs6000/aix-unwind.h (MD_FROB_UPDATE_CONTEXT): Likewise.
* config/rs6000/linux-unwind.h (ppc_fallback_frame_state): Likewise.
* config/rs6000/freebsd-unwind.h (frob_update_context): Likewise.
Jakub Jelinek [Thu, 6 Oct 2022 08:39:41 +0000 (10:39 +0200)]
openmp: Map holds clause to IFN_ASSUME for C/C++
Now that [[assume (cond)]] support is in, this simple patch makes
#pragma omp assume holds(cond)
use it.
2022-10-06 Jakub Jelinek <jakub@redhat.com>
* c-parser.cc (c_parser_omp_assumption_clauses): Emit IFN_ASSUME
call for holds clause on assume construct.
* parser.cc (cp_parser_omp_assumption_clauses): Emit IFN_ASSUME
call for holds clause on assume construct.
* c-c++-common/gomp/assume-4.c: New test.
Jakub Jelinek [Thu, 6 Oct 2022 06:56:48 +0000 (08:56 +0200)]
c++, c: Implement C++23 P1774R8 - Portable assumptions [PR106654]
The following patch implements C++23 P1774R8 - Portable assumptions
paper, by introducing support for [[assume (cond)]]; attribute for C++.
In addition to that the patch adds [[gnu::assume (cond)]]; and
__attribute__((assume (cond))); support to both C and C++.
As described in C++23, the attribute argument is conditional-expression
rather than the usual assignment-expression for attribute arguments,
the condition is contextually converted to bool (for C truthvalue conversion
is done on it) and is never evaluated at runtime.
For C++ constant expression evaluation, I only check the simplest conditions
for undefined behavior, because otherwise I'd need to undo changes to
*ctx->global which happened during the evaluation (but I believe the spec
allows that and we can further improve later).
The patch uses a new internal function, .ASSUME, to hold the condition
in the FEs. At gimplification time, if the condition is simple/without
side-effects, it is gimplified as if (cond) ; else __builtin_unreachable ();
and otherwise for now dropped on the floor. The intent is to incrementally
outline the conditions into separate artificial functions and use
.ASSUME further to tell the ranger and perhaps other optimization passes
about the assumptions, as detailed in the PR.
When implementing it, I found that assume entry hasn't been added to
https://eel.is/c++draft/cpp.cond#6
Jonathan said he'll file a NB comment about it, this patch assumes it
has been added into the table as 202207L when the paper has been voted in.
With the attributes for both C/C++, I'd say we don't need to add
__builtin_assume with similar purpose, especially when __builtin_assume
in LLVM is just weird. It is strange for side-effects in function call's
argument not to be evaluated, and LLVM in that case (annoyingly) warns
and ignores the side-effects (but doesn't do then anything with it),
if there are no side-effects, it will work like our
if (!cond) __builtin_unreachable ();
2022-10-06 Jakub Jelinek <jakub@redhat.com>
PR c++/106654
gcc/
* internal-fn.def (ASSUME): New internal function.
* internal-fn.h (expand_ASSUME): Declare.
* internal-fn.cc (expand_ASSUME): Define.
* gimplify.cc (gimplify_call_expr): Gimplify IFN_ASSUME.
* fold-const.h (simple_condition_p): Declare.
* fold-const.cc (simple_operand_p_2): Rename to ...
(simple_condition_p): ... this. Remove forward declaration.
No longer static. Adjust function comment and fix a typo in it.
Adjust recursive call.
(simple_operand_p): Adjust function comment.
(fold_truth_andor): Adjust simple_operand_p_2 callers to call
simple_condition_p.
* doc/extend.texi: Document assume attribute. Move fallthrough
attribute example to its section.
gcc/c-family/
* c-attribs.cc (handle_assume_attribute): New function.
(c_common_attribute_table): Add entry for assume attribute.
* c-lex.cc (c_common_has_attribute): Handle
__have_cpp_attribute (assume).
gcc/c/
* c-parser.cc (handle_assume_attribute): New function.
(c_parser_declaration_or_fndef): Handle assume attribute.
(c_parser_attribute_arguments): Add assume_attr argument,
if true, parse first argument as conditional expression.
(c_parser_gnu_attribute, c_parser_std_attribute): Adjust
c_parser_attribute_arguments callers.
(c_parser_statement_after_labels) <case RID_ATTRIBUTE>: Handle
assume attribute.
gcc/cp/
* cp-tree.h (process_stmt_assume_attribute): Implement C++23
P1774R8 - Portable assumptions. Declare.
(diagnose_failing_condition): Declare.
(find_failing_clause): Likewise.
* parser.cc (assume_attr): New enumerator.
(cp_parser_parenthesized_expression_list): Handle assume_attr.
Remove identifier variable, for id_attr push the identifier into
expression_list right away instead of inserting it before all the
others at the end.
(cp_parser_conditional_expression): New function.
(cp_parser_constant_expression): Use it.
(cp_parser_statement): Handle assume attribute.
(cp_parser_expression_statement): Likewise.
(cp_parser_gnu_attribute_list): Use assume_attr for assume
attribute.
(cp_parser_std_attribute): Likewise. Handle standard assume
attribute like gnu::assume.
* cp-gimplify.cc (process_stmt_assume_attribute): New function.
* constexpr.cc: Include fold-const.h.
(find_failing_clause_r, find_failing_clause): New functions,
moved from semantics.cc with ctx argument added and if non-NULL,
call cxx_eval_constant_expression rather than fold_non_dependent_expr.
(cxx_eval_internal_function): Handle IFN_ASSUME.
(potential_constant_expression_1): Likewise.
* pt.cc (tsubst_copy_and_build): Likewise.
* semantics.cc (diagnose_failing_condition): New function.
(find_failing_clause_r, find_failing_clause): Moved to constexpr.cc.
(finish_static_assert): Use it. Add auto_diagnostic_group.
gcc/testsuite/
* gcc.dg/attr-assume-1.c: New test.
* gcc.dg/attr-assume-2.c: New test.
* gcc.dg/attr-assume-3.c: New test.
* g++.dg/cpp2a/feat-cxx2a.C: Add colon to C++20 features
comment, add C++20 attributes comment and move C++20
new features after the attributes before them.
* g++.dg/cpp23/feat-cxx2b.C: Likewise. Test
__has_cpp_attribute(assume).
* g++.dg/cpp23/attr-assume1.C: New test.
* g++.dg/cpp23/attr-assume2.C: New test.
* g++.dg/cpp23/attr-assume3.C: New test.
* g++.dg/cpp23/attr-assume4.C: New test.
Stefan Schulze Frielinghaus [Thu, 6 Oct 2022 06:43:53 +0000 (08:43 +0200)]
cselib: Skip BImode while keeping track of subvalue relations [PR107088]
For BImode get_narrowest_mode evaluates to QImode but BImode < QImode.
Thus FOR_EACH_MODE_UNTIL never reaches BImode and iterates until OImode
for which no wider mode exists so we end up with VOIDmode and fail.
Fixed by adding a size guard so we effectively skip BImode.
gcc/ChangeLog:
PR rtl-optimization/107088
* cselib.cc (new_cselib_val): Skip BImode while keeping track of
subvalue relations.
Aldy Hernandez [Wed, 5 Oct 2022 18:22:38 +0000 (20:22 +0200)]
Setting explicit NANs sets UNDEFINED for -ffinite-math-only.
We recently agreed that setting a range of NAN should instead set
UNDEFINED for -ffinite-math-only. This patch makes that change to
frange::set_nan() directly. Also, calling frange::update_nan() will now
be a nop for !HONOR_NANS.
Doing this in the setters simplifies everywhere we set NANs, as it keeps
us from introducing NANs by mistake.
gcc/ChangeLog:
* value-range.cc (frange::set): Call set_nan unconditionally.
(range_tests_nan): Adjust tests.
(range_tests_signed_zeros): Same.
(range_tests_floats): Same.
* value-range.h (frange::update_nan): Guard with HONOR_NANS.
(frange::set_nan): Set undefined if !HONOR_NANS.
Aldy Hernandez [Wed, 5 Oct 2022 18:21:26 +0000 (20:21 +0200)]
Do not check finite_operands_p twice in range-ops-float.
The uses of finite_operands_p removed are guarded by a call to
finite_operands_p already.
gcc/ChangeLog:
* range-op-float.cc (foperator_lt::fold_range): Remove extra check
to finite_operands_p.
(foperator_le::fold_range): Same.
(foperator_gt::fold_range): Same.
(foperator_ge::fold_range): Same.
Aldy Hernandez [Wed, 5 Oct 2022 18:21:07 +0000 (20:21 +0200)]
Do not double print INF and NAN in frange pretty printer.
gcc/ChangeLog:
* value-range-pretty-print.cc (vrange_printer::print_real_value):
Avoid printing INF and NAN twice.
GCC Administrator [Thu, 6 Oct 2022 00:17:24 +0000 (00:17 +0000)]
Daily bump.
Segher Boessenkool [Tue, 4 Oct 2022 21:22:15 +0000 (21:22 +0000)]
rs6000: Remove the wD constraint
2022-10-05 Segher Boessenkool <segher@kernel.crashing.org>
* config/rs6000/constraints.md (wD): Delete.
* doc/md.texi (Machine Constraints): Adjust.
Segher Boessenkool [Tue, 4 Oct 2022 02:50:22 +0000 (02:50 +0000)]
rs6000: Rework vsx_extract_<mode>
Extracting the left and right halfs of a vector are entirely different
operations. Things are simpler if they are separate define_insns, and
it is easy to get rid of the "wD" constraint use then.
This also give the variant that is a no-op copy its own alternative, of
length 0 (and this, cost 0, making it more likely RA will choose it.
2022-10-05 Segher Boessenkool <segher@kernel.crashing.org>
* config/rs6000/vsx.md (vsx_extract_<mode>): Replace define_insn by a
define_expand. Split the contents to...
(*vsx_extract_<mode>_0): ... this. Rewrite.
(*vsx_extract_<mode>_1): ... and this. Rewrite.
Segher Boessenkool [Mon, 3 Oct 2022 22:43:48 +0000 (22:43 +0000)]
rs6000: Remove "wD" from *vsx_extract_<mode>_store
We can use "n" instead of "wD" if we simply test the value of the
integer constant directly.
2022-10-05 Segher Boessenkool <segher@kernel.crashing.org>
* config/rs6000/vsx.md (*vsx_extract_<mode>_store): Use "n" instead of
"wD" constraint.
Martin Liska [Wed, 5 Oct 2022 18:39:19 +0000 (20:39 +0200)]
contrib: run fetch before pushing Daily bump
As seen from recent days, the script fails when it pushes
a branch while another revision was pushed by a user.
Prevent that by doing fetch right before the pull.
The error message example:
cmdline: git push origin releases/gcc-11
stderr: 'fatal: unable to parse object:
4249a65c814287af667aa78789436d3fc618e80a
error: remote unpack failed: eof before pack header was fully read
contrib/ChangeLog:
* gcc-changelog/git_update_version.py: Do fetch before a push.
David Malcolm [Wed, 5 Oct 2022 18:07:47 +0000 (14:07 -0400)]
analyzer: add regression test for PR 107158
PR analyzer/107158 reports an ICE when using
-fanalyzer -fanalyzer-call-summaries
on a particular source file.
It turns out I just fixed this ICE in r13-3094-g6832c95c0e1a58.
This followup patch adds a somewhat reduced reproducer as a regression
test. Unfortunately, although the ICE is fixed, there are two false
positives from -Wanalyzer-malloc-leak on the test case, so I'm going to
use PR analyzer/107158 for tracking those false positives.
gcc/testsuite/ChangeLog:
PR analyzer/107158
* gcc.dg/analyzer/call-summaries-pr107158.c: New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
David Malcolm [Wed, 5 Oct 2022 17:52:59 +0000 (13:52 -0400)]
analyzer: simplify some includes
gcc/analyzer/ChangeLog:
* analysis-plan.cc: Simplify includes.
* analyzer-pass.cc: Likewise.
* analyzer-selftests.cc: Likewise.
* analyzer.cc: Likewise.
* analyzer.h: Add includes of "json.h" and "tristate.h".
* call-info.cc: Simplify includes.
* call-string.cc: Likewise.
* call-summary.cc: Likewise.
* checker-path.cc: Likewise.
* complexity.cc: Likewise.
* constraint-manager.cc: Likewise.
* diagnostic-manager.cc: Likewise.
* engine.cc: Likewise.
* feasible-graph.cc: Likewise.
* known-function-manager.cc: Likewise.
* pending-diagnostic.cc: Likewise.
* program-point.cc: Likewise.
* program-state.cc: Likewise.
* region-model-asm.cc: Likewise.
* region-model-impl-calls.cc: Likewise.
* region-model-manager.cc: Likewise.
* region-model-reachability.cc: Likewise.
* region-model.cc: Likewise.
* region-model.h: Include "selftest.h".
* region.cc: Simplify includes.
* sm-fd.cc: Likewise.
* sm-file.cc: Likewise.
* sm-malloc.cc: Likewise.
* sm-pattern-test.cc: Likewise.
* sm-sensitive.cc: Likewise.
* sm-signal.cc: Likewise.
* sm-taint.cc: Likewise.
* sm.cc: Likewise.
* state-purge.cc: Likewise.
* store.cc: Likewise.
* store.h: Likewise.
* supergraph.cc: Likewise.
* svalue.cc: Likewise.
* svalue.h: Likewise.
* trimmed-graph.cc: Likewise.
* varargs.cc: Likewise.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
David Malcolm [Wed, 5 Oct 2022 17:52:59 +0000 (13:52 -0400)]
analyzer: fix ICEs seen with call summaries on PR 107060
This doesn't fix the various false positives seen with
-fanalyzer-call-summaries on PR 107060, but stops it crashing at -O2.
gcc/analyzer/ChangeLog:
PR analyzer/107060
* call-summary.cc
(call_summary_replay::convert_svalue_from_summary_1): Handle NULL
results from convert_svalue_from_summary in SK_UNARY_OP and
SK_BIN_OP.
* engine.cc (impl_region_model_context::on_unknown_change): Bail
out on svalues that can't have associated state.
* region-model-impl-calls.cc
(region_model::impl_call_analyzer_get_unknown_ptr): New.
* region-model.cc (region_model::on_stmt_pre): Handle
"__analyzer_get_unknown_ptr".
* region-model.h
(region_model::impl_call_analyzer_get_unknown_ptr): New decl.
* store.cc (store::replay_call_summary_cluster): Avoid trying to
create binding clusters for base regions that shouldn't have them.
gcc/ChangeLog:
PR analyzer/107060
* doc/analyzer.texi (__analyzer_get_unknown_ptr): Document.
gcc/testsuite/ChangeLog:
PR analyzer/107060
* gcc.dg/analyzer/analyzer-decls.h (__analyzer_get_unknown_ptr):
New decl.
* gcc.dg/analyzer/call-summaries-2.c
(test_summarized_writes_param_to_ptr_unknown): New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Tobias Burnus [Wed, 5 Oct 2022 17:25:27 +0000 (19:25 +0200)]
Fortran: Add OpenMP's assume(s) directives
libgomp/ChangeLog:
* libgomp.texi (OpenMP 5.1 Impl. Status): Mark 'assume' as 'Y'.
gcc/fortran/ChangeLog:
* dump-parse-tree.cc (show_omp_assumes): New.
(show_omp_clauses, show_namespace): Call it.
(show_omp_node, show_code_node): Handle OpenMP ASSUME.
* gfortran.h (enum gfc_statement): Add ST_OMP_ASSUME,
ST_OMP_END_ASSUME, ST_OMP_ASSUMES and ST_NOTHING.
(gfc_exec_op): Add EXEC_OMP_ASSUME.
(gfc_omp_assumptions): New struct.
(gfc_get_omp_assumptions): New XCNEW #define.
(gfc_omp_clauses, gfc_namespace): Add assume member.
(gfc_resolve_omp_assumptions): New prototype.
* match.h (gfc_match_omp_assume, gfc_match_omp_assumes): New.
* openmp.cc (omp_code_to_statement): Forward declare.
(enum gfc_omp_directive_kind, struct gfc_omp_directive): New.
(gfc_free_omp_clauses): Free assume member and its struct data.
(enum omp_mask2): Add OMP_CLAUSE_ASSUMPTIONS.
(gfc_omp_absent_contains_clause): New.
(gfc_match_omp_clauses): Call it; optionally use passed
omp_clauses argument.
(omp_verify_merge_absent_contains, gfc_match_omp_assume,
gfc_match_omp_assumes, gfc_resolve_omp_assumptions): New.
(resolve_omp_clauses): Call the latter.
(gfc_resolve_omp_directive, omp_code_to_statement): Handle
EXEC_OMP_ASSUME.
* parse.cc (decode_omp_directive): Parse OpenMP ASSUME(S).
(next_statement, parse_executable, parse_omp_structured_block):
Handle ST_OMP_ASSUME.
(case_omp_decl): Add ST_OMP_ASSUMES.
(gfc_ascii_statement): Handle Assumes, optional return
string without '!$OMP '/'!$ACC ' prefix.
* parse.h (gfc_ascii_statement): Add optional bool arg to prototype.
* resolve.cc (gfc_resolve_blocks, gfc_resolve_code): Add
EXEC_OMP_ASSUME.
(gfc_resolve): Resolve ASSUMES directive.
* symbol.cc (gfc_free_namespace): Free omp_assumes member.
* st.cc (gfc_free_statement): Handle EXEC_OMP_ASSUME.
* trans-openmp.cc (gfc_trans_omp_directive): Likewise.
* trans.cc (trans_code): Likewise.
gcc/testsuite/ChangeLog:
* gfortran.dg/gomp/assume-1.f90: New test.
* gfortran.dg/gomp/assume-2.f90: New test.
* gfortran.dg/gomp/assumes-1.f90: New test.
* gfortran.dg/gomp/assumes-2.f90: New test.
Jason Merrill [Mon, 3 Oct 2022 21:16:38 +0000 (17:16 -0400)]
c++: lvalue_kind tweak
I was wondering how lvalue_kind handles VIEW_CONVERT_EXPR; in cases where
the type actually changes, it should have the same prvalue->xvalue effect as
ARRAY_REF, since we need to materialize a temporary to get an object we can
reinterpret as another type.
Currently this only fires on builtin-shufflevector-3.c, where we use
VIEW_CONVERT_EXPR to reinterpret a vector as an array.
REALPART_EXPR and IMAGPART_EXPR should also be treated like COMPONENT_REF.
PREINCREMENT_EXPR and PREDECREMENT_EXPR should only be applied to glvalues,
but if for some reason they were applied to a prvalue this would be correct.
TRY_CATCH_EXPR around a prvalue is also questionable, but this is the right
handling.
gcc/cp/ChangeLog:
* tree.cc (lvalue_kind) [VIEW_CONVERT_EXPR]: Change prvalue to
xvalue.
Ju-Zhe Zhong [Fri, 30 Sep 2022 06:58:16 +0000 (14:58 +0800)]
RISC-V: Introduce RVV header to enable builtin types
gcc/ChangeLog:
* config.gcc: Add riscv_vector.h.
* config/riscv/riscv-builtins.cc: Add RVV builtin types support.
* config/riscv/riscv-c.cc (riscv_pragma_intrinsic): New function.
(riscv_register_pragmas): Ditto.
* config/riscv/riscv-protos.h (riscv_register_pragmas): Ditto.
(init_builtins): Move declaration from riscv-vector-builtins.h to riscv-protos.h.
(mangle_builtin_type): Ditto.
(verify_type_context): Ditto.
(handle_pragma_vector): New function.
* config/riscv/riscv-vector-builtins.cc (GTY): New variable.
(register_vector_type): New function.
(init_builtins): Add RVV builtin types support.
(handle_pragma_vector): New function.
* config/riscv/riscv-vector-builtins.h (GCC_RISCV_V_BUILTINS_H): Change
name according to file name.
(GCC_RISCV_VECTOR_BUILTINS_H): Ditto.
(init_builtins): Remove declaration in riscv-vector-builtins.h.
(mangle_builtin_type): Ditto.
(verify_type_context): Ditto.
* config/riscv/riscv.cc: Adjust for RVV builtin types support.
* config/riscv/riscv.h (REGISTER_TARGET_PRAGMAS): New macro.
* config/riscv/t-riscv: Remove redundant file including.
* config/riscv/riscv_vector.h: New file.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/base/pragma-1.c: New test.
* gcc.target/riscv/rvv/base/pragma-2.c: New test.
* gcc.target/riscv/rvv/base/pragma-3.c: New test.
* gcc.target/riscv/rvv/base/user-1.c: New test.
* gcc.target/riscv/rvv/base/user-2.c: New test.
* gcc.target/riscv/rvv/base/user-3.c: New test.
* gcc.target/riscv/rvv/base/user-4.c: New test.
* gcc.target/riscv/rvv/base/user-5.c: New test.
* gcc.target/riscv/rvv/base/user-6.c: New test.
* gcc.target/riscv/rvv/base/vread_csr.c: New test.
* gcc.target/riscv/rvv/base/vwrite_csr.c: New test.
Aldy Hernandez [Wed, 5 Oct 2022 11:24:49 +0000 (13:24 +0200)]
range-op: Keep nonzero mask up to date with truncating casts.
gcc/ChangeLog:
* range-op.cc (operator_cast::fold_range): Handle truncating casts
for nonzero masks.
Jonathan Wakely [Wed, 5 Oct 2022 11:58:57 +0000 (12:58 +0100)]
libtdc++: Regenerate Makefile.in after freestanding header changes
libstdc++-v3/ChangeLog:
* include/Makefile.in: Regenerate.
Martin Liska [Wed, 5 Oct 2022 10:34:30 +0000 (12:34 +0200)]
c: support the attribute starting with '_'
PR c/107156
gcc/ChangeLog:
* attribs.h (lookup_attribute_by_prefix): Support the attribute
starting with underscore (_Noreturn).
Jonathan Wakely [Thu, 29 Sep 2022 10:30:05 +0000 (11:30 +0100)]
libstdc++: Guard use of new built-in with __has_builtin
Another case where I forgot that non-GCC compilers don't have this
built-in yet.
libstdc++-v3/ChangeLog:
* include/bits/invoke.h (__invoke_r): Check
__has_builtin(__reference_converts_from_temporary) before using
built-in.
Aldy Hernandez [Tue, 4 Oct 2022 15:05:10 +0000 (17:05 +0200)]
[PR tree-optimization/107052] range-ops: Take into account nonzero mask in popcount.
PR tree-optimization/107052
gcc/ChangeLog:
* gimple-range-op.cc (cfn_popcount::fold_range): Take into account
nonzero bit mask.
Aldy Hernandez [Tue, 4 Oct 2022 15:03:54 +0000 (17:03 +0200)]
[PR tree-optimization/107052] range-ops: Pass nonzero masks through cast.
Track nonzero masks through a cast in range-ops.
PR tree-optimization/107052
gcc/ChangeLog:
* range-op.cc (operator_cast::fold_range): Set nonzero mask.
Eric Botcazou [Wed, 5 Oct 2022 10:21:03 +0000 (12:21 +0200)]
Fix bogus -Wstringop-overflow warning in Ada
It comes from a discrepancy between get_offset_range, which uses a signed
type, and handle_array_ref, which uses an unsigned one, to do computations.
gcc/
PR tree-optimization/106698
* pointer-query.cc (handle_array_ref): Fix handling of low bound.
gcc/testsuite/
* gnat.dg/lto26.adb: New test.
* gnat.dg/lto26_pkg1.ads, gnat.dg/lto26_pkg1.adb: New helper.
* gnat.dg/lto26_pkg2.ads, gnat.dg/lto26_pkg2.adb: Likewise.
Martin Liska [Wed, 5 Oct 2022 11:33:24 +0000 (13:33 +0200)]
analyzer: remove unused variables
Fixes:
gcc/analyzer/call-summary.h:103:13: warning: private field 'm_called_fn' is not used [-Wunused-private-field]
gcc/analyzer/engine.cc:1631:24: warning: unused parameter 'uncertainty' [-Wunused-parameter]
gcc/analyzer/ChangeLog:
* call-summary.cc (call_summary_replay::call_summary_replay):
Remove unused variable and arguments.
* call-summary.h: Likewise.
* engine.cc (exploded_node::on_stmt): Likewise.
(exploded_node::replay_call_summaries): Likewise.
(exploded_node::replay_call_summary): Likewise.
* exploded-graph.h (class exploded_node): Likewise.
Martin Liska [Wed, 5 Oct 2022 10:14:40 +0000 (12:14 +0200)]
testsuite: mark a test with xfail
PR tree-optimization/106679
gcc/testsuite/ChangeLog:
* gcc.dg/tree-prof/cmpsf-1.c: Mark as a known limitation.
Torbjörn SVENSSON [Mon, 19 Sep 2022 16:18:58 +0000 (18:18 +0200)]
testsuite: 'b' instruction can't do long enough jumps
After moving the testglue in commit
9d503515cee, the jump to exit and
abort is too far for the 'b' instruction on Cortex-M0. As most of the
C code would generate a 'bl' instruction instead of a 'b'
instruction, lets do the same for the inline assembler.
The error seen without this patch:
/tmp/cccCRiCl.o: in function `main':
stack-protector-1.c:(.text+0x4e): relocation truncated to fit: R_ARM_THM_JUMP11 against symbol `__wrap_exit' defined in .text section in gcc_tg.o
stack-protector-1.c:(.text+0x50): relocation truncated to fit: R_ARM_THM_JUMP11 against symbol `__wrap_abort' defined in .text section in gcc_tg.o
collect2: error: ld returned 1 exit status
gcc/testsuite/ChangeLog:
* gcc.target/arm/stack-protector-1.c: Use 'bl' instead of 'b'
instruction.
* gcc.target/arm/stack-protector-3.c: Likewise.
Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com>
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Torbjörn SVENSSON [Thu, 29 Sep 2022 18:07:11 +0000 (20:07 +0200)]
testsuite: Windows reports errors with CreateProcess
When the mapper can't be executed, Windows report the error like:
.../bad-mapper-1.C: error: failed CreateProcess mapper 'this-will-not-work'
On Linux, the same error is reported this way:
.../bad-mapper-1.C: error: failed execvp mapper 'this-will-not-work'
This patch allows both output forms to be accepted.
Patch has been verified on Windows and Linux.
gcc/testsuite:
* g++.dg/modules/bad-mapper-1.C: Also accept CreateProcess.
Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com>
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Signed-off-by: Jonathan Yong <10walls@gmail.com>
Torbjörn SVENSSON [Thu, 29 Sep 2022 17:38:10 +0000 (19:38 +0200)]
testsuite: /dev/null is not accessible on Windows
When running the DejaGNU testsuite on a toolchain built for native
Windows, the path /dev/null can't be used to open a stream to void.
On native Windows, the resource is instead named "nul".
The error would look like this:
c:/arm-11.3.rel1/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld.exe: cannot find @/dev/null: No such file or directory
Patch has been verified on Windows and Linux.
gcc/testsuite:
* gcc.misc-tests/outputs.exp: Use "@nul" for Windows,
"@/dev/null" for other environments.
Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com>
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Signed-off-by: Jonathan Yong <10walls@gmail.com>
Vineet Gupta [Fri, 2 Sep 2022 21:05:33 +0000 (14:05 -0700)]
RISC-V: remove deprecate pic code model macro
Came across this deprecated symbol when looking around for
-mexplicit-relocs handling in code
Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
gcc/ChangeLog:
* config/riscv/riscv-c.cc (riscv_cpu_cpp_builtins):
Remove __riscv_cmodel_pic, that deprecated in last version.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/predef-1.c: Remove __riscv_cmodel_pic check.
* gcc.target/riscv/predef-2.c: Ditto.
* gcc.target/riscv/predef-3.c: Ditto.
* gcc.target/riscv/predef-4.c: Ditto.
* gcc.target/riscv/predef-5.c: Ditto.
* gcc.target/riscv/predef-6.c: Ditto.
* gcc.target/riscv/predef-7.c: Ditto.
* gcc.target/riscv/predef-8.c: Ditto.
David Malcolm [Wed, 5 Oct 2022 00:19:07 +0000 (20:19 -0400)]
analyzer: revamp side-effects of call summaries [PR107072]
With -fanalyzer-call-summaries the analyzer canl attempt to summarize
the effects of some function calls at their call site, rather than
simulate the call directly, which can avoid big slowdowns during
analysis.
Previously, this summarization was extremely simplistic: no attempt
was made to update sm-state, and region_model::update_for_call_summary
would simply set the return value of the function to UNKNOWN, and assume
the function had no side effects.
This patch implements less simplistic summarizations: it tracks each
possible return enode from the called function, and attempts to generate
a successor enode from the callsite for each that have compatible
conditions, mapping state changes in the summary to state changes
at the callsite. It also implements the beginnings of heuristics for
generating user-facing descriptions of a summary e.g.
"when 'foo' returns NULL"
versus:
"when 'foo' returns a heap-allocated buffer"
This still has some bugs, but much more accurately tracks the effects
of a call, and so is an improvement; it should only have an effect
when -fanalyzer-call-summaries is enabled.
As before, -fanalyzer-call-summaries is disabled by default in
analyzer.opt (but enabled by default in the test suite).
gcc/ChangeLog:
PR analyzer/107072
* Makefile.in (ANALYZER_OBJS): Add analyzer/call-summary.o.
gcc/analyzer/ChangeLog:
PR analyzer/107072
* analyzer-logging.h: Include "diagnostic-core.h".
* analyzer.h: Include "function.h".
(class call_summary): New forward decl.
(class call_summary_replay): New forward decl.
(struct per_function_data): New forward decl.
(struct interesting_t): New forward decl.
(custom_edge_info::update_state): New vfunc.
* call-info.cc (custom_edge_info::update_state): New.
* call-summary.cc: New file.
* call-summary.h: New file.
* constraint-manager.cc: Include "analyzer/call-summary.h".
(class replay_fact_visitor): New.
(constraint_manager::replay_call_summary): New.
* constraint-manager.h (constraint_manager::replay_call_summary):
New.
* engine.cc: Include "analyzer/call-summary.h".
(exploded_node::on_stmt): Handle call summaries.
(class call_summary_edge_info): New.
(exploded_node::replay_call_summaries): New.
(exploded_node::replay_call_summary): New.
(per_function_data::~per_function_data): New.
(per_function_data::add_call_summary): Move here from header and
reimplement.
(exploded_graph::process_node): Call update_state rather than
update_model when handling bifurcation
(viz_callgraph_node::dump_dot): Use a regular label rather
than an HTML table; add summaries to dump.
* exploded-graph.h: Include "alloc-pool.h", "fibonacci_heap.h",
"supergraph.h", "sbitmap.h", "shortest-paths.h", "analyzer/sm.h",
"analyzer/program-state.h", and "analyzer/diagnostic-manager.h".
(exploded_node::replay_call_summaries): New decl.
(exploded_node::replay_call_summary): New decl.
(per_function_data::~per_function_data): New decl.
(per_function_data::add_call_summary): Move implemention from
header.
(per_function_data::m_summaries): Update type of element.
* known-function-manager.h: Include "analyzer/analyzer-logging.h".
* program-point.h: Include "pretty-print.h" and
"analyzer/call-string.h".
* program-state.cc: Include "analyzer/call-summary.h".
(sm_state_map::replay_call_summary): New.
(program_state::replay_call_summary): New.
* program-state.h (sm_state_map::replay_call_summary): New decl.
(program_state::replay_call_summary): New decl.
* region-model-manager.cc
(region_model_manager::get_or_create_asm_output_svalue): New
overload.
* region-model-manager.h
(region_model_manager::get_or_create_asm_output_svalue): New
overload decl.
* region-model.cc: Include "analyzer/call-summary.h".
(region_model::maybe_update_for_edge): Remove call to
region_model::update_for_call_summary on
SUPEREDGE_INTRAPROCEDURAL_CALL.
(region_model::update_for_call_summary): Delete.
(region_model::replay_call_summary): New.
* region-model.h (region_model::replay_call_summary): New decl.
(region_model::update_for_call_summary): Delete decl.
* store.cc: Include "analyzer/call-summary.h".
(store::replay_call_summary): New.
(store::replay_call_summary_cluster): New.
* store.h: Include "tristate.h".
(is_a_helper <const ana::concrete_binding *>::test): New.
(store::replay_call_summary): New decl.
(store::replay_call_summary_cluster): New decl.
* supergraph.cc (get_ultimate_function_for_cgraph_edge): Remove
"static" from decl.
(supergraph_call_edge): Make stmt param const.
* supergraph.h: Include "ordered-hash-map.h", "cfg.h",
"basic-block.h", "gimple.h", "gimple-iterator.h", and "digraph.h".
(supergraph_call_edge): Make stmt param const.
(get_ultimate_function_for_cgraph_edge): New decl.
* svalue.cc (compound_svalue::compound_svalue): Assert that we're
not nesting compound_svalues.
* svalue.h: Include "json.h", "analyzer/store.h", and
"analyzer/program-point.h".
(asm_output_svalue::get_num_outputs): New accessor.
gcc/testsuite/ChangeLog:
PR analyzer/107072
* gcc.dg/analyzer/call-summaries-2.c: New test.
* gcc.dg/analyzer/call-summaries-3.c: New test.
* gcc.dg/analyzer/call-summaries-asm-x86.c: New test.
* gcc.dg/analyzer/call-summaries-malloc.c: New test.
* gcc.dg/analyzer/call-summaries-pr107072.c: New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
David Malcolm [Wed, 5 Oct 2022 00:19:06 +0000 (20:19 -0400)]
analyzer: move region_model_manager decl to its own header
gcc/analyzer/ChangeLog:
* region-model.h: Include "analyzer/region-model-manager.h"
(class region_model_manager): Move decl to...
* region-model-manager.h: ...this new file.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
David Malcolm [Wed, 5 Oct 2022 00:19:06 +0000 (20:19 -0400)]
analyzer: fold -(-(VAL)) to VAL
gcc/analyzer/ChangeLog:
* region-model-manager.cc
(region_model_manager::maybe_fold_unaryop): Fold -(-(VAL)) to VAL.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
David Malcolm [Wed, 5 Oct 2022 00:19:06 +0000 (20:19 -0400)]
analyzer: widening_svalues take a function_point rather than a program_point
Enabling work towrads better call summarization.
gcc/analyzer/ChangeLog:
* region-model-manager.cc
(region_model_manager::get_or_create_widening_svalue): Use a
function_point rather than a program_point.
* region-model.cc (selftest::test_widening_constraints): Likewise.
* region-model.h
(region_model_manager::get_or_create_widening_svalue): Likewise.
(model_merger::get_function_point): New.
* svalue.cc (svalue::can_merge_p): Use a function_point rather
than a program_point.
(svalue::can_merge_p): Likewise.
* svalue.h (widening_svalue::key_t): Likewise.
(widening_svalue::widening_svalue): Likewise.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
GCC Administrator [Wed, 5 Oct 2022 00:17:25 +0000 (00:17 +0000)]
Daily bump.
Jason Merrill [Tue, 4 Oct 2022 21:06:04 +0000 (17:06 -0400)]
c++: fix debug info for array temporary [PR107154]
In the testcase the elaboration of the array init that happens at genericize
time was getting the location info for the end of the function; fixed by
doing the expansion at the location of the original expression.
PR c++/107154
gcc/cp/ChangeLog:
* cp-gimplify.cc (cp_genericize_init_expr): Use iloc_sentinel.
(cp_genericize_target_expr): Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/debug/dwarf2/lineno-array1.C: New test.
Jakub Jelinek [Tue, 4 Oct 2022 21:13:15 +0000 (23:13 +0200)]
attribs: Add overloads with namespace name
I've discovered a problem with the way we handle scoped attributes. For
declaration or type attributes for attributes we don't know anything about
we just don't add them to the declarations or types, so later in the FEs and
middle-end it is fine to use lookup_attribute etc. which just check the
attribute name and not namespace because non-standard non-GNU attributes
just won't show there. But in the case of attributes on statements, nothing
has filtered out the unknown attributes, so with my earlier assume
attribute patch e.g. c-c++-common/Wno-attributes-6.c test failed because
it uses:
[[vendor::assume(1 + 1 == 2)]];
with -Wno-attributes=vendor::assume and lookup_attribute ("assume", )
finds such attribute and handled it that way.
So, for those cases, this patch introduces lookup_attribute and
remove_attribute overloads which specify also the namespace.
I think the fallthrough, hot, cold, likely, unlikely attribute handling
will need to use the new APIs too, so that we don't handle
msft::fallthrough attribute as something we'd know.
2022-10-04 Jakub Jelinek <jakub@redhat.com>
* attribs.h (remove_attribute): Declare overload with additional
attr_ns argument.
(private_lookup_attribute): Declare overload with additional
attr_ns and attr_ns_len arguments.
(lookup_attribute): New overload with additional attr_ns argument.
* attribs.cc (remove_attribute): New overload with additional
attr_ns argument.
(private_lookup_attribute): New overload with additional
attr_ns and attr_ns_len arguments.
Jakub Jelinek [Tue, 4 Oct 2022 19:05:16 +0000 (21:05 +0200)]
attribs: Add missing auto_diagnostic_group 3 times
In these spots, the error/error_at has some inform afterwards which are
explanation part of the same diagnostics, so should be tied with
auto_diagnostic_group with it.
2022-10-04 Jakub Jelinek <jakub@redhat.com>
* attribs.cc (handle_ignored_attributes_option, decl_attributes,
common_function_versions): Use auto_diagnostic_group.
Aldy Hernandez [Tue, 4 Oct 2022 17:50:28 +0000 (19:50 +0200)]
Remove assert from set_nonzero_bits.
The assert removed by this patch was there to keep users from passing
masks of incompatible types. The self tests are passing host wide
ints down (set_nonzero_bits (-1)), which seem to be 32 bits, whereas
some embedded targets have integer_type_node's of 16-bits. This is
causing problems in m32c-elf, among others.
I suppose there's no harm in passing a 32-bit mask, because
set_nonzero_bits calls wide_int::from() to convert the mask to the
appropriate type. So we can remove the assert.
gcc/ChangeLog:
* value-range.cc (irange::set_nonzero_bits): Remove assert.
Jonathan Wakely [Tue, 4 Oct 2022 16:23:45 +0000 (17:23 +0100)]
libstdc++: Fix test FAIL for old std::string ABI
libstdc++-v3/ChangeLog:
* testsuite/std/ranges/adaptors/join_with/1.cc: Remove unused
<sstream header.
(test04): Remove constexpr for old std::string ABI and test at
runtime.
Jonathan Wakely [Tue, 4 Oct 2022 12:00:52 +0000 (13:00 +0100)]
libstdc++: Use new built-ins __remove_cv, __remove_reference etc.
libstdc++-v3/ChangeLog:
* include/std/type_traits (remove_cv): Use __remove_cv built-in.
(remove_reference): Use __remove_reference built-in.
(remove_cvref): Use __remove_cvref built-in. Remove inheritance
for fallback implementation.
Jonathan Wakely [Tue, 4 Oct 2022 11:57:33 +0000 (12:57 +0100)]
libstdc++: Refactor seed sequence constraints in <random>
Every use of _If_seed_seq in <random> and <ext/random> uses it with
enable_if. We can just move the enable_if into the helper alias instead
of repeating it everywhere.
libstdc++-v3/ChangeLog:
* include/bits/random.h (__is_seed_seq): Replace with ...
(_If_seed_seq_for): ... this.
* include/ext/random: Adjust to use _If_seed_seq_for.
Patrick Palka [Tue, 4 Oct 2022 16:23:46 +0000 (12:23 -0400)]
c++: install cp-trait.def as part of plugin headers [PR107136]
This is apparently needed since we include cp-trait.def from cp-tree.h
(in order to define the cp_trait_kind enum), as with operators.def.
PR c++/107136
gcc/cp/ChangeLog:
* Make-lang.in (CP_PLUGIN_HEADERS): Add cp-trait.def.
Richard Sandiford [Tue, 4 Oct 2022 15:39:18 +0000 (16:39 +0100)]
aarch64: Define __ARM_FEATURE_RCPC
https://github.com/ARM-software/acle/pull/199 adds a new feature
macro for RCPC, for use in things like inline assembly. This patch
adds the associated support to GCC.
Also, RCPC is required for Armv8.3-A and later, but the armv8.3-a
entry didn't include it. This was probably harmless in practice
since GCC simply ignored the extension until now. (The GAS
definition is OK.)
gcc/
* config/aarch64/aarch64.h (AARCH64_ISA_RCPC): New macro.
* config/aarch64/aarch64-arches.def (armv8.3-a): Include RCPC.
* config/aarch64/aarch64-cores.def (thunderx3t110, zeus, neoverse-v1)
(neoverse-512tvb, saphira): Remove RCPC from these Armv8.3-A+ cores.
* config/aarch64/aarch64-c.cc (aarch64_update_cpp_builtins): Define
__ARM_FEATURE_RCPC when appropriate.
gcc/testsuite/
* gcc.target/aarch64/pragma_cpp_predefs_1.c: Add RCPC tests.
Tobias Burnus [Tue, 4 Oct 2022 15:03:32 +0000 (17:03 +0200)]
OpenMP: Update invoke.texi and fix fortran/parse.cc for -fopenmp-simd
Split off from the 'Fortran: Add OpenMP's assume(s) directives' patch.
gcc/
* doc/invoke.texi (-fopenmp): Mention C++ attribut syntax.
(-fopenmp-simd): Likewise; update permitted directives.
gcc/fortran/
* parse.cc (decode_omp_directive): Handle '(end) loop' and 'scan'
also with -fopenmp-simd.
gcc/testsuite/
* gfortran.dg/gomp/openmp-simd-7.f90: New test.
Patrick Palka [Tue, 4 Oct 2022 14:54:36 +0000 (10:54 -0400)]
libstdc++: Avoid heavyweight std::visit in ranges::join_with_view
libstdc++-v3/ChangeLog:
* include/std/ranges (join_with_view::_Iterator::operator*):
Replace use of std::visit with manual visitation.
(join_with_view::_Iterator::operator++): Likewise.
(join_with_view::_Iterator::operator--): Likewise.
(join_with_view::_Iterator::iter_move): Likewise.
(join_with_view::_Iterator::iter_swap): Likewise.
Jonathan Wakely [Tue, 4 Oct 2022 13:18:07 +0000 (14:18 +0100)]
libstdc++: Disable test for freestanding
This test checks the exception-safety of std::stable_sort if copying a
value throws. For freestanding we don't allocate in std::stable_sort
anyway, and the exception thrown via __throw_runtime_error terminates,
so disable the test.
libstdc++-v3/ChangeLog:
* testsuite/25_algorithms/stable_sort/mem_check.cc: Do nto run
for freestanding.
Jonathan Wakely [Tue, 4 Oct 2022 08:37:14 +0000 (09:37 +0100)]
libstdc++: Enable std::hash<coroutine_handle<P>> [PR107139]
Everything that <coroutine> depends on is available for freestanding
now.
libstdc++-v3/ChangeLog:
PR libstdc++/107139
* include/std/coroutine: Remove all _GLIBCXXHOSTED preprocessor
conditionals.
Jonathan Wakely [Mon, 3 Oct 2022 20:49:27 +0000 (21:49 +0100)]
libstdc++: Make <cstdint> work freestanding [PR107134]
When gcc/config.gcc defines use_gcc_stdin=wrap, GCC's <stdint.h> tries
to use libc's <stdint.h> unless -ffreestanding is used.
When libstdc++ is configured --disable-hosted-libstdcxx we want
<cstdint> to work even without -ffreestanding being given. This is a
kluge to make it include GCC's <stdint-gcc.h> directly even without
-ffreestanding.
libstdc++-v3/ChangeLog:
PR libstdc++/107134
* include/c_global/cstdint [!_GLIBCXX_HOSTED]: Include
<stdint-gcc.h> directly.
Jonathan Wakely [Mon, 3 Oct 2022 19:53:35 +0000 (20:53 +0100)]
libstdc++: Define <bits/functexcept.h> functions for freestanding [PR107135]
We don't compile src/c++11/functexcept.cc for freestanding, so just
define the functions used by freestanding entities as inline calls to
std::terminate.
libstdc++-v3/ChangeLog:
PR libstdc++/107135
* include/bits/functexcept.h [!_GLIBCXX_HOSTED]
(__throw_invalid_argument, __throw_out_of_range)
(__throw_out_of_range_fmt, __throw_runtime_error)
(__throw_overflow_error): Define inline.
* include/std/bitset (_M_copy_from_ptr) [!_GLIBCXX_HOSTED]:
Replace __builtin_abort with __throw_invalid_argument.
Patrick Palka [Tue, 4 Oct 2022 13:45:15 +0000 (09:45 -0400)]
libstdc++: Implement ranges::join_with_view from P2441R2
libstdc++-v3/ChangeLog:
* include/std/ranges: Include <variant> for C++23.
(__detail::__compatible_joinable_ranges): Define.
(__detail::__bidirectional_common): Define.
(join_with_view): Define.
(join_with_view::_Iterator): Define.
(join_with_view::_Sentinel): Define.
(views::__detail::__can_join_with_view): Define.
(views::_JoinWith, views::join_with): Define.
* testsuite/std/ranges/adaptors/join_with/1.cc: New test.
Tobias Burnus [Tue, 4 Oct 2022 09:49:18 +0000 (11:49 +0200)]
install.texi: gcn - update llvm reqirements, gcn/nvptx - newlib use version
gcc/
* doc/install.texi (Specific): Add missing items to bullet list.
(amdgcn): Update LLVM requirements, use version not date for newlib.
(nvptx): Use version not git hash for newlib.
Arsen Arsenović [Sat, 1 Oct 2022 18:40:05 +0000 (20:40 +0200)]
libstdc++: Use ///< for inline documentation
I noticed that some variables were misdocumented when using trailing
comment for documentation. I ran a search with a relatively simple
regex[1] to look for any ///s following some code that did not have a <,
and came up with these instances only.
[1]: \s*([^ ]+\s*)+///[^<].*$
libstdc++-v3/ChangeLog:
* include/std/iostream: Use ///< for inline documentation.
* include/std/limits: Likewise.
* include/experimental/internet: Likewise.
Jakub Jelinek [Tue, 4 Oct 2022 08:37:14 +0000 (10:37 +0200)]
openmp: Add begin declare target support
The following patch adds support for the begin declare target construct,
which is another spelling for declare target construct without clauses
(where it needs paired end declare target), but unlike that one accepts
clauses.
This is an OpenMP 5.1 feature, implemented with 5.2 clarification because
in 5.1 we had a restriction in the declare target chapter shared by
declare target and begin declare target that if there are any clauses
specified at least one of them needs to be to or link. But that
was of course meant just for declare target and not begin declare target,
because begin declare target doesn't even allow to/link/enter clauses.
In addition to that, the patch also makes device_type clause duplication
an error (as stated in 5.1) and similarly makes declare target with
just device_type clause an error rather than warning.
What this patch doesn't do is:
1) OpenMP 5.1 also added an indirect clause, we don't support that
neither on declare target nor begin declare target
and I couldn't find it in our features pages (neither libgomp.texi
nor web)
2) I think device_type(nohost)/device_type(host) support can't work for
variables (in 5.0 it only talked about procedures so this could be
also thought as 5.1 feature that we should just add to the list
and implement)
3) I don't see any use of the "omp declare target nohost" attribute, so
I'm not sure if device_type(nohost) works at all
2022-10-04 Jakub Jelinek <jakub@redhat.com>
gcc/c-family/
* c-omp.cc (c_omp_directives): Uncomment begin declare target
entry.
gcc/c/
* c-lang.h (struct c_omp_declare_target_attr): New type.
(current_omp_declare_target_attribute): Change type from
int to vec<c_omp_declare_target_attr, va_gc> *.
* c-parser.cc (c_parser_translation_unit): Adjust for that change.
If last pushed directive was begin declare target, use different
wording and simplify format strings for easier translations.
(c_parser_omp_clause_device_type): Uncomment
check_no_duplicate_clause call.
(c_parser_omp_declare_target): Adjust for the
current_omp_declare_target_attribute type change, push { -1 }.
Use error_at rather than warning_at for declare target with
only device_type clauses.
(OMP_BEGIN_DECLARE_TARGET_CLAUSE_MASK): Define.
(c_parser_omp_begin): Add begin declare target support.
(c_parser_omp_end): Adjust for the
current_omp_declare_target_attribute type change, adjust
diagnostics wording and simplify format strings for easier
translations.
* c-decl.cc (current_omp_declare_target_attribute): Change type from
int to vec<c_omp_declare_target_attr, va_gc> *.
(c_decl_attributes): Adjust for the
current_omp_declare_target_attribute type change. If device_type
was present on begin declare target, add "omp declare target host"
and/or "omp declare target nohost" attributes.
gcc/cp/
* cp-tree.h (struct omp_declare_target_attr): Rename to ...
(cp_omp_declare_target_attr): ... this. Add device_type member.
(omp_begin_assumes_data): Rename to ...
(cp_omp_begin_assumes_data): ... this.
(struct saved_scope): Change types of omp_declare_target_attribute
and omp_begin_assumes.
* parser.cc (cp_parser_omp_clause_device_type): Uncomment
check_no_duplicate_clause call.
(cp_parser_omp_all_clauses): Fix up pasto, c_name for OMP_CLAUSE_LINK
should be "link" rather than "to".
(cp_parser_omp_declare_target): Adjust for omp_declare_target_attr
to cp_omp_declare_target_attr changes, push -1 as device_type. Use
error_at rather than warning_at for declare target with only
device_type clauses.
(OMP_BEGIN_DECLARE_TARGET_CLAUSE_MASK): Define.
(cp_parser_omp_begin): Add begin declare target support. Adjust
for omp_begin_assumes_data to cp_omp_begin_assumes_data change.
(cp_parser_omp_end): Adjust for the
omp_declare_target_attr to cp_omp_declare_target_attr and
omp_begin_assumes_data to cp_omp_begin_assumes_data type changes,
adjust diagnostics wording and simplify format strings for easier
translations.
* semantics.cc (finish_translation_unit): Likewise.
* decl2.cc (cplus_decl_attributes): If device_type was present on
begin declare target, add "omp declare target host" and/or
"omp declare target nohost" attributes.
gcc/testsuite/
* c-c++-common/gomp/declare-target-4.c: Move tests that are now
rejected into declare-target-7.c.
* c-c++-common/gomp/declare-target-6.c: Adjust expected diagnostics.
* c-c++-common/gomp/declare-target-7.c: New test.
* c-c++-common/gomp/begin-declare-target-1.c: New test.
* c-c++-common/gomp/begin-declare-target-2.c: New test.
* c-c++-common/gomp/begin-declare-target-3.c: New test.
* c-c++-common/gomp/begin-declare-target-4.c: New test.
* g++.dg/gomp/attrs-9.C: Add begin declare target tests.
* g++.dg/gomp/attrs-18.C: New test.
libgomp/
* libgomp.texi (Support begin/end declare target syntax in C/C++):
Mark as implemented.
Aldy Hernandez [Sat, 1 Oct 2022 20:49:32 +0000 (22:49 +0200)]
Convert nonzero mask in irange to wide_int.
The reason the nonzero mask was kept in a tree was basically inertia,
as everything in irange is a tree. However, there's no need to keep
it in a tree, as the conversions to and from wide ints are very
annoying. That, plus special casing NULL masks to be -1 is prone
to error.
I have not only rewritten all the uses to assume a wide int, but
have corrected a few places where we weren't propagating the masks, or
rather pessimizing them to -1. This will become more important in
upcoming patches where we make better use of the masks.
Performance testing shows a trivial improvement in VRP, as things like
irange::contains_p() are tied to a tree. Ughh, can't wait for trees in
iranges to go away.
gcc/ChangeLog:
* value-range-storage.cc (irange_storage_slot::set_irange): Remove
special case.
* value-range.cc (irange::irange_set): Adjust for nonzero mask
being a wide int.
(irange::irange_set_anti_range): Same.
(irange::set): Same.
(irange::verify_range): Same.
(irange::legacy_equal_p): Same.
(irange::operator==): Same.
(irange::contains_p): Same.
(irange::legacy_intersect): Same.
(irange::legacy_union): Same.
(irange::irange_single_pair_union): Call union_nonzero_bits.
(irange::irange_union): Same.
(irange::irange_intersect): Call intersect_nonzero_bits.
(irange::intersect): Adjust for nonzero mask being a wide int.
(irange::invert): Same.
(irange::set_nonzero_bits): Same.
(irange::get_nonzero_bits_from_range): New.
(irange::set_range_from_nonzero_bits): New.
(irange::get_nonzero_bits): Adjust for nonzero mask being a wide
int.
(irange::intersect_nonzero_bits): Same.
(irange::union_nonzero_bits): Same.
(range_tests_nonzero_bits): Remove test.
* value-range.h (irange::varying_compatible_p): Adjust for nonzero
mask being a wide int.
(gt_ggc_mx): Same.
(gt_pch_nx): Same.
(irange::set_undefined): Same.
(irange::set_varying): Same.
(irange::normalize_kind): Same.
Aldy Hernandez [Mon, 3 Oct 2022 15:31:32 +0000 (17:31 +0200)]
[PR107130] range-ops: Separate out ffs and popcount optimizations.
__builtin_popcount and __builtin_ffs were sharing the same range-ops
entry, but the nonzero mask optimization is not valid for ffs.
Separate them out into two entries.
PR tree-optimization/107130
gcc/ChangeLog:
* gimple-range-op.cc (class cfn_popcount): Call op_cfn_ffs.
(class cfn_ffs): New.
(gimple_range_op_handler::maybe_builtin_call): Separate out
CASE_CFN_FFS into its own case.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/pr107130.c: New test.
Lewis Hyatt [Sat, 1 Oct 2022 16:05:13 +0000 (12:05 -0400)]
diagnostics: Add test for fixed _Pragma location issue [PR91669]
This PR related to _Pragma locations and diagnostic pragmas was fixed by a
combination of r10-325 and r13-1596. Add missing test coverage.
gcc/testsuite/ChangeLog:
PR c/91669
* c-c++-common/pr91669.c: New test.
GCC Administrator [Tue, 4 Oct 2022 00:17:16 +0000 (00:17 +0000)]
Daily bump.
Jonathan Wakely [Mon, 3 Oct 2022 17:27:23 +0000 (18:27 +0100)]
libstdc++: Update status docs for compare_exchange padding bits
libstdc++-v3/ChangeLog:
* doc/xml/manual/status_cxx2020.xml: Update C++20 status.
* doc/html/manual/status.html: Regenerate.
Sergei Trofimovich [Fri, 16 Sep 2022 17:33:11 +0000 (18:33 +0100)]
gcc/config/t-i386: add build dependencies on i386-builtin-types.inc
i386-builtin-types.inc is included indirectly via i386-builtins.h
into 4 files: i386.cc i386-builtins.cc i386-expand.cc i386-features.cc
Only i386.cc dependency was present in gcc/config/t-i386 makefile.
As a result parallel builds occasionally fail as:
g++ ... -o i386-builtins.o ... ../../gcc-13-
20220911/gcc/config/i386/i386-builtins.cc
In file included from ../../gcc-13-
20220911/gcc/config/i386/i386-builtins.cc:92:
../../gcc-13-
20220911/gcc/config/i386/i386-builtins.h:25:10:
fatal error: i386-builtin-types.inc: No such file or directory
25 | #include "i386-builtin-types.inc"
| ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [../../gcc-13-
20220911/gcc/config/i386/t-i386:54: i386-builtins.o]
Error 1 shuffle=
1663349189
gcc/
* config/i386/t-i386: Add build-time dependencies against
i386-builtin-types.inc to i386-builtins.o, i386-expand.o,
i386-features.o.
Torbjörn SVENSSON [Fri, 23 Sep 2022 08:35:15 +0000 (10:35 +0200)]
[testsuite][arm] Fix cmse-15.c expected output
The cmse-15.c testcase fails at -Os because ICF means that we
generate
secure3:
b secure1
which is OK, but does not match the currently expected
secure3:
...
bx r[0-3]
gcc/testsuite/ChangeLog:
* gcc.target/arm/cmse/cmse-15.c: Align with -Os improvements.
Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com>
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Jakub Jelinek [Mon, 3 Oct 2022 16:04:37 +0000 (18:04 +0200)]
c++: Disallow jumps into statement expressions
On Fri, Sep 30, 2022 at 04:39:25PM -0400, Jason Merrill wrote:
> > --- gcc/cp/decl.cc.jj 2022-09-22 00:14:55.
478599363 +0200
> > +++ gcc/cp/decl.cc 2022-09-22 00:24:01.
121178256 +0200
> > @@ -223,6 +223,7 @@ struct GTY((for_user)) named_label_entry
> > bool in_transaction_scope;
> > bool in_constexpr_if;
> > bool in_consteval_if;
> > + bool in_assume;
>
> I think it would be better to reject jumps into statement-expressions like
> the C front-end.
Ok, here is a self-contained patch that does that.
2022-10-03 Jakub Jelinek <jakub@redhat.com>
* cp-tree.h (BCS_STMT_EXPR): New enumerator.
* name-lookup.h (enum scope_kind): Add sk_stmt_expr.
* name-lookup.cc (begin_scope): Handle sk_stmt_expr like sk_block.
* semantics.cc (begin_compound_stmt): For BCS_STMT_EXPR use
sk_stmt_expr.
* parser.cc (cp_parser_statement_expr): Use BCS_STMT_EXPR instead of
BCS_NORMAL.
* decl.cc (struct named_label_entry): Add in_stmt_expr.
(poplevel_named_label_1): Handle sk_stmt_expr.
(check_previous_goto_1): Diagnose entering of statement expression.
(check_goto): Likewise.
* g++.dg/ext/stmtexpr24.C: New test.
Joseph Myers [Mon, 3 Oct 2022 16:00:10 +0000 (16:00 +0000)]
Update gcc sv.po
* sv.po: Update.
Patrick Palka [Mon, 3 Oct 2022 15:20:32 +0000 (11:20 -0400)]
c++: rename IS_SAME_AS trait code to IS_SAME
... to match the trait's canonical spelling __is_same instead
of its alternative spelling __is_same_as.
gcc/c-family/ChangeLog:
* c-common.cc (c_common_reswords): Use RID_IS_SAME instead of
RID_IS_SAME_AS.
gcc/cp/ChangeLog:
* constraint.cc (diagnose_trait_expr): Use CPTK_IS_SAME instead
of CPTK_IS_SAME_AS.
* cp-trait.def (IS_SAME_AS): Rename to ...
(IS_SAME): ... this.
* pt.cc (alias_ctad_tweaks): Use CPTK_IS_SAME instead of
CPTK_IS_SAME_AS.
* semantics.cc (trait_expr_value): Likewise.
(finish_trait_expr): Likewise.
Arsen Arsenović [Fri, 30 Sep 2022 15:06:49 +0000 (17:06 +0200)]
libstdc++: Disable hosted-only tests [PR103626]
PR libstdc++/103626 - _GLIBCXX_HOSTED should respect -ffreestanding
libstdc++-v3/ChangeLog:
PR libstdc++/103626
* testsuite/17_intro/headers/c++1998/stdc++_assert_neg.cc:
Require ET hosted.
* testsuite/18_support/aligned_alloc/aligned_alloc.cc: Likewise.
* testsuite/18_support/new_nothrow.cc: Likewise.
* testsuite/20_util/allocator/105975.cc: Likewise.
* testsuite/20_util/allocator/14176.cc: Likewise.
* testsuite/20_util/allocator/64135.cc: Likewise.
* testsuite/20_util/allocator/89510.cc: Likewise.
* testsuite/20_util/allocator/lwg3190.cc: Likewise.
* testsuite/20_util/allocator/overaligned.cc: Likewise.
* testsuite/20_util/allocator/rebind_c++20.cc: Likewise.
* testsuite/20_util/allocator/requirements/constexpr.cc:
Likewise.
* testsuite/20_util/allocator/requirements/explicit_instantiation/1.cc:
Likewise.
* testsuite/20_util/allocator/requirements/typedefs.cc:
Likewise.
* testsuite/20_util/allocator/requirements/typedefs_c++20.cc:
Likewise.
* testsuite/20_util/allocator/void.cc: Likewise.
* testsuite/20_util/allocator_traits/header-2.cc: Likewise.
* testsuite/20_util/allocator_traits/header.cc: Likewise.
* testsuite/20_util/allocator_traits/members/92878_92947.cc:
Likewise.
* testsuite/20_util/allocator_traits/members/pointers.cc:
Likewise.
* testsuite/20_util/allocator_traits/requirements/typedefs.cc:
Likewise.
* testsuite/20_util/bad_function_call/cons_virtual_derivation.cc:
Likewise.
* testsuite/20_util/bind/42593.cc: Likewise.
* testsuite/20_util/bitset/access/dr396.cc: Likewise.
* testsuite/20_util/bitset/access/to_string.cc: Likewise.
* testsuite/20_util/bitset/cons/16020.cc: Likewise.
* testsuite/20_util/bitset/cons/dr1325-2.cc: Likewise.
* testsuite/20_util/bitset/cons/dr396.cc: Likewise.
* testsuite/20_util/bitset/debug/invalidation/1.cc: Likewise.
* testsuite/20_util/bitset/ext/15361.cc: Likewise.
* testsuite/20_util/bitset/operations/13838.cc: Likewise.
* testsuite/20_util/bitset/operations/96303.cc: Likewise.
* testsuite/20_util/bitset/version.cc: Likewise.
* testsuite/20_util/enable_shared_from_this/56383.cc: Likewise.
* testsuite/20_util/enable_shared_from_this/89303.cc: Likewise.
* testsuite/20_util/enable_shared_from_this/members/assign.cc:
Likewise.
* testsuite/20_util/enable_shared_from_this/members/const.cc:
Likewise.
* testsuite/20_util/enable_shared_from_this/members/reinit.cc:
Likewise.
* testsuite/20_util/enable_shared_from_this/members/unique_ptr.cc:
Likewise.
* testsuite/20_util/enable_shared_from_this/members/weak_from_this.cc:
Likewise.
* testsuite/20_util/enable_shared_from_this/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/forward/1.cc: Likewise.
* testsuite/20_util/forward/1_neg.cc: Likewise.
* testsuite/20_util/function/1.cc: Likewise.
* testsuite/20_util/function/10.cc: Likewise.
* testsuite/20_util/function/2.cc: Likewise.
* testsuite/20_util/function/3.cc: Likewise.
* testsuite/20_util/function/4.cc: Likewise.
* testsuite/20_util/function/43397.cc: Likewise.
* testsuite/20_util/function/48541.cc: Likewise.
* testsuite/20_util/function/5.cc: Likewise.
* testsuite/20_util/function/58569.cc: Likewise.
* testsuite/20_util/function/6.cc: Likewise.
* testsuite/20_util/function/60594.cc: Likewise.
* testsuite/20_util/function/65760.cc: Likewise.
* testsuite/20_util/function/69222.cc: Likewise.
* testsuite/20_util/function/7.cc: Likewise.
* testsuite/20_util/function/77322.cc: Likewise.
* testsuite/20_util/function/8.cc: Likewise.
* testsuite/20_util/function/9.cc: Likewise.
* testsuite/20_util/function/91456.cc: Likewise.
* testsuite/20_util/function/assign/move.cc: Likewise.
* testsuite/20_util/function/assign/move_target.cc: Likewise.
* testsuite/20_util/function/cmp/cmp_neg.cc: Likewise.
* testsuite/20_util/function/cons/55320.cc: Likewise.
* testsuite/20_util/function/cons/57465.cc: Likewise.
* testsuite/20_util/function/cons/72820.cc: Likewise.
* testsuite/20_util/function/cons/addressof.cc: Likewise.
* testsuite/20_util/function/cons/callable.cc: Likewise.
* testsuite/20_util/function/cons/deduction.cc: Likewise.
* testsuite/20_util/function/cons/lwg2774.cc: Likewise.
* testsuite/20_util/function/cons/move.cc: Likewise.
* testsuite/20_util/function/cons/move_target.cc: Likewise.
* testsuite/20_util/function/cons/noexcept.cc: Likewise.
* testsuite/20_util/function/cons/non_copyconstructible.cc:
Likewise.
* testsuite/20_util/function/cons/refqual.cc: Likewise.
* testsuite/20_util/function/cons/70692.cc: Likewise.
* testsuite/20_util/function/cons/deduction_c++23.cc: Likewise.
* testsuite/20_util/function/invoke/forwarding.cc: Likewise.
* testsuite/20_util/function/invoke/move_only.cc: Likewise.
* testsuite/20_util/function/null_pointer_comparisons.cc:
Likewise.
* testsuite/20_util/function/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/function/target_no_rtti.cc: Likewise.
* testsuite/20_util/function_objects/83607.cc: Likewise.
* testsuite/20_util/function_objects/mem_fn/adl.cc: Likewise.
* testsuite/20_util/headers/cstdlib/functions_std.cc: Likewise.
* testsuite/20_util/headers/functional/types_std_c++0x.cc:
Likewise.
* testsuite/20_util/headers/memory/types_std_c++0x.cc: Likewise.
* testsuite/20_util/is_function/35637.cc: Likewise.
* testsuite/20_util/move/1.cc: Likewise.
* testsuite/20_util/move_only_function/call.cc: Likewise.
* testsuite/20_util/move_only_function/cons.cc: Likewise.
* testsuite/20_util/move_only_function/move.cc: Likewise.
* testsuite/20_util/move_only_function/version.cc: Likewise.
* testsuite/20_util/owner_less/cmp.cc: Likewise.
* testsuite/20_util/owner_less/noexcept.cc: Likewise.
* testsuite/20_util/owner_less/void.cc: Likewise.
* testsuite/20_util/pointer_safety/1.cc: Likewise.
* testsuite/20_util/scoped_allocator/65279.cc: Likewise.
* testsuite/20_util/scoped_allocator/69293_neg.cc: Likewise.
* testsuite/20_util/scoped_allocator/construct_pair.cc:
Likewise.
* testsuite/20_util/scoped_allocator/dr2586.cc: Likewise.
* testsuite/20_util/scoped_allocator/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/shared_ptr/assign/assign.cc: Likewise.
* testsuite/20_util/shared_ptr/assign/auto_ptr.cc: Likewise.
* testsuite/20_util/shared_ptr/assign/auto_ptr_neg.cc: Likewise.
* testsuite/20_util/shared_ptr/assign/auto_ptr_rvalue.cc:
Likewise.
* testsuite/20_util/shared_ptr/assign/dr541.cc: Likewise.
* testsuite/20_util/shared_ptr/assign/move.cc: Likewise.
* testsuite/20_util/shared_ptr/assign/sfinae.cc: Likewise.
* testsuite/20_util/shared_ptr/assign/shared_ptr.cc: Likewise.
* testsuite/20_util/shared_ptr/assign/shared_ptr_neg.cc:
Likewise.
* testsuite/20_util/shared_ptr/assign/unique_ptr_lvalue_neg.cc:
Likewise.
* testsuite/20_util/shared_ptr/assign/unique_ptr_rvalue.cc:
Likewise.
* testsuite/20_util/shared_ptr/atomic/1.cc: Likewise.
* testsuite/20_util/shared_ptr/atomic/2.cc: Likewise.
* testsuite/20_util/shared_ptr/casts/1.cc: Likewise.
* testsuite/20_util/shared_ptr/casts/reinterpret.cc: Likewise.
* testsuite/20_util/shared_ptr/casts/rval.cc: Likewise.
* testsuite/20_util/shared_ptr/comparison/42925.cc: Likewise.
* testsuite/20_util/shared_ptr/comparison/86537.cc: Likewise.
* testsuite/20_util/shared_ptr/comparison/cmp.cc: Likewise.
* testsuite/20_util/shared_ptr/comparison/cmp_c++20.cc:
Likewise.
* testsuite/20_util/shared_ptr/comparison/dr1401.cc: Likewise.
* testsuite/20_util/shared_ptr/comparison/less.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/39405.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/43820_neg.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/46910.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/51365.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/52924.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/55123.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/58659.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/58839.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/61036.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/79467.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/80229.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/alias-rval.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/alias.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/array.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/auto_ptr.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/auto_ptr_neg.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/copy.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/deduction.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/default.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/lwg2802.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/lwg3548.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/move.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/noexcept_move_construct.cc:
Likewise.
* testsuite/20_util/shared_ptr/cons/nullptr.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/pointer.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/unique_ptr.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/unique_ptr_array.cc:
Likewise.
* testsuite/20_util/shared_ptr/cons/unique_ptr_deleter.cc:
Likewise.
* testsuite/20_util/shared_ptr/cons/unique_ptr_deleter_ref_1.cc:
Likewise.
* testsuite/20_util/shared_ptr/cons/unique_ptr_deleter_ref_2.cc:
Likewise.
* testsuite/20_util/shared_ptr/cons/void_neg.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/weak_ptr.cc: Likewise.
* testsuite/20_util/shared_ptr/creation/36949.cc: Likewise.
* testsuite/20_util/shared_ptr/creation/58594-no-rtti.cc:
Likewise.
* testsuite/20_util/shared_ptr/creation/58594.cc: Likewise.
* testsuite/20_util/shared_ptr/creation/87278.cc: Likewise.
* testsuite/20_util/shared_ptr/creation/92878_92947.cc:
Likewise.
* testsuite/20_util/shared_ptr/creation/99006.cc: Likewise.
* testsuite/20_util/shared_ptr/creation/dr402.cc: Likewise.
* testsuite/20_util/shared_ptr/creation/dr925.cc: Likewise.
* testsuite/20_util/shared_ptr/creation/make.cc: Likewise.
* testsuite/20_util/shared_ptr/creation/no_rtti.cc: Likewise.
* testsuite/20_util/shared_ptr/creation/overwrite.cc: Likewise.
* testsuite/20_util/shared_ptr/creation/private.cc: Likewise.
* testsuite/20_util/shared_ptr/creation/single_allocation.cc:
Likewise.
* testsuite/20_util/shared_ptr/creation/single_allocation_no_rtti.cc:
Likewise.
* testsuite/20_util/shared_ptr/creation/version.cc: Likewise.
* testsuite/20_util/shared_ptr/dest/dest.cc: Likewise.
* testsuite/20_util/shared_ptr/hash/1.cc: Likewise.
* testsuite/20_util/shared_ptr/misc/24595.cc: Likewise.
* testsuite/20_util/shared_ptr/misc/42019.cc: Likewise.
* testsuite/20_util/shared_ptr/misc/get_deleter.cc: Likewise.
* testsuite/20_util/shared_ptr/misc/swap.cc: Likewise.
* testsuite/20_util/shared_ptr/modifiers/reset.cc: Likewise.
* testsuite/20_util/shared_ptr/modifiers/reset_neg.cc: Likewise.
* testsuite/20_util/shared_ptr/modifiers/reset_sfinae.cc:
Likewise.
* testsuite/20_util/shared_ptr/modifiers/swap.cc: Likewise.
* testsuite/20_util/shared_ptr/modifiers/swap_neg.cc: Likewise.
* testsuite/20_util/shared_ptr/observers/array.cc: Likewise.
* testsuite/20_util/shared_ptr/observers/bool_conv.cc: Likewise.
* testsuite/20_util/shared_ptr/observers/get.cc: Likewise.
* testsuite/20_util/shared_ptr/observers/owner_before.cc:
Likewise.
* testsuite/20_util/shared_ptr/observers/unique.cc: Likewise.
* testsuite/20_util/shared_ptr/observers/use_count.cc: Likewise.
* testsuite/20_util/shared_ptr/requirements/explicit_instantiation/1.cc:
Likewise.
* testsuite/20_util/shared_ptr/requirements/explicit_instantiation/2.cc:
Likewise.
* testsuite/20_util/shared_ptr/requirements/weak_type.cc:
Likewise.
* testsuite/20_util/specialized_algorithms/construct_at/95788.cc:
Likewise.
* testsuite/20_util/temporary_buffer.cc: Likewise.
* testsuite/20_util/tuple/48476.cc: Likewise.
* testsuite/20_util/tuple/cons/90700.cc: Likewise.
* testsuite/20_util/tuple/cons/96803.cc: Likewise.
* testsuite/20_util/tuple/cons/allocator_with_any.cc: Likewise.
* testsuite/20_util/tuple/cons/allocators.cc: Likewise.
* testsuite/20_util/tuple/cons/constexpr_allocator_arg_t.cc:
Likewise.
* testsuite/20_util/tuple/cons/explicit_construct.cc: Likewise.
* testsuite/20_util/tuple/p2321r2.cc: Likewise.
* testsuite/20_util/unique_ptr/creation/92878_92947.cc:
Likewise.
* testsuite/20_util/unique_ptr/creation/array.cc: Likewise.
* testsuite/20_util/unique_ptr/creation/array_neg.cc: Likewise.
* testsuite/20_util/unique_ptr/creation/constexpr.cc: Likewise.
* testsuite/20_util/unique_ptr/creation/for_overwrite.cc:
Likewise.
* testsuite/20_util/unique_ptr/creation/for_overwrite__neg.cc:
Likewise.
* testsuite/20_util/unique_ptr/creation/single.cc: Likewise.
* testsuite/20_util/uses_allocator/69293_neg.cc: Likewise.
* testsuite/20_util/uses_allocator/92878_92947.cc: Likewise.
* testsuite/20_util/uses_allocator/uninitialized_construct.cc:
Likewise.
* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Likewise.
* testsuite/20_util/weak_ptr/cons/deduction.cc: Likewise.
* testsuite/20_util/weak_ptr/cons/noexcept_move_construct.cc:
Likewise.
* testsuite/20_util/weak_ptr/lock/1.cc: Likewise.
* testsuite/20_util/weak_ptr/observers/owner_before.cc:
Likewise.
* testsuite/20_util/weak_ptr/requirements/explicit_instantiation/1.cc:
Likewise.
* testsuite/20_util/weak_ptr/requirements/explicit_instantiation/2.cc:
Likewise.
* testsuite/21_strings/basic_string/version.cc: Likewise.
* testsuite/21_strings/basic_string_view/operations/contains/char/2.cc:
Likewise.
* testsuite/21_strings/c_strings/char/69626.cc: Likewise.
* testsuite/21_strings/char_traits/requirements/version.cc:
Likewise.
* testsuite/23_containers/vector/requirements/version.cc:
Likewise.
* testsuite/24_iterators/back_insert_iterator/requirements/base_classes.cc:
Likewise.
* testsuite/24_iterators/front_insert_iterator/requirements/base_classes.cc:
Likewise.
* testsuite/24_iterators/insert_iterator/requirements/base_classes.cc:
Likewise.
* testsuite/24_iterators/istream_iterator/requirements/base_classes.cc:
Likewise.
* testsuite/24_iterators/istreambuf_iterator/92285.cc: Likewise.
* testsuite/24_iterators/istreambuf_iterator/cons/sentinel.cc:
Likewise.
* testsuite/24_iterators/istreambuf_iterator/requirements/base_classes.cc:
Likewise.
* testsuite/24_iterators/istreambuf_iterator/requirements/dr445.cc:
Likewise.
* testsuite/24_iterators/ostream_iterator/requirements/base_classes.cc:
Likewise.
* testsuite/24_iterators/ostreambuf_iterator/requirements/base_classes.cc:
Likewise.
* testsuite/25_algorithms/constexpr_macro.cc: Likewise.
* testsuite/25_algorithms/equal/constrained.cc: Likewise.
* testsuite/25_algorithms/headers/cstdlib/functions_std.cc:
Likewise.
* testsuite/25_algorithms/inplace_merge/1.cc: Likewise.
* testsuite/25_algorithms/lexicographical_compare/constrained.cc:
Likewise.
* testsuite/25_algorithms/make_heap/movable.cc: Likewise.
* testsuite/25_algorithms/pstl/feature_test-4.cc: Likewise.
* testsuite/25_algorithms/random_shuffle/1.cc: Likewise.
* testsuite/25_algorithms/random_shuffle/moveable.cc: Likewise.
* testsuite/25_algorithms/random_shuffle/requirements/explicit_instantiation/2.cc:
Likewise.
* testsuite/25_algorithms/sort/35588.cc: Likewise.
* testsuite/25_algorithms/stable_partition/1.cc: Likewise.
* testsuite/25_algorithms/stable_partition/constrained.cc:
Likewise.
* testsuite/25_algorithms/stable_partition/mem_check.cc:
Likewise.
* testsuite/25_algorithms/stable_partition/moveable.cc:
Likewise.
* testsuite/25_algorithms/stable_partition/requirements/explicit_instantiation/2.cc:
Likewise.
* testsuite/25_algorithms/stable_partition/requirements/explicit_instantiation/pod.cc:
Likewise.
* testsuite/25_algorithms/stable_sort/1.cc: Likewise.
* testsuite/26_numerics/complex/2.cc: Likewise.
* testsuite/26_numerics/headers/cstdlib/13943.cc: Likewise.
* testsuite/26_numerics/headers/cstdlib/2190.cc: Likewise.
* testsuite/26_numerics/headers/cstdlib/60401.cc: Likewise.
* testsuite/26_numerics/headers/cstdlib/dr2192.cc: Likewise.
* testsuite/26_numerics/headers/cstdlib/dr2192_neg.cc: Likewise.
* testsuite/26_numerics/headers/cstdlib/dr2735.cc: Likewise.
* testsuite/26_numerics/headers/cstdlib/functions_std.cc:
Likewise.
* testsuite/26_numerics/headers/cstdlib/macros.cc: Likewise.
* testsuite/26_numerics/headers/cstdlib/types_std.cc: Likewise.
* testsuite/26_numerics/headers/cstdlib/types_std_c++0x.cc:
Likewise.
* testsuite/26_numerics/lerp/version.cc: Likewise.
* testsuite/26_numerics/midpoint/version.cc: Likewise.
* testsuite/27_io/basic_syncbuf/2.cc: Likewise.
* testsuite/27_io/basic_syncstream/2.cc: Likewise.
* testsuite/27_io/fpos/14320-1.cc: Likewise.
* testsuite/27_io/fpos/14320-2.cc: Likewise.
* testsuite/27_io/fpos/14320-3.cc: Likewise.
* testsuite/27_io/fpos/14320-4.cc: Likewise.
* testsuite/27_io/spanstream/version.cc: Likewise.
* testsuite/29_atomics/atomic/lwg3220.cc: Likewise.
* testsuite/29_atomics/atomic/operators/51811.cc: Likewise.
* testsuite/29_atomics/atomic/wait_notify/1.cc: Likewise.
* testsuite/29_atomics/atomic/wait_notify/102994.cc: Likewise.
* testsuite/29_atomics/atomic/wait_notify/2.cc: Likewise.
* testsuite/29_atomics/headers/stdatomic.h/version.cc: Likewise.
* testsuite/30_threads/barrier/2.cc: Likewise.
* testsuite/30_threads/condition_variable_any/stop_token/2.cc:
Likewise.
* testsuite/30_threads/jthread/version.cc: Likewise.
* testsuite/30_threads/latch/2.cc: Likewise.
* testsuite/30_threads/semaphore/2.cc: Likewise.
* testsuite/30_threads/stop_token/2.cc: Likewise.
* testsuite/abi/pr42230.cc: Likewise.
* testsuite/ext/shared_ptr/1.cc: Likewise.
* testsuite/libstdc++-xmethods/shared_ptr.cc: Likewise.
* testsuite/std/ranges/adaptors/lazy_split_neg.cc: Likewise.
* testsuite/std/ranges/adaptors/p1739.cc: Likewise.
* testsuite/std/ranges/iota/lwg3292_neg.cc: Likewise.
* testsuite/std/ranges/p2325.cc: Likewise.
Jonathan Wakely [Fri, 30 Sep 2022 12:36:30 +0000 (13:36 +0100)]
libstdc++: Enable std::bitset<N>::bitset(const char*) for freestanding
The std::bitset constructor from a character string is specified in
terms of std::basic_string and std::char_traits, but doesn't need to be.
This makes it available for freestanding.
libstdc++-v3/ChangeLog:
* include/std/bitset (bitset(const C*, size_type n, C, C))
[!_GLIBCXX_HOSTED]: Remove std::basic_string dependency.
(_M_copy_from_ptr) [!_GLIBCXX_HOSTED]: Abort instead of
throwing.