If the Default_Component_Value aspect is specified for an array type, then
specifying Initialize_Scalars or Normalize_Scalars should have no effect
on the default initialization of an object of the array type.
gcc/ada/
* exp_ch3.adb
(Expand_N_Object_Declaration.Default_Initialize_Object): Add test for
specified Default_Component_Value aspect when deciding whether
either Initialize_Scalars or Normalize_Scalars impacts default
initialization of an array object.
Javier Miranda [Mon, 3 Apr 2023 17:15:47 +0000 (17:15 +0000)]
ada: Crash on aggregate for tagged record with discriminants
The frontend may crash processing an aggregate initializing
a derived tagged record type that has discriminants.
gcc/ada/
* sem_aggr.adb
(Resolve_Record_Aggregate): For aggregates of derived tagged
record types with discriminants, when collecting components
from ancestors, pass to subprogram Gather_Components the
parent type. Required to report errors on wrong aggregate
components.
Piotr Trojanek [Wed, 29 Mar 2023 14:21:01 +0000 (16:21 +0200)]
ada: Fix retrieval of spec entity from entry body entity
When retrieving entities of subprogram spec we only handled functions
and procedures, but not entries. This had no consequences, because we
then only applied checks to functions, but still is worth a cleanup, so
the code is easier to adapt for access-to-subprogram entities as well.
Piotr Trojanek [Mon, 3 Apr 2023 14:54:39 +0000 (16:54 +0200)]
ada: Restore parent link for both lists and nodes in class-wide condition
When preanalysing class-wide conditions, we restore "Function (Object)"
to its original "Object.Function" notation. This requires the Parent
links to be fixed. We did it for nodes; now we do it for lists as well.
This patch is enough to fix assertion failure in CCG and to make the
tree well-connected. Perhaps there is a more elegant solution, but that
remains to be investigated.
gcc/ada/
* contracts.adb (Fix_Parent): Fir part both for lists and nodes.
Eric Botcazou [Sat, 1 Apr 2023 19:57:21 +0000 (21:57 +0200)]
ada: Fix spurious error on nested instantiations with generic renaming
The problem is that the renaming slightly changes the form of a global
reference that was saved during the analysis of a generic package, and
that is sufficient to fool the code adjusting global references during
the instantiation.
gcc/ada/
* sem_ch12.adb (Copy_Generic_Node): Test the original node kind
for the sake of consistency. For identifiers and other entity
names and operators, accept an expanded name as associated node.
Replace "or" with "or else" in condtion and fix its formatting.
Piotr Trojanek [Fri, 31 Mar 2023 12:40:10 +0000 (14:40 +0200)]
ada: Simplify removal of formals from the scope
Calls to Install_Formals are typically enclosed by Push_Scope/End_Scope.
There were just two such calls that instead used Pop_Scope, but most
likely that was by mistake.
Cleanup related to handling of class-wide contracts. Behavior appears to
be unaffected.
gcc/ada/
* contracts.adb (Remove_Formals): Remove.
(Preanalyze_Condition): Replace Pop_Scope with End_Scope.
* sem_ch13.adb (Build_Discrete_Static_Predicate): Replace
Pop_Scope with End_Scope; enclose Install_Formals within
Push_Scope/End_Scope.
Javier Miranda [Wed, 29 Mar 2023 18:48:19 +0000 (18:48 +0000)]
ada: Spurious error on string interpolation
The frontend reports spurious errors on operators found in
interpolated string literals.
gcc/ada/
* scans.ads (Inside_Interpolated_String_Expression): New variable.
* par-ch2.adb (P_Interpolated_String_Literal): Set/clear new
variable when parsing interpolated string expressions.
* scng.adb (Set_String): Skip processing operator symbols when we
arescanning an interpolated string literal.
ada: Add QNX specific version of System.Parameters
The QNX runtimes used the default implementation of
System.Parameters that defines a default stack size
of 2 MB. The QNX specific version uses the QNX default
stack size of 256 KB instead.
gcc/ada/
* Makefile.rtl (QNX): Use s-parame__qnx.adb for s-parame.adb.
* libgnat/s-parame__qnx.adb: Add QNX specific version of
System.Parameters.
Yannick Moy [Thu, 30 Mar 2023 13:07:09 +0000 (15:07 +0200)]
ada: Restore SPARK_Mode On for numerical functions
GNATprove has ad-hoc support for the standard numerical functions, which
consists in emitting an unprovable preconditions on cases which could
lead to an overflow. These functions are thus valid to call from SPARK
code.
gcc/ada/
* libgnat/a-ngelfu.ads: Restore SPARK_Mode from context.
Marc Poulhiès [Wed, 22 Mar 2023 09:43:07 +0000 (10:43 +0100)]
ada: Fix restoration of parent link
When resetting the parent link after having restored the selected
component node, the assertion used was incorrectly triggered when the
traversal hits the members of the parameters association list, as in:
This.Some_Func (Param1, Param2).Dispatching_Call
When restoring the selected component for Dispatching_Call, the
assertion was wrongly triggered when passed Param1 and Param2.
Piotr Trojanek [Wed, 29 Mar 2023 08:03:29 +0000 (10:03 +0200)]
ada: Analyze pre/post on access-to-subprogram without a wrapper
Aspects Pre/Post attached to an access-to-subprogram type were relocated
to a spec of a wrapper subprogram and analyzed there; the body of the
wrapper was only created with expansion enabled. However, there were
several problems with this approach.
When switch -gnat2022 was missing, we didn't relocate the Pre/Post
aspects to wrapper and complained that their placement is incorrect
(because we wrongly assumed that relocation is unconditional). Now we
gently inform, that these aspects are Ada 2022 features that require
-gnat20222 switch.
When switch -gnata was missing, we entirely bypassed analysis of the
Pre/Post aspects on access-to-subprogram. This was unlike for Pre/Post
aspects on subprograms, which are checked for legality regardless of the
-gnata switch.
Finally, in the GNATprove backend we were picking the Pre/Post contract
on an access-to-subprogram type from the wrapper, which was awkward as
otherwise we had to ignore the wrapper specs and special-case for their
missing bodies. In general, it is cleaner for GNATprove to extract the
aspect expressions from where they originally appear and not from
various expansion artifacts like access-to-subprogram wrappers (but the
same applies to predication functions, type invariant procedures and
default initialization procedures).
Now we analyze the Pre/Post aspects on the types where they are
originally attached, regardless of the -gnata switch. Once we adapt
GNATprove to pick the aspect expression from there, we will stop
creating the wrapper spec when expansion is disabled.
gcc/ada/
* contracts.adb
(Add_Pre_Post_Condition): Adapt to handle pre/post of an
access-to-subprogram type.
(Analyze_Type_Contract): Analyze pre/post of an
access-to-subprogram.
* contracts.ads
(Analyze_Type_Contract): Adapt comment.
* sem_ch3.adb
(Build_Access_Subprogram_Wrapper): Copy pre/post aspects to
wrapper spec and keep it on the type.
* sem_prag.adb
(Analyze_Pre_Post_Condition): Expect pre/post aspects on
access-to-subprogram and complain if they appear without -gnat2022
switch.
(Analyze_Pre_Post_Condition_In_Decl_Part): Adapt to handle
pre/post on an access-to-subprogram type entity.
* sem_attr.adb (Analyze_Attribute_Old_Result): Likewise.
(Result): Likewise.
Juzhe-Zhong [Mon, 29 May 2023 04:52:36 +0000 (12:52 +0800)]
RISC-V: Remove redundant printf of abs-run.c
Notice that this testcase cause unexpected fail:
FAIL: gcc.target/riscv/rvv/autovec/unop/abs-run.c (test for excess
errors)
Excess errors:
/work/home/jzzhong/work/rvv-opensource/software/host/toolchain/gcc/riscv-gcc/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/abs-run.c:22:7:
warning: implicit declaration of function 'printf'
[-Wimplicit-function-declaration]
/work/home/jzzhong/work/rvv-opensource/software/host/toolchain/gcc/riscv-gcc/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/abs-run.c:22:7:
warning: incompatible implicit declaration of built-in function 'printf'
[-Wbuiltin-declaration-mismatch]
/work/home/jzzhong/work/rvv-opensource/software/host/toolchain/gcc/riscv-gcc/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/abs-run.c:22:7:
warning: incompatible implicit declaration of built-in function 'printf'
[-Wbuiltin-declaration-mismatch]
/work/home/jzzhong/work/rvv-opensource/software/host/toolchain/gcc/riscv-gcc/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/abs-run.c:22:7:
warning: incompatible implicit declaration of built-in function 'printf'
[-Wbuiltin-declaration-mismatch]
/work/home/jzzhong/work/rvv-opensource/software/host/toolchain/gcc/riscv-gcc/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/abs-run.c:22:7:
warning: incompatible implicit declaration of built-in function 'printf'
[-Wbuiltin-declaration-mismatch]
* config/riscv/autovec.md (fma<mode>4): New pattern.
(*fma<mode>): Ditto.
* config/riscv/riscv-protos.h (enum insn_type): New enum.
(emit_vlmax_ternary_insn): New function.
* config/riscv/riscv-v.cc (emit_vlmax_ternary_insn): Ditto.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/rvv.exp: Add ternary tests
* gcc.target/riscv/rvv/autovec/ternop/ternop-1.c: New test.
* gcc.target/riscv/rvv/autovec/ternop/ternop-2.c: New test.
* gcc.target/riscv/rvv/autovec/ternop/ternop-3.c: New test.
* gcc.target/riscv/rvv/autovec/ternop/ternop_run-1.c: New test.
* gcc.target/riscv/rvv/autovec/ternop/ternop_run-2.c: New test.
* gcc.target/riscv/rvv/autovec/ternop/ternop_run-3.c: New test.
Juzhe-Zhong [Mon, 29 May 2023 03:01:32 +0000 (11:01 +0800)]
RISC-V: Fix incorrect VXRM configuration in mode switching for CALL and ASM
Currently mode switching incorrect codegen for the following case:
void fn (void);
void f (void * in, void *out, int32_t x, int n, int m)
{
for (int i = 0; i < n; i++) {
vint32m1_t v = __riscv_vle32_v_i32m1 (in + i, 4);
vint32m1_t v2 = __riscv_vle32_v_i32m1_tu (v, in + 100 + i, 4);
vint32m1_t v3 = __riscv_vaadd_vx_i32m1 (v2, 0, VXRM_RDN, 4);
fn ();
v3 = __riscv_vaadd_vx_i32m1 (v3, 3, VXRM_RDN, 4);
__riscv_vse32_v_i32m1 (out + 100 + i, v3, 4);
}
}
Pan Li [Thu, 25 May 2023 11:56:40 +0000 (19:56 +0800)]
RISC-V: Add ZVFHMIN extension to the -march= option
This patch would like to add new sub extension (aka ZVFHMIN) to the
-march= option. To make it simple, only the sub extension itself is
involved in this patch, and the underlying FP16 related RVV intrinsic
API depends on the TARGET_ZVFHMIN.
The Zvfhmin extension depends on the Zve32f extension. You can locate
more information about ZVFHMIN from below spec doc.
liuhongt [Thu, 25 May 2023 08:14:14 +0000 (16:14 +0800)]
Split notl + pbraodcast + pand to pbroadcast + pandn more modes.
r12-5595-gc39d77f252e895306ef88c1efb3eff04e4232554 adds 2 splitter to
transform notl + pbroadcast + pand to pbroadcast + pandn for
VI124_AVX2 which leaves out all DI-element-size ones as
well as all 512-bit ones.
This patch extend the splitter to VI_AVX2 which will handle DImode for
AVX2, and V64QImode,V32HImode,V16SImode,V8DImode for AVX512.
gcc/ChangeLog:
PR target/100711
* config/i386/sse.md (*andnot<mode>3): Extend below splitter
to VI_AVX2 to cover more modes.
gcc/testsuite/ChangeLog:
* gcc.target/i386/pr100711-2.c: Add v4di/v2di testcases.
* gcc.target/i386/pr100711-3.c: New test.
liuhongt [Mon, 22 May 2023 02:41:50 +0000 (10:41 +0800)]
Disable avoid_false_dep_for_bmi for atom and icelake(and later) core processors.
lzcnt/tzcnt has been fixed since skylake, popcnt has been fixed since
icelake. At least for icelake and later intel Core processors, the
errata tune is not needed. And the tune isn't need for ATOM either.
gcc/ChangeLog:
* config/i386/x86-tune.def (X86_TUNE_AVOID_FALSE_DEP_FOR_BMI):
Remove ATOM and ICELAKE(and later) core processors.
Martin Uecker [Fri, 26 May 2023 09:19:01 +0000 (11:19 +0200)]
c: -Wstringop-overflow for parameters with forward-declared sizes
Warnings from -Wstringop-overflow do not appear for parameters declared
as VLAs when the bound refers to a parameter forward declaration. This
is fixed by splitting the loop that passes through parameters into two,
first only recording the positions of all possible size expressions
and then processing the parameters.
PR c/109970
gcc/c-family:
* c-attribs.cc (build_attr_access_from_parms): Split loop to first
record all parameters.
* gcc.target/riscv/rvv/rvv.exp: Add unop tests.
* gcc.target/riscv/rvv/autovec/unop/abs-run.c: New test.
* gcc.target/riscv/rvv/autovec/unop/abs-rv32gcv.c: New test.
* gcc.target/riscv/rvv/autovec/unop/abs-rv64gcv.c: New test.
* gcc.target/riscv/rvv/autovec/unop/abs-template.h: New test.
* gcc.target/riscv/rvv/autovec/unop/vneg-run.c: New test.
* gcc.target/riscv/rvv/autovec/unop/vneg-rv32gcv.c: New test.
* gcc.target/riscv/rvv/autovec/unop/vneg-rv64gcv.c: New test.
* gcc.target/riscv/rvv/autovec/unop/vneg-template.h: New test.
* gcc.target/riscv/rvv/autovec/unop/vnot-run.c: New test.
* gcc.target/riscv/rvv/autovec/unop/vnot-rv32gcv.c: New test.
* gcc.target/riscv/rvv/autovec/unop/vnot-rv64gcv.c: New test.
* gcc.target/riscv/rvv/autovec/unop/vnot-template.h: New test.
Robin Dapp [Wed, 17 May 2023 12:38:18 +0000 (14:38 +0200)]
RISC-V: Add autovec sign/zero extension and truncation.
This patch implements the autovec expanders for sign and zero extension
patterns as well as the accompanying truncations. In order to use them
additional mode_attr iterators as well as vectorizer hooks are required.
Using these hooks we can e.g. vectorize with VNx4QImode as base mode
and extend VNx4SI to VNx4DI. They are still going to be expanded in the
future.
vf4 and vf8 truncations are emulated by truncating two and three times
respectively.
The patch also adds tests and changes some expectations for already
existing ones.
Combine does not yet handle binary operations of two widened operands
as we are missing the necessary split/rewrite patterns. These will be
added at a later time.
* gfortran.dg/gomp/allocate-2.f90: Update dg-error.
* gfortran.dg/gomp/allocate-4.f90: New test.
* gfortran.dg/gomp/allocate-5.f90: New test.
* gfortran.dg/gomp/allocate-6.f90: New test.
* gfortran.dg/gomp/allocate-7.f90: New test.
* gfortran.dg/gomp/allocators-1.f90: New test.
* gfortran.dg/gomp/allocators-2.f90: New test.
I looked at the commit, proof reading the commit, but missed
a <tab> in the changelog, fixing it with 'git ... --amend',
the new files sneaked in - and the auto-accept new files
without ChangeLog entry feature let it pass.
Tobias Burnus [Fri, 26 May 2023 16:07:34 +0000 (18:07 +0200)]
amdgcn: Change -m(no-)xnack to -mxnack=(on,off,any)
Since object code target ID V4, xnack has the values unspecified, '+' and '-',
which with this commit is represented in GCC as 'any', 'on', and 'off',
following the precidence for 'sram(-)ecc' and -msram-ecc=.
The current default was 'no' and is now 'off'; however, once XNACK is
implemented, the default should be probably 'any'.
This commit updates the commandline options to permit the new tristate and
updates the documentation. As the feature itself is currently not really
supported in GCC, the change should not affect real-world users.
The XNACK feature allows memory load instructions to restart safely following
a page-miss interrupt. This is useful for shared-memory devices, like APUs,
and to implement OpenMP Unified Shared Memory.
2023-05-26 Andrew Stubbs <ams@codesourcery.com>
Tobias Burnus <tobias@codesourcery.com>
* config/gcn/gcn-hsa.h (XNACKOPT): New macro.
(ASM_SPEC): Use XNACKOPT.
* config/gcn/gcn-opts.h (enum sram_ecc_type): Rename to ...
(enum hsaco_attr_type): ... this, and generalize the names.
(TARGET_XNACK): New macro.
* config/gcn/gcn.cc (gcn_option_override): Update to sorry for all
but -mxnack=off.
(output_file_start): Update xnack handling.
(gcn_hsa_declare_function_name): Use TARGET_XNACK.
* config/gcn/gcn.opt (-mxnack): Add the "on/off/any" syntax.
(sram_ecc_type): Rename to ...
(hsaco_attr_type: ... this.)
* config/gcn/mkoffload.cc (SET_XNACK_ANY): New macro.
(TEST_XNACK): Delete.
(TEST_XNACK_ANY): New macro.
(TEST_XNACK_ON): New macro.
(main): Support the new -mxnack=on/off/any syntax.
* doc/invoke.texi (-mxnack): Update for new syntax.
Andrew Pinski [Thu, 25 May 2023 22:08:24 +0000 (22:08 +0000)]
genmatch: Emit debug message right before "return x" instead of earlier
This is based on the review of https://gcc.gnu.org/pipermail/gcc-patches/2023-May/619342.html .
Instead of emitting debug message even if we don't apply a pattern, this fixes the issue
by only emitting it if it the pattern finally succeeded.
OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
gcc/ChangeLog:
* genmatch.cc (emit_debug_printf): New function.
(dt_simplify::gen_1): Emit printf into the code
before the `return true` or returning the folded result
instead of emitting it always.
In order to reject voodoo estimation logic with lots of magic numbers,
this patch revises the code to measure the costs of the three memset
methods based on the actual emission size of the insn sequence
corresponding to each method and choose the smallest one.
gcc/ChangeLog:
* config/xtensa/xtensa-protos.h
(xtensa_expand_block_set_unrolled_loop,
xtensa_expand_block_set_small_loop): Remove.
(xtensa_expand_block_set): New prototype.
* config/xtensa/xtensa.cc
(xtensa_expand_block_set_libcall): New subfunction.
(xtensa_expand_block_set_unrolled_loop,
xtensa_expand_block_set_small_loop): Rewrite as subfunctions.
(xtensa_expand_block_set): New function that calls the above
subfunctions.
* config/xtensa/xtensa.md (memsetsi): Change to invoke only
xtensa_expand_block_set().
xtensa: Add 'subtraction from constant' insn pattern
This patch makes try to eliminate using temporary pseudo for
'(minus:SI (const_int) (reg:SI))' if the addition of negative constant
value can be emitted in a single machine instruction.
/* example */
int test0(int x) {
return 1 - x;
}
int test1(int x) {
return 100 - x;
}
int test2(int x) {
return 25600 - x;
}
;; before
test0:
movi.n a9, 1
sub a2, a9, a2
ret.n
test1:
movi a9, 0x64
sub a2, a9, a2
ret.n
test2:
movi.n a9, 0x19
slli a9, a9, 10
sub a2, a9, a2
ret.n
* config/xtensa/xtensa-protos.h (xtensa_m1_or_1_thru_15):
New prototype.
* config/xtensa/xtensa.cc (xtensa_m1_or_1_thru_15):
New function.
* config/xtensa/constraints.md (O):
Change to use the above function.
* config/xtensa/xtensa.md (*subsi3_from_const):
New insn_and_split pattern.
* config/xtensa/xtensa.md (*extzvsi-1bit_ashlsi3):
Retract excessive line folding, and correct the value of
the "length" insn attribute related to TARGET_DENSITY.
(*extzvsi-1bit_addsubx): Ditto.
Bob Duff [Wed, 29 Mar 2023 17:57:35 +0000 (13:57 -0400)]
ada: Corrections to premature-references rules
This patch corrects the implementation of RM-8.3(17),
which says that a record extension is self-hidden until "record".
Previously, such premature references could cause a compiler crash.
gcc/ada/
* sem_ch3.adb
(Build_Derived_Record_Type): Temporarily set the state of the
Derived_Type to "self-hidden" while processing constraints
and discriminants of a record extension.
Eric Botcazou [Wed, 29 Mar 2023 10:52:57 +0000 (12:52 +0200)]
ada: Use truncation for dynamic conversions from floating point to fixed point
This changes the implementation of dynamic conversions from floating-point
to ordinary fixed-point types, from rounding (to the nearest number) to
truncation (toward zero), so as to make them consistent with both static
conversions between these types and also the value of the Machine_Rounds
attribute, which is False for all fixed-point types with GNAT.
The rounding is still available under the debug switch -gnatd.N for the
sake of backward compatibility with the previous implementation.
gcc/ada/
* debug.adb (d.N): Document new usage.
* exp_ch4.adb (Expand_N_Type_Conversion): Copy the Float_Truncate
flag when rewriting a floating-point to fixed-point conversion as
a floating-point to integer conversion.
* exp_fixd.adb: Add with and use clauses for Debug.
(Expand_Convert_Fixed_To_Fixed): Generate a truncation in all cases
except if the result is explicitly rounded.
(Expand_Convert_Integer_To_Fixed): Likewise.
(Expand_Convert_Float_To_Fixed): Generate a truncation for all kind
of fixed-point types, except if the result is explicitly rounded, or
-gnatd.N is specified and the type is an ordinary fixed-point type.
* sinfo.ads (Float_Truncate): Document usage for floating-point to
fixed-point conversions.
Javier Miranda [Sun, 26 Mar 2023 11:45:50 +0000 (11:45 +0000)]
ada: Crash on function returning allocated object containing tasks
The frontend crashes when a function returns an object of a
limited type that may have task components, has discriminants,
and the object is created with an allocator.
gcc/ada/
* exp_ch4.adb
(Expand_N_Allocator): If an allocator with constraints is called
in the return statement of a function returning a general access
type, then propagate to the itype the master of the general
access type (since it is the master associated with the
returned object).
Yannick Moy [Wed, 22 Mar 2023 09:17:54 +0000 (10:17 +0100)]
ada: Minor doc clarification
Pattern Matching extension does not apply yet to case expressions.
This is worth stating clearly, as this is a natural use of pattern
matching to program in more functional style.
gcc/ada/
* doc/gnat_rm/gnat_language_extensions.rst: Be more explicit on
pattern matching limitation.
* gnat_rm.texi: Regenerate.
* gnat_ugn.texi: Regenerate.
Yannick Moy [Thu, 23 Mar 2023 14:45:09 +0000 (15:45 +0100)]
ada: Complete contracts of SPARK units
SPARK units in the standard library (both Ada and GNAT ones) should have
subprograms correctly annotated with contracts, so that a SPARK subprogram
should always return (not fail or raise an exception) under the conditions
expressed in its precondition, unless it is a procedure annotated with
Might_Not_Return.
gcc/ada/
* libgnat/a-calend.ads: Mark with SPARK_Mode=>Off the functions which may
raise Time_Error.
* libgnat/a-ngelfu.ads: Mark with SPARK_Mode=>Off the functions which may
lead to an overflow (which is not the case of Tan with one parameter for
example, or Arctanh or Arcoth, despite their mathematical range covering
the reals).
* libgnat/a-textio.ads: Remove Always_Return annotation from functions, as
this is now compulsory for functions to always return in SPARK.
* libgnat/i-cstrin.ads: Add Might_Not_Return annotation to Update procedure
which may not return.
Bob Duff [Mon, 27 Mar 2023 22:07:17 +0000 (18:07 -0400)]
ada: Fix crash on 'Img as generic actual function
'Image is allowed as an actual for a generic formal function.
This patch fixes a crash when 'Img is used instead of 'Image
in that context.
Misc cleanups.
gcc/ada/
* exp_put_image.adb (Build_Image_Call): Treat 'Img the same as
'Image.
* exp_imgv.adb (Expand_Image_Attribute): If Discard_Names, expand
to 'Image instead of 'Img.
* snames.ads-tmpl, par-ch4.adb, sem_attr.adb, sem_attr.ads:
Cleanups: Rename Attribute_Class_Array to be Attribute_Set. Remove
unnecessary qualifications. DRY: Don't repeat "True".
Piotr Trojanek [Wed, 29 Mar 2023 07:36:39 +0000 (09:36 +0200)]
ada: Remove redundant guard against empty lists
There is no need to guard against routine Contains being called on
No_Elist, because it will return False. Code cleanup related to handling
of primitive operations in GNATprove; semantics is unaffected.
Eric Botcazou [Sun, 26 Mar 2023 22:55:08 +0000 (00:55 +0200)]
ada: Fix double free on finalization of Vector in array aggregate
The handling of finalization is delicate during the expansion of aggregates
since the generated assignments must not cause the finalization of the RHS.
That's why the No_Ctrl_Actions flag is set on them and the adjustments are
generated manually.
This was not done in the case of an array of array with controlled component
when its subaggregates are not expanded in place but instead are replaced by
temporaries, leading to double free or memory corruption.
gcc/ada/
* exp_aggr.adb (Initialize_Array_Component): Remove obsolete code.
(Expand_Array_Aggregate): In the case where a temporary is created
and the parent is an assignment statement with No_Ctrl_Actions set,
set Is_Ignored_Transient on the temporary.
Eric Botcazou [Sat, 25 Mar 2023 20:42:11 +0000 (21:42 +0100)]
ada: Fix internal error on Big_Integer conversion ghost instance
The problem is that the ghost mode of the instance is used to analyze the
parent of the generic body, whose own ghost mode has nothing to do with it.
gcc/ada/
* sem_ch12.adb (Instantiate_Package_Body): Set the ghost mode to
that of the instance only after loading the generic's parent.
(Instantiate_Subprogram_Body): Likewise.
Piotr Trojanek [Thu, 23 Mar 2023 20:00:54 +0000 (21:00 +0100)]
ada: Cleanup expansion of membership operators into attribute Valid
Code cleanup; semantics is unaffected.
gcc/ada/
* exp_ch4.adb (Is_OK_Object_Reference): Replace loop with a call to
Unqual_Conv; consequently, change object from variable to constant;
replace an IF statement with an AND THEN expression.
Piotr Trojanek [Thu, 23 Mar 2023 19:15:19 +0000 (20:15 +0100)]
ada: Remove leftover code for counting protected entries
We used to count protected entries by iterating over component
declarations, but then switched to iterating over entities and
left some code that is no longer needed. Cleanup; semantics is
unaffected (maybe except fixing an assertion failure in developer
builds when there is pragma among entry family declarations).
gcc/ada/
* exp_ch9.adb
(Build_Entry_Count_Expression): Remove loop over component declaration;
consequently remove a parameter that is no longer used; adapt callers.
(Make_Task_Create_Call): Refine type of a local variable.
Eric Botcazou [Thu, 23 Mar 2023 13:35:57 +0000 (14:35 +0100)]
ada: Reorder components in Ada.Containers.Restricted_Doubly_Linked_Lists
An instantiation of the package compiled with -gnatw.q yields:
warning: in instantiation at a-crdlli.ads:317 [-gnatw.q]
warning: record layout may cause performance issues [-gnatw.q]
warning: in instantiation at a-crdlli.ads:317 [-gnatw.q]
warning:
component "Nodes" whose length depends on a discriminant [-gnatw.q]
warning: in instantiation at a-crdlli.ads:317 [-gnatw.q]
warning: comes too early and was moved down [-gnatw.q]
gcc/ada/
* libgnat/a-crdlli.ads (List): Move Nodes component to the end.
Eric Botcazou [Sun, 5 Mar 2023 17:30:34 +0000 (18:30 +0100)]
ada: Reject thin 'Unrestricted_Access value to aliased constrained array
This rejects the Unrestricted_Access attribute applied to an aliased array
with a constrained nominal subtype when its type is resolved to be a thin
pointer. The reason is that supporting this case would require the aliased
array to contain its bounds, and this is the case only for aliased arrays
whose nominal subtype is unconstrained.
gcc/ada/
* sem_attr.adb (Is_Thin_Pointer_To_Unc_Array): New predicate.
(Resolve_Attribute): Apply the static matching legality rule to an
Unrestricted_Access attribute applied to an aliased prefix if the
type is a thin pointer. Call Is_Thin_Pointer_To_Unc_Array for the
aliasing legality rule as well.
Piotr Trojanek [Tue, 5 Oct 2021 13:29:44 +0000 (15:29 +0200)]
ada: Fix handling of Global contracts inside generic subprograms
Routine Get_Argument works differently for generic units (as explained
in its comment), but it failed to reliably detect such units when their
kind is temporarily made non-generic (for resolving recursive calls, as
explained in the comment at the end of Is_Generic_Declaration_Or_Body).
With this patch the frontend will look at the decorated expression of
the Global contract attached to the Global aspect; previously it was
looking at the undecorated expression attached to the corresponding
pragma.
gcc/ada/
* sem_prag.adb (Get_Argument): Improve detection of generic units.
Piotr Trojanek [Fri, 17 Mar 2023 13:10:03 +0000 (14:10 +0100)]
ada: Cleanups in handling of aggregates
Assorted cleanups related to recent fixes of aggregate handling for
GNATprove; semantics is unaffected.
gcc/ada/
* sem_aggr.adb
(Resolve_Record_Aggregate): Remove useless assignment.
* sem_aux.adb
(Has_Variant_Part): Remove useless guard; this routine is only called
on type entities (and now will crash in other cases).
* sem_ch3.adb
(Create_Constrained_Components): Only assign Assoc_List when necessary;
tune whitespace.
(Is_Variant_Record): Refactor repeated calls to Parent.
* sem_util.adb
(Gather_Components): Assert that discriminant association has just one
choice in component_association; refactor repeated calls to Next.
* sem_util.ads
(Gather_Components): Tune whitespace in comment.
Piotr Trojanek [Tue, 21 Mar 2023 08:46:57 +0000 (09:46 +0100)]
ada: Fix iteration over component items with pragmas
Component items in a record declaration might include pragmas, which
must be ignored when detecting components with default expressions.
More a code cleanup than a bugfix, as it only affects artificial corner
cases. Found while fixing missing legality checks for variant component
declarations.
gcc/ada/
* sem_ch3.adb (Check_CPP_Type_Has_No_Defaults): Iterate with
First_Non_Pragma and Next_Non_Pragma.
* exp_dist.adb (Append_Record_Traversal): Likewise.
Eric Botcazou [Sat, 18 Mar 2023 23:24:54 +0000 (00:24 +0100)]
ada: Remove Is_Descendant_Of_Address flag from Standard_Address
It breaks the Allow_Integer_Address special mode.
Add new standard_address parameters to gigi and alphabetize others, this is
necessary when addresses are not treated like integers.
gcc/ada/
* back_end.adb (Call_Back_End): Add gigi_standard_address to the
signature of the gigi procedure and alphabetize other parameters.
Pass Standard_Address as actual parameter for it.
* cstand.adb (Create_Standard): Do not set Is_Descendant_Of_Address
on Standard_Address.
* gcc-interface/gigi.h (gigi): Add a standard_address parameter and
alphabetize others.
* gcc-interface/trans.cc (gigi): Likewise. Record a builtin address
type and save it as the type for Standard.Address.
Piotr Trojanek [Thu, 16 Mar 2023 09:39:37 +0000 (10:39 +0100)]
ada: Use context variables in expansion of aggregates
Code cleanup; semantics is unaffected.
gcc/ada/
* exp_aggr.adb
(Build_Constrained_Type): Remove local constants that were shadowing
equivalent global constants; replace a wrapper that calls
Make_Integer_Literal with a numeric literal; remove explicit
Aliased_Present parameter which is equivalent to the default value.
(Check_Bounds): Remove unused initial value.
(Expand_Array_Aggregate): Use aggregate type from the context.
Eric Botcazou [Fri, 3 Mar 2023 19:34:09 +0000 (20:34 +0100)]
ada: Fix missing finalization in library-level instance body
This extends the delaying mechanism present in the cases where the instance
is not at library level, so as to wait until after the instantiation of the
body is performed, before generating the finalizer of the compilation unit.
gcc/ada/
* einfo.ads (Delay_Cleanups): Document new usage.
* exp_ch7.ads (Build_Finalizer): New declaration.
* exp_ch7.adb (Build_Finalizer.Process_Declarations): Do not treat
library-level package instantiations specially.
(Build_Finalizer): Return early for package bodies and specs that
are not compilation units instead of using a more convoluted test.
(Expand_N_Package_Body): Do not build a finalizer if Delay_Cleanups
is set on the defining entity.
(Expand_N_Package_Declaration): Likewise.
* inline.ads (Pending_Body_Info): Reorder and add Fin_Scop.
(Add_Pending_Instantiation): Add Fin_Scop parameter.
* inline.adb (Add_Pending_Instantiation): Likewise and copy it into
the Pending_Body_Info appended to Pending_Instantiations.
(Add_Scope_To_Clean): Change parameter name to Scop and remove now
irrelevant processing.
(Cleanup_Scopes): Deal with scopes that are package specs or bodies.
(Instantiate_Body): For package instantiations, deal specially with
scopes that are package bodies and with scopes that are dynamic.
Pass the resulting scope to Add_Scope_To_Clean directly.
* sem_ch12.adb (Analyze_Package_Instantiation): In the case where a
body is needed, compute the enclosing finalization scope and pass it
in the call to Add_Pending_Instantiation.
(Inline_Instance_Body): Adjust aggregate passed in the calls to
Instantiate_Package_Body.
(Load_Parent_Of_Generic): Likewise.
Eric Botcazou [Wed, 15 Mar 2023 12:56:33 +0000 (13:56 +0100)]
ada: Fix another couple of unchecked conversions to Ada.Tags.Tag
They are problematic on platforms where the provenance of pointers must be
tracked throughout their lifetime.
gcc/ada/
* exp_sel.adb: Add clauses for Sem_Util, remove them for Opt, Sinfo
and Sinfo.Nodes.
(Build_K): Always use 'Tag of the object.
(Build_S_Assignment): Likewise.
Piotr Trojanek [Wed, 1 Feb 2023 20:47:32 +0000 (21:47 +0100)]
ada: Refine types for an accessibility-checking routine
Code cleanup related to work on expression functions for GNATprove
(which require accessibility checks even when they are not expanded
and thus have no explicit return statements).
gcc/ada/
* accessibility.adb
(Is_Formal_Of_Current_Function): This routine expects an entity
reference and not the entity itself, so its parameter is a Node_Id
and not an Entity_Id.
Eric Botcazou [Mon, 13 Mar 2023 11:03:47 +0000 (12:03 +0100)]
ada: Enhance Is_Null_Range and Not_Null_Range predicates
Both predicates bail out if the bounds of the range are not known at compile
time, whereas Compile_Time_Compare can deal with them in specific cases.
gcc/ada/
* sem_eval.ads (Is_Null_Range): Remove requirements of compile-time
known bounds and add WARNING line.
(Not_Null_Range): Remove requirements of compile-time known bounds.
* sem_eval.adb (Is_Null_Range): Fall back to Compile_Time_Compare.
(Not_Null_Range): Likewise.
* fe.h (Is_Null_Range): New predicate.
liuhongt [Tue, 16 May 2023 02:36:16 +0000 (10:36 +0800)]
Only use NO_REGS in cost calculation when !hard_regno_mode_ok for GENERAL_REGS and mode.
r14-172-g0368d169492017 replaces GENERAL_REGS with NO_REGS in cost
calculation when the preferred register class are not known yet.
It regressed powerpc PR109610 and PR109858, it looks too aggressive to use
NO_REGS when mode can be allocated with GENERAL_REGS.
The patch takes a step back, still use GENERAL_REGS when
hard_regno_mode_ok for mode and GENERAL_REGS, otherwise uses NO_REGS.
gcc/ChangeLog:
PR target/109610
PR target/109858
* ira-costs.cc (scan_one_insn): Only use NO_REGS in cost
calculation when !hard_regno_mode_ok for GENERAL_REGS and
mode, otherwise still use GENERAL_REGS.
Jonathan Wakely [Thu, 25 May 2023 20:17:19 +0000 (21:17 +0100)]
libstdc++: Add relational operators to __gnu_test::PointerBase
The Cpp17Allocator requirements say that an allocator's pointer and
const_pointer types must meet the Cpp17RandomAccessIterator
requirements. That means our PointerBase helper for defining fancy
pointer types should support the full set of relational operators.
Uros Bizjak [Thu, 25 May 2023 17:40:26 +0000 (19:40 +0200)]
i386: Use 2x-wider modes when emulating QImode vector instructions
Rewrite ix86_expand_vecop_qihi2 to expand fo 2x-wider (e.g. V16QI -> V16HImode)
instructions when available. Currently, the compiler generates following
assembly for V16QImode multiplication (-mavx2):
Patched compiler generates more optimized code involving multiplication
in 2x-wider mode in cases where missing truncate instruction has to be
emulated with a permutation (-mavx2):
The patch also adjusts cost calculation of V*QImode emulations to account
for generation of 2x-wider mode instructions.
gcc/ChangeLog:
* config/i386/i386-expand.cc (ix86_expand_vecop_qihi2):
Rewrite to expand to 2x-wider (e.g. V16QI -> V16HImode)
instructions when available. Emulate truncation via
ix86_expand_vec_perm_const_1 when native truncate insn
is not available.
(ix86_expand_vecop_qihi_partial) <case MULT>: Use pmovzx
when available. Trivially rename some variables.
(ix86_expand_vecop_qihi): Unconditionally call ix86_expand_vecop_qihi2.
* config/i386/i386.cc (ix86_multiplication_cost): Rewrite cost
calculation of V*QImode emulations to account for generation of
2x-wider mode instructions.
(ix86_shift_rotate_cost): Update cost calculation of V*QImode
emulations to account for generation of 2x-wider mode instructions.
Georg-Johann Lay [Tue, 23 May 2023 12:54:12 +0000 (14:54 +0200)]
target/104327: Allow more inlining between different optimization levels.
avr-common.cc introduces the following options that are set depending
on optimization level: -mgas-isr-prologues, -mmain-is-OS-task and
-fsplit-wide-types-early. The inliner thinks that different options
disallow cross-optimization inlining, so provide can_inline_p.
gcc/
PR target/104327
* config/avr/avr.cc (avr_can_inline_p): New static function.
(TARGET_CAN_INLINE_P): Define to that function.
Georg-Johann Lay [Thu, 25 May 2023 17:02:34 +0000 (19:02 +0200)]
target/82931: Make a pattern more generic to match more bit-transfers.
There is already a pattern in avr.md that matches single-bit transfers
from one register to another one, but it only handled bit 0 of 8-bit
registers. This change makes that pattern more generic so it matches
more of similar single-bit transfers.
gcc/
PR target/82931
* config/avr/avr.md (*movbitqi.0): Rename to *movbit<mode>.0-6.
Handle any bit position and use mode QISI.
* config/avr/avr.cc (avr_rtx_costs_1) [IOR]: Return a cost
of 2 insns for bit-transfer of respective style.
gcc/testsuite/
PR target/82931
* gcc.target/avr/pr82931.c: New test.
Ju-Zhe Zhong [Thu, 25 May 2023 14:42:35 +0000 (22:42 +0800)]
VECT: Add decrement IV iteration loop control by variable amount support
This patch is supporting decrement IV by following the flow designed by
Richard:
(1) In vect_set_loop_condition_partial_vectors, for the first iteration of:
call vect_set_loop_controls_directly.
(2) vect_set_loop_controls_directly calculates "step" as in your patch.
If rgc has 1 control, this step is the SSA name created for that
control. Otherwise the step is a fresh SSA name, as in your patch.
(3) vect_set_loop_controls_directly stores this step somewhere for later
use, probably in LOOP_VINFO. Let's use "S" to refer to this stored
step.
(4) After the vect_set_loop_controls_directly call above, and outside
the "if" statement that now contains vect_set_loop_controls_directly,
check whether rgc->controls.length () > 1. If so, use
vect_adjust_loop_lens_control to set the controls based on S.
Then the only caller of vect_adjust_loop_lens_control is
vect_set_loop_condition_partial_vectors. And the starting
step for vect_adjust_loop_lens_control is always S.
This patch has well tested for single-rgroup and multiple-rgroup (SLP)
and passed all testcase in RISC-V port.
Signed-off-by: Ju-Zhe Zhong <juzhe.zhong@rivai.ai> Co-Authored-By: Richard Sandiford <richard.sandiford@arm.com>
gcc/ChangeLog:
* tree-vect-loop-manip.cc (vect_adjust_loop_lens_control): New
function.
(vect_set_loop_controls_directly): Add decrement IV support.
(vect_set_loop_condition_partial_vectors): Ditto.
* tree-vect-loop.cc (_loop_vec_info::_loop_vec_info): New
variable.
* tree-vectorizer.h (LOOP_VINFO_USING_DECREMENTING_IV_P): New
macro.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/autovec/partial/multiple_rgroup-3.c: New test.
* gcc.target/riscv/rvv/autovec/partial/multiple_rgroup-4.c: New test.
* gcc.target/riscv/rvv/autovec/partial/multiple_rgroup_run-3.c: New test.
* gcc.target/riscv/rvv/autovec/partial/multiple_rgroup_run-4.c: New test.
Kyrylo Tkachov [Thu, 25 May 2023 14:00:16 +0000 (15:00 +0100)]
aarch64: PR target/99195 Annotate complex FP patterns for vec-concat-zero
This patch annotates the complex add and mla patterns for vec-concat-zero.
Testing showed an interesting bug in our MD patterns where they were defined to match:
(plus:VHSDF (match_operand:VHSDF 1 "register_operand" "0")
(unspec:VHSDF [(match_operand:VHSDF 2 "register_operand" "w")
(match_operand:VHSDF 3 "register_operand" "w")
(match_operand:SI 4 "const_int_operand" "n")]
FCMLA))
but the canonicalisation rules for PLUS require the more "complex" operand to be first so
during combine when the new substituted patterns were attempted to be formed combine/recog would
try to match:
(plus:V2SF (unspec:V2SF [
(reg:V2SF 100)
(reg:V2SF 101)
(const_int 0 [0])
] UNSPEC_FCMLA270)
(reg:V2SF 99))
instead. This patch fixes the operands of the PLUS RTX in these patterns.
Similar patterns for the dot-product instructions already used the right order.
Bootstrapped and tested on aarch64-none-linux-gnu and aarch64_be-none-elf.
gcc/ChangeLog:
PR target/99195
* config/aarch64/aarch64-simd.md (aarch64_fcadd<rot><mode>): Rename to...
(aarch64_fcadd<rot><mode><vczle><vczbe>): ... This.
Fix canonicalization of PLUS operands.
(aarch64_fcmla<rot><mode>): Rename to...
(aarch64_fcmla<rot><mode><vczle><vczbe>): ... This.
Fix canonicalization of PLUS operands.
(aarch64_fcmla_lane<rot><mode>): Rename to...
(aarch64_fcmla_lane<rot><mode><vczle><vczbe>): ... This.
Fix canonicalization of PLUS operands.
(aarch64_fcmla_laneq<rot>v4hf): Rename to...
(aarch64_fcmla_laneq<rot>v4hf<vczle><vczbe>): ... This.
Fix canonicalization of PLUS operands.
(aarch64_fcmlaq_lane<rot><mode>): Fix canonicalization of PLUS operands.
gcc/testsuite/ChangeLog:
PR target/99195
* gcc.target/aarch64/simd/pr99195_9.c: New test.
Chris Sidebottom [Thu, 25 May 2023 13:57:34 +0000 (14:57 +0100)]
arm: Implement ACLE Data Intrinsics
This patch implements a number of scalar data processing intrinsics from ACLE
that were requested by some users. Some of these have fast single-instruction
sequences for Armv6 and later, but even for earlier versions they can still emit
an inline sequence or a call to libgcc (and ACLE recommends them being unconditionally
available).
Chris Sidebottom wrote most of the patch, I just cleaned it up, wired up some builtins
and adjusted the tests.
Bootstrapped and tested on arm-none-linux-gnueabihf.
Co-authored-by: Chris Sidebottom <chris.sidebottom@arm.com>
gcc/ChangeLog:
* gcc.target/arm/acle/data-intrinsics-armv6.c: New test.
* gcc.target/arm/acle/data-intrinsics-assembly.c: New test.
* gcc.target/arm/acle/data-intrinsics-rbit.c: New test.
* gcc.target/arm/acle/data-intrinsics.c: New test.
where M1 and M2 are of equal mode size. That is problematic for the splitter
vfp.md:no_literal_pool_df_immediate in the arm backend, which tries to pun an
lvalue DFmode pseudo into DImode and assign a constant to it with
emit_move_insn, as the new transformation simply undoes this, and we end up
splitting indefinitely.
This patch changes things around in the arm backend so that we use a
DImode temporary (instead of DFmode) and first load the DImode constant
into the pseudo, and then pun the pseudo into DFmode as an rvalue in a
reg -> reg move. I believe this should be semantically equivalent but
avoids the pathalogical behaviour seen in the PR.
gcc/ChangeLog:
PR target/109800
* config/arm/arm.md (movdf): Generate temporary pseudo in DImode
instead of DFmode.
* config/arm/vfp.md (no_literal_pool_df_immediate): Rather than punning an
lvalue DFmode pseudo into DImode, use a DImode pseudo and pun it into
DFmode as an rvalue.
gcc/testsuite/ChangeLog:
PR target/109800
* gcc.target/arm/pure-code/pr109800.c: New test.
Richard Biener [Thu, 25 May 2023 10:55:11 +0000 (12:55 +0200)]
target/109955 - handle pattern generated COND_EXPR without vcond
The following properly handles pattern matching generated COND_EXPRs
which can still have embedded compares in vectorizable_condition
which will always code generate the masked vector variant. We
were requiring vcond with embedded comparisons instead of also
allowing (as code generated) split compare and VEC_COND_EXPR.
This fixes some of the fallout when removing vcond{,u,eq} expanders
from the x86 backend.
PR target/109955
* tree-vect-stmts.cc (vectorizable_condition): For
embedded comparisons also handle the case when the target
only provides vec_cmp and vcond_mask.
arc: Make TLS Local Dynamic work like Global Dynamic model
Current ARC's TLS Local Dynamic model is using two anchors to access
data, namely `.tdata` and `.tbss`. This implementation is unnecessary
complicated. However, the TLS Local Dynamic model has better results
using Global Dynamic model and anchors.
gcc/ChangeLog;
* config/arc/arc.cc (arc_call_tls_get_addr): Simplify access using
TLS Local Dynamic.
Kyrylo Tkachov [Thu, 25 May 2023 08:48:33 +0000 (09:48 +0100)]
aarch64: Implement vector FP absolute compare intrinsics with builtins
While optimising some vector math library code with intrinsics we stumbled upon the issue in the testcase.
The compiler should be generating a FACGT instruction but instead we generate:
foo(__Float32x4_t, __Float32x4_t, __Float32x4_t):
fabs v0.4s, v0.4s
adrp x0, .LC0
ldr q31, [x0, #:lo12:.LC0]
fcmgt v0.4s, v0.4s, v31.4s
ret
This is because the vcagtq_f32 intrinsic is open-coded in arm_neon.h as
return vabsq_f32 (__a) > vabsq_f32 (__b)
thus relying on the optimisers to merge it back together. But since one of the arms of the comparison
is a vector constant the combine pass optimises the abs into it and tries matching:
(set (reg:V4SI 101)
(neg:V4SI (gt:V4SI (reg:V4SF 100)
(const_vector:V4SF [
(const_double:SF 1.0e+2 [0x0.c8p+7]) repeated x4
]))))
and
(set (reg:V4SI 101)
(neg:V4SI (gt:V4SI (abs:V4SF (reg:V4SF 104))
(reg:V4SF 103))))
instead of what we want:
(insn 13 9 14 2 (set (reg/i:V4SI 32 v0)
(neg:V4SI (gt:V4SI (abs:V4SF (reg:V4SF 98))
(abs:V4SF (reg:V4SF 96)))))
I don't really see a good way around that with our current implementation of these intrinsics.
Therefore this patch reimplements these intrinsics with aarch64 builtins that generate the RTL for these
instructions directly. Apparently we already had them defined in aarch64-simd-builtins.def and have been
using them for the fp16 case already.
I realise that this approach is against the general principle of expressing intrinsics in the higher-level constructs,
so I'm willing to listen to counter-arguments.
That said, the FACGT/FACGE instructions are as fast as the non-ABS comparison instructions on all microarchitectures that I know of
so it should always be a win to have them in the merged form rather than split the fabs step separately or try to hoist it.
And the testcase does come from real library code that we're trying to optimise.
With this patch for the testcase we generate:
foo:
adrp x0, .LC0
ldr q31, [x0, #:lo12:.LC0]
facgt v0.4s, v0.4s, v31.4s
ret
Javier Miranda [Tue, 28 Feb 2023 18:20:38 +0000 (18:20 +0000)]
ada: Missing warning on null-excluding array aggregate component
The compiler does not report warnings on the initialization
of arrays of null-excluding access type components by means
of iterated component association, when the expression
initializing each component is either a conditional
expression or a case expression that may initialize
some component with a null value.
gcc/ada/
* sem_aggr.adb
(Warn_On_Null_Component_Association): New subprogram.
(Empty_Range): Adding missing support for iterated component
association node.
(Resolve_Array_Aggregate): Report warning on iterated component
association that may initialize some component of an array of
null-excluding access type components with a null value.
* exp_ch4.adb
(Expand_N_Expression_With_Actions): Add missing type check since
the subtype of the EWA node and the subtype of the expression
may differ.