gcc/ada/
* exp_put_image.adb:
(Enable_Put_Image, Preload_Root_Buffer_Type): Revert to querying
the -gnatd_z switch, as opposed to testing whether Ada_Version >= Ada_2022.
gcc/ada/
* checks.adb (Accessibility_Checks_Suppressed): Add check
against restriction No_Dynamic_Accessibility_Checks.
(Apply_Accessibility_Check): Add assertion to check restriction
No_Dynamic_Accessibility_Checks is not active.
* debug.adb: Add documentation for new debugging switch to
control which accessibility model gets employed under
restriction No_Dynamic_Accessibility_Checks.
* exp_attr.adb (Expand_N_Attribute_Reference): Disable dynamic
accessibility check generation when
No_Dynamic_Accessibility_Checks is active.
* exp_ch4.adb (Apply_Accessibility_Check): Skip check generation
when restriction No_Dynamic_Accessibility_Checks is active.
(Expand_N_Allocator): Disable dynamic accessibility checks when
No_Dynamic_Accessibility_Checks is active.
(Expand_N_In): Disable dynamic accessibility checks when
No_Dynamic_Accessibility_Checks is active.
(Expand_N_Type_Conversion): Disable dynamic accessibility checks
when No_Dynamic_Accessibility_Checks is active.
* exp_ch5.adb (Expand_N_Assignment_Statement): Disable
alternative accessibility model calculations when computing a
dynamic level for a SAOAAT.
* exp_ch6.adb (Add_Call_By_Copy_Code): Disable dynamic
accessibility check generation when
No_Dynamic_Accessibility_Checks is active.
(Expand_Branch): Disable alternative accessibility model
calculations.
(Expand_Call_Helper): Disable alternative accessibility model
calculations.
* restrict.adb, restrict.ads: Add new restriction
No_Dynamic_Accessibility_Checks.
(No_Dynamic_Accessibility_Checks_Enabled): Created to test when
experimental features (which are generally incompatible with
standard Ada) can be enabled.
* sem_attr.adb (Safe_Value_Conversions): Add handling of new
accessibility model under the restriction
No_Dynamic_Accessibility_Checks.
* sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings):
Disallow new restriction No_Dynamic_Accessibility_Checks from
being exclusively specified within a body or subunit without
being present in a specification.
* sem_res.adb (Check_Fully_Declared_Prefix): Minor comment
fixup.
(Valid_Conversion): Omit implicit conversion checks on anonymous
access types and perform static checking instead when
No_Dynamic_Accessibility_Checks is active.
* sem_util.adb, sem_util.ads (Accessibility_Level): Add special
handling of anonymous access objects, formal parameters,
anonymous access components, and function return objects.
(Deepest_Type_Access_Level): When
No_Dynamic_Accessibility_Checks is active employ an alternative
model. Add paramter Allow_Alt_Model to override the new behavior
in certain cases.
(Type_Access_Level): When No_Dynamic_Accessibility_Checks is
active employ an alternative model. Add parameter
Allow_Alt_Model to override the new behavior in certain cases.
(Typ_Access_Level): Created within Accessibility_Level for
convenience.
* libgnat/s-rident.ads, snames.ads-tmpl: Add handing for
No_Dynamic_Accessibility_Checks.
gcc/ada/
* aspects.ads: Add GNAT_Annotate aspect.
* gnat1drv.adb (Adjust_Global_Switches): Stop defining
Name_Gnat_Annotate as an alias of Name_Annotate.
* snames.ads-tmpl: Define Gnat_Annotate.
* par-prag.adb, sem_prag.ads: Add Pragma_Gnat_Annotate to list
of pragmas.
* lib-writ.adb, sem_ch13.adb, sem_prag.adb: Handle Gnat_Annotate
like Aspect_Annotate.
gcc/ada/
* sem_util.adb (Has_Compatible_Alignment_Internal): Fix
indentation of ELSIF comments; remove explicit calls to
UI_To_Int; remove extra parens around the MOD operand.
gcc/ada/
* sem_aggr.adb (Resolve_Record_Aggregate, Step_5): Do not check
for the need to use an extension aggregate for a given component
when within an instance and the type of the component hss a
private ancestor: the instantiation is legal if the generic
compiles, and spurious errors may be generated otherwise.
gcc/ada/
* errout.adb (Output_JSON_Message): Recursively call
Output_JSON_Message for continuation messages instead of
appending their content to the initial message.
gcc/ada/
* debug.adb: Remove comments about -gnatd_z switch.
* exp_ch3.adb (Make_Predefined_Primitive_Specs): A one-line fix
for a subtle bug that took some effort to debug. Append a new
Put_Image procedure for a type extension even if it seems to
already have one, just as is done for (for example) the
streaming-related Read procedure.
* exp_put_image.adb:
(Build_Record_Put_Image_Procedure.Make_Component_Attributes): Do
not treat _Parent component like just another component, for two
reasons. 1. If the _parent component's type has a
user-specified Put_Image procedure, then we want to generate a
call to that procedure and then generate extension aggregate
syntax. 2. Otherwise, we still don't want to see any mention of
"_parent" in the generated image text.
(Build_Record_Put_Image_Procedure.Make_Component_Name): Add
assertion that we are not generating a reference to an "_parent"
component.
(Build_Record_Put_Image_Procedure): Add special treatment for
null records. Add call to Duplicate_Subexpr for image attribute
prefix in order to help with expansion needed in the class-wide
case (where the prefix is also referenced in the call to
Wide_Wide_Expanded_Name) if evaluation of the prefix has side
effects. Add new local helper function, Put_String_Exp. Add
support for case where prefix type is class-wide.
(Enable_Put_Image, Preload_Root_Buffer_Type): Query Ada_Version
> Ada_2022 instead of (indirectly) querying -gnatd_z switch.
* freeze.adb (In_Expanded_Body): A one-line change to add
TSS_Put_Image to the list of subprograms that have
expander-created bodies.
* rtsfind.ads: Add support for accessing
Ada.Tags.Wide_Wide_Expanded_Name.
* sem_ch3.ads, sem_ch3.adb: Delete Is_Null_Extension function,
as part of moving it to Sem_Util.
* sem_ch13.adb
(Analyze_Put_Image_TSS_Definition.Has_Good_Profile): Improve
diagnostic messages in cases where the result is going to be
False and the Report parameter is True. Relax overly-restrictive
checks in order to implement mode conformance.
(Analyze_Stream_TSS_Definition.Has_Good_Profile): Add similar
relaxation of parameter subtype checking for the Stream
parameter of user-defined streaming subprograms.
* sem_disp.adb (Check_Dispatching_Operation): A one-line
change (and an accompanying comment change) to add TSS_Put_Image
to the list of compiler-generated dispatching primitive
operations.
* sem_util.ads, sem_util.adb: Add Ignore_Privacy Boolean
parameter to Is_Null_Record_Type function (typically the
parameter will be False when the function is being used in the
implementation of static semantics and True for dynamic
semantics; the parameter might make a difference in the case of,
for example, a private type that is implemented as a null record
type). Add related new routines Is_Null_Extension (formerly
declared in Sem_Ch3), Is_Null_Extension_Of, and
Is_Null_Record_Definition.
gcc/ada/
* checks.adb, exp_aggr.adb, exp_ch5.adb, freeze.adb,
sem_util.adb, sem_util.ads: Change L and H to be First and Last,
to match the attributes in the RM. Change calls from procedure
to function where appropriate.
gcc/ada/
* sem_util.ads, sem_util.adb (Compute_Returns_By_Ref): New
procedure to compute Returns_By_Ref, to avoid some code
duplication. This will likely change soon, so it's good to have
the code in one place.
(CW_Or_Has_Controlled_Part): Move here from Exp_Ch7, because
it's called by Compute_Returns_By_Ref, and this is a better
place for it anyway.
(Needs_Finalization): Fix comment to be vague instead of wrong.
* exp_ch6.adb (Expand_N_Subprogram_Body, Freeze_Subprogram):
Call Compute_Returns_By_Ref.
* sem_ch6.adb (Check_Delayed_Subprogram): Call
Compute_Returns_By_Ref.
* exp_ch7.ads, exp_ch7.adb (CW_Or_Has_Controlled_Part): Move to
Sem_Util.
(Has_New_Controlled_Component): Remove unused function.
arm-eabi uses -fshort-enums by default while arm-linux-gnueabi* do not,
like most (all?) other targets, but this test relies -fno-short-enums.
Fix it by forcing -fno-short-enums.
2021-07-05 Christophe Lyon <christophe.lyon@foss.st.com>
PR debug/101321
gcc/testsuite/
* gcc.dg/debug/btf/btf-bitfields-3.c: Add -fno-short-enums.
The setting is likely a typo and was meant to affect the scalar version
but even there LOOP_C_INFINITE is at most an optimization to the
niter analysis. Clearly setting it on the vectorized loop which we
just versioned to be _not_ infinite is bogus so the following change
removes this.
2021-07-05 Richard Biener <rguenther@suse.de>
* tree-vect-loop-manip.c (vect_loop_versioning): Do not
set LOOP_C_INFINITE on the vectorized loop.
This fixes the vectorizer loop versioning code failing to clear
niter related info on the scalar loop as it assumed get_loop_copy
would work even for the outermost loop. The patch makes that
assumption hold by adjusting the loop versioning code.
2021-07-05 Richard Biener <rguenther@suse.de>
PR middle-end/101291
* cfgloopmanip.c (loop_version): Set the loop copy of the
versioned loop to the new loop.
This should fix the FAIL of gcc.dg/vect/bb-slp-74.c on arm.
2021-07-05 Richard Biener <rguenther@suse.de>
PR testsuite/101299
* gcc.dg/vect/bb-slp-74.c: Add vect_double requires.
Typo of standard pattern name has been fixed by r12-1970, remove those
xfails.
gcc/testsuite/ChangeLog
* gcc.target/i386/pr92658-avx512vl.c: Refine testcase.
This reorganises the biarch definitions to cater for the
macro changes and removals at r12-36.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR target/100269 - [12 Regression] i686 biarch compiler fails for Darwin after r12-36.
PR target/100269
gcc/ChangeLog:
PR target/100269
* config.gcc: Ensure that Darwin biarch definitions are
added before i386.h.
* config/i386/darwin.h (TARGET_64BIT): Remove.
(PR80556_WORKAROUND): New.
(REAL_LIBGCC_SPEC): Amend to use PR80556_WORKAROUND.
(DARWIN_SUBARCH_SPEC): New.
* config/i386/darwin32-biarch.h (TARGET_64BIT_DEFAULT,
TARGET_BI_ARCH, PR80556_WORKAROUND): New.
(REAL_LIBGCC_SPEC): Remove.
* config/i386/darwin64-biarch.h (TARGET_64BIT_DEFAULT,
TARGET_BI_ARCH, PR80556_WORKAROUND): New.
(REAL_LIBGCC_SPEC): Remove.
CTF utilizes DWARF sections, but it is a distinct debugging
format. The CTF support in GCC is not implemented as a
separate debugging format. AIX supports DWARF but not CTF
section.
The GCC testsuite test for target support of a debugging format
checks if GCC itself emits an error message, not if the
debugging output compiles correctly. Because CTF is not
a distinct debugging format, GCC does not distinguish support
for targets and does not have the ability to produce an error
message.
This patch skips the CTF and BTF debug directories, and
explicitly reports that AIX doesn't support CTF. Currently the
dejagnu code to skip multiple debugging levels for CTF does
not ensure that CTF is a supported debugging format. The patch
also shifts the CTF options logic to within the test that CTF
debug format is supported.
Bootstrapped on powerpc-ibm-aix7.2.3.0 and powerpc64le-linux.
gcc/testsuite/ChangeLog:
* gcc.dg/debug/btf/btf.exp: Skip on AIX.
* gcc.dg/debug/ctf/ctf.exp: Skip on AIX.
* lib/gcc-dg.exp (gcc-dg-target-supports-debug-format): AIX
doesn't support CTF.
(gcc-dg-debug-runtest): Move CTF support within
target support format test.
Since vec_duplicate only works on scalar, don't use it on vector in
store constructor expansion.
gcc/
PR middle-end/101294
* expr.c (store_constructor): Don't use vec_duplicate on vector.
gcc/testsuite/
PR middle-end/101294
* gcc.dg/pr101294.c: New test.
The D front-end semantic pass sometimes declares a temporary inside a
return expression. This is now detected with the RESULT_DECL replacing
the temporary, allowing for RVO to be done.
PR d/101273
gcc/d/ChangeLog:
* toir.cc (IRVisitor::visit (ReturnStatement *)): Detect returns that
use a temporary, and replace with return value.
gcc/testsuite/ChangeLog:
* gdc.dg/torture/pr101273.d: New test.
To prevent the RHS of an assignment modifying the LHS before the
assignment proper, a target_expr is forced so that function calls that
return with slot optimization modify the temporary instead. This did
not work for conditional expressions however, to give one example. So
now the RHS is always forced to a temporary.
PR d/101282
gcc/d/ChangeLog:
* d-codegen.cc (build_assign): Force target_expr on RHS for non-POD
assignment expressions.
gcc/testsuite/ChangeLog:
* gdc.dg/torture/pr101282.d: New test.
This is an OpenMP 5.1 feature, but I think it is something very useful for
OpenMP users, so I'm committing it now instead of waiting until all 5.0
work is done.
The support is incomplete, only attributes on statements (or block local
declarations) are supported right now, while for non-executable directives
they should be also supported at namespace scope and at class scope, and
for declarations in all places that appertain to the declarations rather
than e.g. types.
I need to also fix up handling of C++11 non-OpenMP attributes mixed with
OpenMP attributes before block local declarations (currently it throws
them away), probably reject if the directives appertain to labels etc.
In order not to complicate all the OpenMP directive parsing, it is done
by remembering the tokens from the attribute, slightly adjusting them and
feeding them through a temporary new lexer to cp_parse_pragma.
2021-07-02 Jakub Jelinek <jakub@redhat.com>
gcc/c-family/
* c-common.h (enum c_omp_directive_kind): New enum.
(struct c_omp_directive): New type.
(c_omp_categorize_directive): Declare.
* c-omp.c (omp_directives): New variable.
(c_omp_categorize_directive): New function.
gcc/cp/
* parser.h (struct cp_lexer): Add in_omp_attribute_pragma member.
(struct cp_omp_declare_simd_data): Likewise.
* cp-tree.h (enum cp_tree_index): Add CPTI_OMP_IDENTIFIER.
(omp_identifier): Define.
* parser.c (cp_parser_skip_to_pragma_eol): Handle
in_omp_attribute_pragma CPP_PRAGMA_EOL followed by CPP_EOF.
(cp_parser_require_pragma_eol): Likewise.
(struct cp_omp_attribute_data): New type.
(cp_parser_handle_statement_omp_attributes): New function.
(cp_parser_statement): Handle OpenMP directives in statement's
attribute-specifier-seq.
(cp_parser_omp_directive_args, cp_parser_omp_sequence_args): New
functions.
(cp_parser_std_attribute): Handle omp::directive and omp::sequence
attributes.
(cp_parser_omp_all_clauses): If in_omp_attribute_pragma, allow
a comma also before the first clause.
(cp_parser_omp_allocate): Likewise.
(cp_parser_omp_atomic): Likewise.
(cp_parser_omp_depobj): Likewise.
(cp_parser_omp_flush): Likewise.
(cp_parser_omp_ordered): Likewise.
(cp_parser_omp_declare_simd): Save in_omp_attribute_pragma
into struct cp_omp_declare_simd_data.
(cp_finish_omp_declare_variant): Add in_omp_attribute_pragma
argument. If set, allow a comma also before match clause.
(cp_parser_late_parsing_omp_declare_simd): If in_omp_attribute_pragma,
allow a comma also before the first clause. Adjust
cp_finish_omp_declare_variant caller.
(cp_parser_omp_declare_target): If in_omp_attribute_pragma, allow
a comma also before the first clause.
(cp_parser_omp_declare_reduction_exprs): Likewise.
(cp_parser_omp_requires): Likewise.
* decl.c (initialize_predefined_identifiers): Initialize
omp_identifier.
* decl2.c (cplus_decl_attributes): Reject omp::directive and
omp::sequence attributes.
gcc/testsuite/
* g++.dg/gomp/attrs-1.C: New test.
* g++.dg/gomp/attrs-2.C: New test.
* g++.dg/gomp/attrs-3.C: New test.
I've noticed that we allow a trailing comma on OpenMP atomic construct
if there is at least one clause. Commas should be only allowed to
separate the clauses (or in OpenMP 5.1 to separate directive name
from the clauses).
2021-07-02 Jakub Jelinek <jakub@redhat.com>
PR c/101297
* c-parser.c (c_parser_omp_atomic): Consume comma only if it
appears before a CPP_NAME.
* parser.c (cp_parser_omp_atomic): Consume comma only if it
appears before a CPP_NAME.
* c-c++-common/gomp/atomic-24.c: New test.
Here any_template_parm_r is failing to mark the template parameters
implicitly used by the unqualified use of 'd' inside the constraint
because the code to do so assumes each level of a template parameter
list points to the corresponding primary template, but here the
parameter level for A in the out-of-line definition of A::B does not
(nor do the parameter levels for A and C in the definition of A::C),
which causes us to overlook the sharing.
So it seems we can't in general depend on the TREE_TYPE of a template
parameter level being non-empty here. This patch partially fixes this
by rewriting the relevant part of any_template_parm_r to not depend on
the TREE_TYPE of outer levels. We still depend on the innermost level
to point to the innermost primary template, so we still crash on the
commented out line in the below testcase.
PR c++/101247
gcc/cp/ChangeLog:
* pt.c (any_template_parm_r) <case TEMPLATE_DECL>: Rewrite to
use common_enclosing_class and to not depend on the TREE_TYPE
of outer levels pointing to the corresponding primary template.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-memtmpl4.C: New test.
Add support for the __builtin_vsx_lxvp and __builtin_vsx_stxvp built-ins
to keep in sync with LLVM which added these earlier.
2021-07-02 Peter Bergner <bergner@linux.ibm.com>
gcc/
* config/rs6000/rs6000-builtin.def (BU_MMA_PAIR_LD, BU_MMA_PAIR_ST):
New macros.
(__builtin_vsx_lxvp, __builtin_vsx_stxvp): New built-ins.
* config/rs6000/rs6000-call.c (rs6000_gimple_fold_mma_builtin): Expand
lxvp and stxvp built-ins.
(mma_init_builtins): Handle lxvp and stxvp built-ins.
(builtin_function_type): Likewise.
* doc/extend.texi (__builtin_vsx_lxvp, __builtin_mma_stxvp): Document.
gcc/testsuite/
* gcc.target/powerpc/mma-builtin-7.c: New test.
* gcc.target/powerpc/mma-builtin-8.c: New test.
gcc/ChangeLog
* config/h8300/h8300-protos.h (compute_a_shift_cc): Accept
additional argument for the code.
* config/h8300/h8300.c (compute_a_shift_cc): Accept additional
argument for the code. Just return if the ZN bits are useful or
not rather than the old style CC_* enums.
* config/h8300/shiftrotate.md (shiftqi_noscratch): Move before
more generic shiftqi patterns.
(shifthi_noscratch, shiftsi_noscratch): Similarly.
(shiftqi_noscratch_set_flags): New pattern.
(shifthi_noscratch_set_flags, shiftsi_noscratch_set_flags): Likewise.
Signed 1 bit values have a range of [-1, 0] but neither (0 - 1) nor (-1 + 1)
can be represented. For signed values, add or subtract -1 as appropriate.
PR tree-optimization/101223
gcc/
* range-op.cc (build_lt): Add -1 for signed values.
(built_gt): Subtract -1 for signed values.
gcc/testsuite/
* gcc.dg/pr101223.c: New.
Add BTF_KIND_FLOAT, a new BTF type kind which has recently stabilized in
the linux kernel [1]. This kind is used for encoding floating point
types, and is of particular use when generating BTF for some s390
arch-specific kernel headers.
Also update some BTF tests which previously used floating point types to
check correct behavior for types with no BTF representation.
[1]: b1828f0b04
include/ChangeLog:
* btf.h (struct btf_type): Update bit usage comment.
(BTF_INFO_KIND): Update bit mask.
(BTF_KIND_FLOAT): New define.
(BTF_KIND_MAX): Update.
gcc/ChangeLog:
* btfout.c (get_btf_kind): Support BTF_KIND_FLOAT.
(btf_asm_type): Likewise.
gcc/testsuite/ChangeLog:
* gcc.dg/debug/btf/btf-float-1.c: New test.
* gcc.dg/debug/btf/btf-function-3.c: Use different unrepresentable type.
* gcc.dg/debug/btf/btf-struct-2.c: Likewise.
* gcc.dg/debug/btf/btf-variables-2.c: Likewise.
* config/h8300/h8300-protos.h (output_a_shift): Make first argument
an array of rtx rather than a pointer to rtx. Add code argument.
(compute_a_shift_length): Similarly.
* config/h8300/h8300.c (h8300_shift_costs): Adjust now that the
shift itself isn't an operand. Create dummy operand[0] to carry
a mode and pass a suitable rtx code to compute_a_shift_length.
(get_shift_alg): Adjust operand number of clobber in output templates.
(output_a_shift): Make first argument an array of rtx rather than
a pointer to rtx. Add code argument for the type of shift.
Adjust now that the shift itself is no longer an operand.
(compute_a_shift_length): Similarly.
* config/h8300/shiftrotate.md (shiftqi, shifthi, shiftsi): Use an
iterator rather than nshift_operator.
(shiftqi_noscratch, shifthi_noscratch, shiftsi_noscratch): Likewise.
(shiftqi_clobber_flags): Adjust to API changes in output_a_shift
and compute_a_shift_length.
(shiftqi_noscratch_clobber_flags): Likewise.
(shifthi_noscratch_clobber_flags): Likewise.
(shiftsi_noscratch_clobber_flags): Likewise.
Darwin uses an efficient two-stage process for debug linking.
The static linker (ld64) notes the inputs required but does not
link the debug. When required / on demand the debug is linked
into a separate package by the debug linker (dsymutil). At
present none of the Darwin tools consume or understand BTF/CTF.
The static linker silently accepts the sections (but will not
act on them as containing anything to be processed).
However, the debug linker produces a warning that it has been
presented with input with no [DWARF] debug content:
warning: no debug symbols in executable (-arch x86_64).
This causes several testsuite fails with excess errors.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR debug/101283 - Several tests fail on Darwin with -gctf/gbtf
PR debug/101283
gcc/ChangeLog:
* config/darwin.h (DSYMUTIL_SPEC): Do not try to run
dsymutil for BTF/CTF.
In a similar manner to r12-1960-gcc8453012f75d, this provides a
placeholder section name for BTF data. This change groups BTF
and CTF debug formats in the same segment, but keeps them in
separate sections.
As per the CTF section designation, this should be agreed or
amended to an agreed form before GCC 12 ships.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR debug/101283 - Several tests fail on Darwin with -gctf/gbtf
PR debug/101283
gcc/ChangeLog:
* config/darwin.h (CTF_INFO_SECTION_NAME): Update the
segment to include BTF.
(BTF_INFO_SECTION_NAME): New.
This makes sure to handle MEM[p + 4] and MEM[p].j with j at offset 4
as the same ref in store motion. For hashing we need to be
more restrictive in what we handle since there's no poly-int
handlers for inchash. For comparison we can compare poly_offsets directly.
2021-07-02 Richard Biener <rguenther@suse.de>
PR tree-optimization/101293
* tree-ssa-loop-im.c (mem_ref_hasher::equal): Compare MEM_REF bases
with combined offsets.
(gather_mem_refs_stmt): Hash MEM_REFs as if their offset were
combined with the rest of the offset.
* gcc.dg/tree-ssa/ssa-lim-15.c: New testcase.
This reverts the changes in r12-1778 which added a noexcept-specifier to
std::unique_ptr<T[]>::operator[], and the changes in r12-1844 which
tried to make it work with incomplete types (for PR 101236).
The noexcept-specifier is not required by the standard, and is causing
regressions, so just remove it.
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
PR libstdc++/101271
* include/bits/unique_ptr.h (unique_ptr<T[],D>::operator[]):
Remove noexcept-specifier.
(unique_ptr<T[],D>::_S_nothrow_deref): Remove.
* testsuite/20_util/unique_ptr/lwg2762.cc: Remove checks for
operator[].