Age | Commit message (Collapse) | Author | Files | Lines |
|
This prevents Gigi from creating null GCC thunks, i.e. thunks that have all
their internal parameters set to zero, replacing them with aliases. They
can arise in degenerate cases and null thunks would trip on an assertion in
former_thunk_p when they are later optimized.
gcc/ada/
PR ada/109817
* gcc-interface/trans.cc (maybe_make_gnu_thunk): Create an alias
instead of a null thunk.
|
|
Fixes typo in comments and 2 instances of bad indentation.
gcc/ada/
* gcc-interface/decl.cc (gnat_to_gnu_entity): Typo fix.
(gnat_to_gnu_component_type): Indent fix.
* gcc-interface/gigi.h (build_call_alloc_dealloc): Typo fix.
* gcc-interface/utils.cc (make_dummy_type): Typo fix.
* gcc-interface/utils2.cc (gnat_protect_expr): Indent fix.
|
|
Many aspects are (correctly) marked as GNAT-specific but nevertheless not
listed in the Implementation_Defined_Aspect array, so this aligns the two
sides and also removes Default_Initial_Condition and Object_Size from the
list, since they are defined in Ada 2022.
This also moves No_Controlled_Parts and No_Task_Parts to the subclass of
boolean aspects, and completes the list of nonoverridable aspects defined
in Ada 2022.
gcc/ada/
* aspects.ads (Aspect_Id): Alphabetize, remove the GNAT tag from
Default_Initial_Condition and Object_Size, move No_Controlled_Parts
and No_Task_Parts to boolean subclass.
(Nonoverridable_Aspect_Id): Add missing Ada 2022 aspects.
(Implementation_Defined_Aspect): Add all missing aspects, remove
Max_Entry_Queue_Length and Object_Size
(Aspect_Argument): Remove specific entries for No_Controlled_Parts
and No_Task_Parts, list boolean aspects last.
(Is_Representation_Aspect ): Move boolean aspects last.
(Aspect_Names): Alphabetize.
* sem_ch13.adb (Analyze_Aspect_Disable_Controlled): Adjust.
(Analyze_Aspect_Specifications): Move around processing for
No_Controlled_Parts and No_Task_Parts.
(Check_Aspect_At_Freeze_Point): Remove specific entries for
No_Controlled_Parts and No_Task_Parts
|
|
The Etype for an N_Selected_Component node usually should not match the Etype
of the referenced component if the component is subject to a
discriminant-dependent constraint. Instead Build_Actual_Subtype_Of_Component
should be called. Fix a case where this rule was not being followed (because
B_A_S_O_C is not called during preanalysis of a component selection), resulting
in a tree that confused CodePeer because the subtype was wrong.
gcc/ada/
* exp_attr.adb
(Expand_Loop_Entry_Attribute):
Ensure that Etype of the saved expression is set correctly.
|
|
These error codes were defined on older versions of VxWorks (5, 6, 7
SR0540) and now they are either not defined or they fallback to
ENOENT. To handle these cases without using complex tests against
vxworks versions, leverage on __has_include and provide a fallback to
ENOENT if these error codes are not defined.
gcc/ada/
* sysdep.c (S_dosFsLib_FILE_NOT_FOUND, S_nfsLib_NFSERR_NOENT):
New macros, falback to ENOENT when not already defined.
(__gnat_is_file_not_found_error): Use these new macros to remove
tests against VxWorks flavors.
|
|
gcc/ada/
* snames.ads-tmpl (Name_Present): Move to Repinfo section.
|
|
This patch implements mutably tagged types via the new Size'Class aspect.
gcc/ada/
* doc/gnat_rm/gnat_language_extensions.rst: Add documentation for
mutably tagged type feature.
* aspects.ads: Add registration for 'Size'Class.
* einfo.ads: Add documentation for new components
Class_Wide_Equivalent_Type and Is_Mutably_Tagged_Type.
* exp_aggr.adb (Gen_Assign): Assume associated mutably tagged type
when class-wide equivalent type is encountered.
(Contains_Mutably_Tagged_Type): New subprogram.
(Convert_To_Positional): Assume associated mutably tagged type
when class-wide equivalent type is encountered.
(Is_Static_Element): Assume associated mutably tagged type when
class-wide equivalent type is encountered.
(Expand_Array_Aggregate): Assume associated mutably tagged type
when class-wide equivalent type is encountered.
(Expand_Record_Aggregate): Force mutably tagged records to be
expanded into assignments.
* exp_ch3.adb (Build_Array_Init_Proc): Assume associated mutably
tagged type when class-wide equivalent type is encountered.
(Simple_Initialization_OK): Disallow simple initialization for
class-wide equivalent types.
(Build_Init_Statements): Assume associated mutably tagged type
when class-wide equivalent type is encountered.
(Expand_Freeze_Array_Type): Ignore building of record init procs
for mutably tagged types.
(Expand_N_Full_Type_Declaration): Replace mutably tagged type
declarations with their associated class-wide equivalent types.
(Default_Initialize_Object): Add special handling for mutably
tagged types.
* exp_ch4.adb (Expand_N_Allocator): Add initialization for mutably
tagged types.
(Expand_Record_Equality): Generate mutably tagged unchecked
conversions.
* exp_ch5.adb (Expand_N_Assignment_Statement): Generate a special
assignment case for class-wide equivalent types which does tag
assignments and ignores certain checks.
* exp_ch6.adb (Expand_Call_Helper): Propagate constrained extra
formal actuals for mutably tagged types.
* exp_ch7.adb (Make_Init_Call): Handle mutably tagged type
initialization.
* exp_util.adb (Make_CW_Equivalent_Type): Modify to handle mutably
tagged objects which contain no initialization expression.
(Make_Subtype_From_Expr): Modify call to Make_CW_Equivalent_Type.
* exp_util.ads (Make_CW_Equivalent_Type): Move declaration from
body to spec.
* freeze.adb (Size_Known): No longer return false automatically
when a class-wide type is encountered.
(Freeze_Entity): Ignore error messages about size not being known
for mutably tagged types.
* gen_il-fields.ads: Register new fields
Class_Wide_Equivalent_Type and Is_Mutably_Tagged_Type.
* gen_il-gen-gen_entities.adb: Register new fields
Class_Wide_Equivalent_Type and Is_Mutably_Tagged_Type for type
entities.
* mutably_tagged.adb, mutably_tagged.ads
(Corresponding_Mutably_Tagged_Type): New subprogram.
(Depends_On_Mutably_Tagged_Ext_Comp): New subprogram.
(Get_Corresponding_Mutably_Tagged_Type_If_Present): New
subprogram.
(Get_Corresponding_Tagged_Type_If_Present): New subprogram.
(Is_Mutably_Tagged_Conversion): New subprogram.
(Is_Mutably_Tagged_CW_Equivalent_Type): New subprogram.
(Make_Mutably_Tagged_Conversion): New subprogram.
(Make_CW_Size_Compile_Check): New subprogram.
(Make_Mutably_Tagged_CW_Check): New subprogram.
* sem_aggr.adb (Resolve_Array_Aggregate): Skip tag checks for
class-wide equivalent types.
(Resolve_Aggr_Expr): Assume associated mutably tagged type when
class-wide equivalent type is encountered.
* sem_attr.adb (Analyze_Attribute): Allow 'Tag on mutably tagged
types.
(Resolve_Attribute): Detect errors for dependence of mutably
tagged extension type component.
* sem_ch12.adb (Instantiate_Object): Detect errors for dependence
of mutably tagged extension type component.
* sem_ch13.adb (Analyze_One_Aspect): Propagate 'Size'Class to
class-wide type.
(Analyze_Attribute_Definition_Clause): Add handling of 'Size'Class
by generating class-wide equivalent types and checking for illegal
uses.
* sem_ch2.adb (Analyze_Identifier): Generate unchecked conversion
for class-wide equivalent types.
* sem_ch3.adb (Analyze_Component_Declaration): Avoid unconstrained
errors on mutably tagged types.
(Analyze_Object_Declaration): Rewrite declarations of mutably
tagged types to use class-wide equivalent types.
(Array_Type_Declaration): Modify arrays of mutably tagged types to
use their corresponding class-wide equivalent types.
(Derived_Type_Declaration): Add various checks for mutably tagged
derived types.
* sem_ch4.adb (Analyze_Allocator): Replace reference to mutably
tagged type with cooresponding tagged type.
(Process_Indexed_Component): Generate unchecked conversion for
class-wide equivalent type.
(Analyze_One_Call): Generate unchecked conversion for class-wide
equivalent types.
(Analyze_Selected_Component): Assume reference to class-wide
equivalent type is associated mutably tagged type.
(Analyze_Type_Conversion): Generate unchecked conversion for
class-wide equivalent type.
* sem_ch5.adb (Analyze_Assignment): Assume associated mutably
tagged type when class-wide equivalent type is encountered.
(Analyze_Iterator_Specification): Detect errors for dependence of
mutably tagged extension type component.
* sem_ch6.adb (Create_Extra_Formals): Add code to generate extra
formal for mutably tagged types to signal if they are constrained.
* sem_ch8.adb (Analyze_Object_Renaming): Detect error on renaming
of mutably tagged extension type component.
(Analyze_Renaming_Primitive_Operation): Detect error on renaming
of mutably tagged extension type component.
* sem_res.adb (Resolve_Actuals): Allow class-wide arguments on
class-wide equivalent types.
(Valid_Conversion): Assume associated mutably tagged type when
class-wide equivalent type is encountered.
* sem_util.adb (Is_Fully_Initialized_Type): Flag mutably tagged
types as fully initialized.
(Needs_Simple_Initalization): Flag class-wide equivalent types as
needing initialization.
* gnat_rm.texi: Regenerate.
* gcc-interface/Make-lang.in: Add entry for mutably_tagged.o.
|
|
This patch fixes an issue in the compiler whereby calculating a static
accessibility level on a private type with an access discriminant resulted
in a compile time crash when No_Dynamic_Accessibility_Checks is enabled.
gcc/ada/
* accessibility.adb:
(Accessibility_Level): Replace call Get_Full_View with call to
Full_View since Get_Full_View only works with incomplete types.
|
|
The main one is to give the error for Aggregate applied to array types from
Analyze_Aspects_At_Freeze_Point instead of Check_Aspect_At_Freeze_Point, as
for the other aspects. The message is also changed to be more direct.
gcc/ada/
* aspects.ads (Operational_Aspect): Alphabetize.
* sem_ch13.ads (Analyze_Aspects_At_Freeze_Point): Fix description.
* sem_ch13.adb (Analyze_Aspects_At_Freeze_Point) <Aggregate>: Give
the error for array types here instead of...
(Analyze_Aspect_Specifications) <Aggregate>: Adjust comment.
(Check_Aspect_At_Freeze_Point) <Aggregate>: ...here.
|
|
When a multidimensional array is initialized with an array
aggregate, and inner dimensions of the array are initialized
with array subaggregates using sliding, the code generated
by the compiler does not initialize the inner dimensions
of the array.
gcc/ada/
* exp_aggr.adb (Must_Slide): Add missing support for
multidimensional arrays.
|
|
The first cleanup is to expose a consistent interface from Sem_Ch13 for the
analysis of aspects at various points of the program. The second cleanup is
to fix the awkward implementation of the analysis of the specification for
the aspects Stable_Properties, Designated_Storage_Model, Storage_Model_Type
and Aggregate, which are always delayed, and the incorrect placement of that
of the aspect Local_Restrictions, which is never delayed.
gcc/ada/
* freeze.adb (Freeze_All): Call Check_Aspects_At_End_Of_Declarations
to perform the visibility check for aspects.
* sem_ch13.ads (Check_Aspects_At_End_Of_Declarations): Declare.
(Check_Aspect_At_Freeze_Point): Move to...
(Check_Aspect_At_End_Of_Declarations): Move to...
* sem_ch13.adb (Check_Aspect_At_Freeze_Point): ...here.
(Check_Aspect_At_End_Of_Declarations): ...here.
(Analyze_Aspect_Specifications): Remove peculiar processing for
Stable_Properties, Designated_Storage_Model, Storage_Model_Type
and Aggregate. Move that of Local_Restrictions around. Reset
Aitem at the beginning of the loop for each aspect.
(Check_Aspects_At_End_Of_Declarations): New procedure.
|
|
This patch modifies the experimental 'Super attribute to allow an access-valued
prefix to be equivalent to Prefix.all'Super.
gcc/ada/
* sem_attr.adb:
(Analyze_Attribute): Add check for dereference.
|
|
gcc/ada/
* snames.ads-tmpl (Name_Storage_Model): Delete.
|
|
The following hopefully addresses an observed bootstrap issue on aarch64
where maybe-uninit diagnostics occur. It also fixes bogus napkin math
from myself when I was confusing rounded up size of a single access
with rounded up size of the group accessed in a single scalar iteration.
So the following puts in a correctness check, leaving a set of peeling
for gaps as insufficient. This could be rectified by splitting the
last load into multiple ones but I'm leaving this for a followup, better
quickly fix the reported wrong-code.
* tree-vect-stmts.cc (get_group_load_store_type): Do not
re-use poly-int remain but re-compute with non-poly values.
Verify the shortened load is good enough to be covered with
a single scalar gap iteration before accepting it.
* gcc.dg/vect/pr115385.c: Enable AVX2 if available.
|
|
r15-1100-gec985bc97a0157 improves handling of ternlog instructions,
now GCC can recognize lots of pternlog_operand with different
variants.
The patch adjust rtx_costs for that, so pass_combine can
reasonably generate more optimal vpternlog instructions.
.i.e
for avx512f-vpternlog-3.c, with the patch, 2 vpternlog are combined into one.
1532,1533c1526
< vpternlogd $168, %zmm1, %zmm0, %zmm2
< vpternlogd $0x55, %zmm2, %zmm2, %zmm2
> vpternlogd $87, %zmm1, %zmm0, %zmm2
1732,1733c1725,1726
< vpand %xmm0, %xmm1, %xmm0
< vpternlogd $0x55, %zmm0, %zmm0, %zmm0
> vpternlogd $63, %zmm1, %zmm0, %zmm1
> vmovdqa %xmm1, %xmm0
1804,1805c1797
< vpternlogd $188, %zmm2, %zmm0, %zmm1
< vpternlogd $0x55, %zmm1, %zmm1, %zmm1
> vpternlogd $37, %zmm0, %zmm2, %zmm1
gcc/ChangeLog:
* config/i386/i386.cc (ix86_rtx_costs): Adjust rtx_cost for
pternlog_operand under AVX512, also adjust VEC_DUPLICATE
according since vec_dup:mem can't be that cheap.
gcc/testsuite/ChangeLog:
* gcc.target/i386/avx2-pr98461.c: Scan either notl or
vpternlog.
* gcc.target/i386/avx512f-pr96891-3.c: Also scan for inversed
condition.
* gcc.target/i386/avx512f-vpternlogd-3.c: Adjust vpternlog
number to 673.
* gcc.target/i386/avx512f-vpternlogd-4.c: Ditto.
* gcc.target/i386/avx512f-vpternlogd-5.c: Ditto.
* gcc.target/i386/sse2-v1ti-vne.c: Add -mno-avx512f.
|
|
The tune is added by PR79390 for SciMark2 on Broadwell.
For latest GCC, with and without the -mtune-ctrl=^one_if_conv_insn.
GCC will generate the same binary for SciMark2. And for SPEC2017,
there's no big impact for SKX/CLX/ICX, and small improvements on SPR
and later.
gcc/ChangeLog:
* config/i386/x86-tune.def (X86_TUNE_ONE_IF_CONV_INSN): Remove
latest Intel processors.
Co-authored by: Lingling Kong <lingling.kong@intel.com>
|
|
This patch makes more use of m32bcst and m64bcst addressing modes in
ix86_expand_ternlog. Previously, the i386 backend would only consider
using a m32bcst if the inner mode of the vector was 32-bits, or using
m64bcst if the inner mode was 64-bits. For ternlog (and other logic
operations) this is a strange restriction, as how the same constant
is materialized is dependent upon the mode it is used/operated on.
Hence, the V16QI constant {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} wouldn't
use m??bcst, but (V4SI){0x02020202,0x02020202,0x02020202,0x02020202}
which has the same bit pattern would. This can optimized by (re)checking
whether a CONST_VECTOR can be broadcast from memory after casting it
to VxSI (or for m64bst to VxDI) where x has the appropriate vector size.
Taking the test case from pr115407:
__attribute__((__vector_size__(64))) char v;
void foo() {
v = v | v << 7;
}
Compiled with -O2 -mcmodel=large -mavx512bw
GCC 14 generates a 64-byte (512-bit) load from the constant pool:
foo: movabsq $v, %rax // 10
movabsq $.LC0, %rdx // 10
vpsllw $7, (%rax), %zmm1 // 7
vmovdqa64 (%rax), %zmm0 // 6
vpternlogd $248, (%rdx), %zmm1, %zmm0 // 7
vmovdqa64 %zmm0, (%rax) // 6
vzeroupper // 3
ret // 1
.LC0: .byte -12 // 64 = 114 bytes
.byte -128
;; repeated another 62 times
mainline currently generates two instructions, using interunit broadcast:
foo: movabsq $v, %rdx // 10
movl $-2139062144, %eax // 5
vmovdqa64 (%rdx), %zmm2 // 6
vpbroadcastd %eax, %zmm0 // 6
vpsllw $7, %zmm2, %zmm1 // 7
vpternlogd $236, %zmm0, %zmm2, %zmm1 // 7
vmovdqa64 %zmm1, (%rdx) // 6
vzeroupper // 3
ret // 1 = 51 bytes
With this patch, we now generate a broadcast addressing mode:
foo: movabsq $v, %rax // 10
movabsq $.LC1, %rdx // 10
vmovdqa64 (%rax), %zmm1 // 6
vpsllw $7, %zmm1, %zmm0 // 7
vpternlogd $236, (%rdx){1to16}, %zmm1, %zmm0 // 7
vmovdqa64 %zmm0, (%rax) // 6
vzeroupper // 3
ret // 1 = 50 total
Without -mcmodel=large, the benefit is two instructions:
foo: vmovdqa64 v(%rip), %zmm1 // 10
vpsllw $7, %zmm1, %zmm0 // 7
vpternlogd $236, .LC2(%rip){1to16}, %zmm1, %zmm0 // 11
vmovdqa64 %zmm0, v(%rip) // 10
vzeroupper // 3
ret // 1 = 42 total
2024-06-14 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
* config/i386/i386-expand.cc (ix86_expand_ternlog): Try performing
logic operation in a different vector mode if that enables use of
a 32-bit or 64-bit broadcast addressing mode.
gcc/testsuite/ChangeLog
* gcc.target/i386/pr115407.c: New test case.
|
|
expand_widen_pattern_expr [PR113212]
While working on an expand patch back in January I noticed that
the first argument (of sepops type) of expand_expr_real_2 could be
constified as it was not to be touched by the function (nor should it be).
There is code in internal-fn.cc that depends on expand_expr_real_2 not touching
the ops argument so constification makes this more obvious.
Bootstrapped and tested on x86_64-linux-gnu with no regressions.
gcc/ChangeLog:
PR middle-end/113212
* expr.h (const_seqpops): New typedef.
(expand_expr_real_2): Constify the first argument.
* optabs.cc (expand_widen_pattern_expr): Likewise.
* optabs.h (expand_widen_pattern_expr): Likewise.
* expr.cc (expand_expr_real_2): Likewise
(do_store_flag): Likewise. Remove incorrect store to ops->code.
Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
|
|
|
|
This reverts commit ea5c9f25241ae0658180afbcad7f4e298352f561.
|
|
Andrea Parri recently pointed out that we were emitting overly conservative
fences for seq_cst atomic loads/stores. This adds support for the optimized
fences specified in the PSABI:
https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/2092568f7896ceaa1ec0f02569b19eaa42cd51c9/riscv-atomic.adoc
gcc/ChangeLog:
* config/riscv/sync-rvwmo.md: Add support for subword fenced
loads/stores.
* config/riscv/sync-ztso.md: Ditto.
* config/riscv/sync.md: Ditto.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/amo/amo-table-a-6-load-1.c: Increase test coverage to
include longs, shorts, chars, and bools.
* gcc.target/riscv/amo/amo-table-a-6-load-2.c: Ditto.
* gcc.target/riscv/amo/amo-table-a-6-load-3.c: Ditto.
* gcc.target/riscv/amo/amo-table-a-6-store-1.c: Ditto.
* gcc.target/riscv/amo/amo-table-a-6-store-2.c: Ditto.
* gcc.target/riscv/amo/amo-table-a-6-store-compat-3.c: Ditto.
* gcc.target/riscv/amo/amo-table-ztso-load-1.c: Ditto.
* gcc.target/riscv/amo/amo-table-ztso-load-2.c: Ditto.
* gcc.target/riscv/amo/amo-table-ztso-load-3.c: Ditto.
* gcc.target/riscv/amo/amo-table-ztso-store-1.c: Ditto.
* gcc.target/riscv/amo/amo-table-ztso-store-2.c: Ditto.
* gcc.target/riscv/amo/amo-table-ztso-store-3.c: Ditto.
Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
Tested-by: Andrea Parri <andrea@rivosinc.com>
|
|
Support for complex increment and decrement (previously supported as
an extension) was voted into C2Y today (paper N3259). Thus, change
the pedwarn to a pedwarn_c23 and add associated tests.
Note: the type of the 1 to be added / subtracted is underspecified (to
be addressed in a subsequent paper), but understood to be intended to
be a real type (so the sign of a zero imaginary part is never changed)
and this is what is implemented; the tests added include verifying
that there is no undesired change to the sign of a zero imaginary
part.
Bootstrapped with no regressions on x86_64-pc-linux-gnu.
gcc/c/
* c-typeck.cc (build_unary_op): Use pedwarn_c23 for complex
increment and decrement.
gcc/testsuite/
* gcc.dg/c23-complex-1.c, gcc.dg/c23-complex-2.c,
gcc.dg/c23-complex-3.c, gcc.dg/c23-complex-4.c,
gcc.dg/c2y-complex-1.c, gcc.dg/c2y-complex-2.c: New tests.
|
|
The test case has "dg-do compile" set not "dg-do run" for a runnable
test. This patch changes the dg-do command argument to run.
gcc/testsuite/ChangeLog:gcc/testsuite/ChangeLog:
* gcc.target/powerpc/altivec-2-runnable.c: Change dg-do
argument to run.
|
|
gcc:
* doc/extend.texi (AArch64 Function Attributes): Add
(AVR Variable Attributes): Ditto.
(Common Type Attributes): Ditto.
|
|
Currently we represent a non-function using-declaration by inserting the
named declaration into the target scope. In general this works fine, but in
the case of an exported using-declaration we have nowhere to mark the
using-declaration as exported, so we mark the original declaration as
exported instead, and then treat all using-declarations that name it as
exported as well. We were doing this only if there was also a previous
non-exported using, so for this testcase the export got lost; this patch
broadens the workaround to also apply to the using that first brings the
declaration into the current scope.
This does not fully resolve 114683, but replaces a missing exports bug with
an extra exports bug, which should be a significant usability improvement.
The testcase has xfails for extra exports.
I imagine a complete fix should involve inserting a USING_DECL.
PR c++/114683
gcc/cp/ChangeLog:
* name-lookup.cc (do_nonmember_using_decl): Allow exporting
a newly inserted decl.
gcc/testsuite/ChangeLog:
* g++.dg/modules/using-22_a.C: New test.
* g++.dg/modules/using-22_b.C: New test.
|
|
add_binding_entity creates an OVERLOAD to represent a using-declaration in
module purview of a declaration in the global module, even for
non-functions, and we were failing to merge that with the original
declaration in name lookup.
It's not clear to me that building the OVERLOAD is what should be happening,
but let's work around it for now pending an overhaul of using-decl handling
for c++/114683.
PR c++/115194
gcc/cp/ChangeLog:
* name-lookup.cc (name_lookup::process_module_binding): Strip an
OVERLOAD from a non-function.
gcc/testsuite/ChangeLog:
* g++.dg/modules/using-23_a.C: New test.
* g++.dg/modules/using-23_b.C: New test.
|
|
Adjusting the comment I added in r15-1223 to clarify that this is a
workaround for a bug elsewhere.
gcc/cp/ChangeLog:
* module.cc (depset::hash::add_binding_entity): Adjust comment.
|
|
Since the terms of a requires-clause are grammatically primary-expressions
and not e.g. postfix-expressions, it seems we need to explicitly handle
and diagnose the case where a term parses to a bare unresolved identifier,
like cp_parser_postfix_expression does, since cp_parser_primary_expression
leaves that up to its callers. Otherwise we incorrectly accept the first
three requires-clauses below.
Note that the only occurrences of primary-expression in the grammar are
postfix-expression and constraint-logical-and-expression, so it's not too
surprising that we need this special handling here.
PR c++/99678
gcc/cp/ChangeLog:
* parser.cc (cp_parser_constraint_primary_expression): Diagnose
a bare unresolved unqualified-id.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-requires38.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>
|
|
In cfgexpand, there is an optimization for branch which tests
targetm.gen_ccmp_first == NULL. However for target like x86-64, the
hook was implemented but it does not indicate that ccmp was enabled.
Add a new target hook TARGET_HAVE_CCMP and replace the middle-end
check for the existance of gen_ccmp_first to avoid misoptimization.
gcc/ChangeLog:
PR target/115370
PR target/115463
* target.def (have_ccmp): New target hook.
* targhooks.cc (default_have_ccmp): New function.
* targhooks.h (default_have_ccmp): New prototype.
* doc/tm.texi.in: Add TARGET_HAVE_CCMP.
* doc/tm.texi: Regenerate.
* cfgexpand.cc (expand_gimple_cond): Call targetm.have_ccmp
instead of checking if targetm.gen_ccmp_first exists.
* expr.cc (expand_expr_real_gassign): Likewise.
* config/i386/i386.cc (ix86_have_ccmp): New target hook to
check if APX_CCMP enabled.
(TARGET_HAVE_CCMP): Define.
|
|
Here during overload resolution we have two strictly viable ambiguous
candidates #1 and #2, and two non-strictly viable candidates #3 and #4
which we hold on to ever since r14-6522. These latter candidates have
an empty second arg conversion since the first arg conversion was deemed
bad, and this trips up joust when called on #3 and #4 which assumes all
arg conversions are there.
We can fix this by making joust robust to empty arg conversions, but in
this situation we shouldn't need to compare #3 and #4 at all given that
we have a strictly viable candidate. To that end, this patch makes
tourney shortcut considering non-strictly viable candidates upon
encountering ambiguity between two strictly viable candidates (taking
advantage of the fact that the candidates list is sorted according to
viability via splice_viable).
PR c++/115239
gcc/cp/ChangeLog:
* call.cc (tourney): Don't consider a non-strictly viable
candidate as the champ if there was ambiguity between two
strictly viable candidates.
gcc/testsuite/ChangeLog:
* g++.dg/overload/error7.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>
|
|
In some cases that are difficult to characterize, the compiler fails an
assertion check (if the compiler is built with assertions enabled) or
loops forever (if assertions are not enabled). One way this can happen is if
Exp_Util.Insert_Actions is called with an N_Itype_Reference node as its first
parameter. This, in turn, can happen when an instance of
Exp_Attr.Expand_N_Attribute_Reference.Built_And_Insert_Type_Attr_Subp
calls Insert_Action (which will call Insert_Actions).
gcc/ada/
* exp_util.adb
(Insert_Actions): Code was relying on an incorrect assumption that an
N_Itype_Reference cannot occur in declaration list or a statement
list. Fix the code to handle this case.
|
|
Using -gnatdJ with various other switches was error prone.
Remove this switch since the primary users of this mode
GNATCheck and Codepeer no longer need it.
gcc/ada/
* debug.adb: Remove mentions of -gnatdJ.
* errout.adb: Remove printing subprogram names to JSON.
* erroutc.adb: Remove printing subprogram names in messages.
* erroutc.ads: Remove Node and Subprogram_Name_Ptr used for -gnatdJ.
* errutil.adb: Remove Node used for -gnatdJ
* gnat1drv.adb: Remove references of -gnatdJ and
Include_Subprgram_In_Messages.
* opt.ads: Remove Include_Subprgram_In_Messages
* par-util.adb: Remove behavior related to
Include_Subprgram_In_Messages.
* sem_util.adb: Remove Subprogram_Name used for -gnatdJ
|
|
This fixes a regression introduced by the overhaul of the implementation
of finalization. When the first subtype of an array type is declared as
constrained, the Finalize_Address primitive of the base type synthesized
by the compiler is tailored to this first subtype, which means that this
primitive cannot be used for other subtypes of the array type, which may
for example be generated when an aggregate is assigned to a slice of an
object of the first subtype.
The straightforward solution would be to synthesize the Finalize_Address
primitive for the base type instead, but its clean implementation would
require changing the way allocators are implemented to always allocate
the bounds alongside the data, which may turn out to be delicate.
This instead changes the compiler to synthesize a local Finalize_Address
primitive in the problematic cases, which should be rare in practice, and
also contains a fixlet for Find_Last_Init, which fails to get to the base
type again in the indirect case and, therefore, mishandles array subtypes.
gcc/ada/
* exp_ch7.adb (Attach_Object_To_Master_Node): Fix formatting.
(Build_Finalizer.Process_Object_Declaration): Synthesize a local
Finalize_Address primitive if the object's subtype is an array
that has a constrained first subtype and is not this first subtype.
* exp_util.adb (Find_Last_Init): Get again to the base type in the
indirect case.
|
|
The attribute is rejected except in attribute definition clauses, where it
is silently ignored (it's a by-product of the processing of the aspect).
gcc/ada/
* doc/gnat_rm/implementation_defined_attributes.rst (Iterable):
Delete entry.
* gnat_rm.texi: Regenerate.
* gnat_ugn.texi: Regenerate.
|
|
In the case the type of an aggregate cannot be determined due to
an ambiguity, caused by the existence of container aggregates,
a hint can be given by GNAT. The test for giving this hint should
be the Ada language version, not the fact that extensions are allowed.
Now fixed.
There is no impact on code generation.
gcc/ada/
* sem_util.adb (Check_Ambiguous_Aggregate): Fix test.
|
|
When a derived tagged type implements more interface interface types
than its parent type, and a primitive inherited from its parent type
covers a primitive of these additional interface types that has
classwide postconditions, the code generated by the compiler does not
check the classwide postconditions inherited from the interface primitive.
gcc/ada/
* freeze.ads (Check_Condition_Entities): Complete documentation.
* freeze.adb (Check_Inherited_Conditions): Extend its functionality to
build two kind of wrappers: the existing LSP wrappers, and wrappers
required to handle postconditions of interface primitives implemented
by inherited primitives.
(Build_Inherited_Condition_Pragmas): Rename formal.
(Freeze_Record_Type): For derived tagged types, move call to
Check_Inherited_Conditions to subprogram Freeze_Entity_Checks;
done to improve the performance of Check_Inherited_Conditions since it
can rely on the internal entities that link interface primitives with
tagged type primitives that implement them.
(Check_Interface_Primitives_Strub_Mode): New subprogram.
* sem_ch13.adb (Freeze_Entity_Checks): Call Check_Inherited_Conditions.
Call Check_Inherited_Conditions with derived interface types to check
strub mode compatibility of their primitives.
* sem_disp.adb (Check_Dispatching_Operation): Adjust assertion to accept
wrappers of interface primitives that have classwide postconditions.
* exp_disp.adb (Write_DT): Adding text to identify wrappers.
|
|
GNATProve compiles the program multiple times. During the
first run the warnings are suppressed. These messages need
to be suppressed during that run in order to avoid having
them duplicated in the following runs. Revert the previous
changes as there currently is not a way to simply suppress
info messages.
gcc/ada/
* sem_res.adb (Resolve_Call): add warning insertion
character into the info message.
|
|
An entity can be defined within an expression (the best example is probably a
declare expression, but a quantified expression is another; there are others).
When making a deep copy of an expression, the Entity nodes for such entities
were sometimes not copied, apparently for performance reasons. This caused
correctness problems in some cases, so do not perform that "optimization".
gcc/ada/
* sem_util.adb
(New_Copy_Tree.Visit_Entity): Delete code that prevented copying some entities.
|
|
Minor rewording of a warning.
Disallow positional notation for <> (but disable this check),
and fix resulting errors.
Copy use clauses.
gcc/ada/
* sem_ch12.adb (Check_Fixed_Point_Actual): Minor rewording; it seems
more proper to say "operator" rather than "operation".
(Matching_Actual): Give an error for <> in positional notation.
This is a syntax error. Disable this for now.
(Analyze_Associations): Copy the use clause in all cases.
The "mustn't recopy" comment seems wrong, because New_Copy_Tree
preserves Slocs.
* libgnat/a-ticoau.ads: Fix violation of new postion-box error.
* libgnat/a-wtcoau.ads: Likewise.
* libgnat/a-ztcoau.ads: Likewise.
|
|
This message provides only inner details of how the compiler
handles this kind of construct and does not provide meaningful
information that the user can interact on.
gcc/ada/
* par-labl.adb (Rewrite_As_Loop): Remove info message
|
|
Remove warning insertion characters without switch characters
from info messages.
gcc/ada/
* par-ch7.adb: Remove warning characters from info message
* par-endh.adb: Remove warning characters from info message
* sem_res.adb: Remove warning characters from info message
|
|
The info message about the freeze point should be considered
a continuation of the error message about the change of visibility
after the freeze point. This improves the error layout for formatted
error messages with the -gnatdF switch.
gcc/ada/
* sem_ch13.adb (Check_Aspect_At_End_Of_Declarations): change the
info message to a continuation message.
|
|
gcc/ada/
* inline.adb (Cannot_Inline): Simplify string handling logic.
|
|
Add entities of kind E_Subprogram_Body to the list of entities associated
to a given scope. This ensures that representation information is
correctly output for object and type declarations inside these subprogram
bodies. This is useful for outputing that information fron the compiler
with the switch -gnatR, as well as for getting precise representation
information inside GNATprove.
Remove ad-hoc code inside repinfo.adb that retrieved this information
in only some cases.
gcc/ada/
* exp_ch5.adb (Expand_Iterator_Loop_Over_Container): Skip entities
of kind E_Subprogram_Body.
* repinfo.adb (List_Entities): Remove special case for subprogram
bodies.
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): List subprogram
body entities in the enclosing scope.
|
|
When the first formal parameter of a subprogram is a class-wide
interface type (or an access to a class-wide interface type),
changing the order of the interface types implemented by a
type declaration T enables or disables the ability to use the
prefix notation to call it with objects of type T. When the
call is disabled the compiler rejects it reporting an error.
gcc/ada/
* sem_ch4.adb (Traverse_Interfaces): Add missing support
for climbing to parents of interface types.
|
|
The GNAT-defined Super attribute was formerly disallowed for an object of a
derived tagged type having an abstract parent type. This rule has been relaxed;
an abstract parent type is now permitted as long as it is not an interface type.
Update the GNAT RM accordingly.
gcc/ada/
* doc/gnat_rm/implementation_defined_attributes.rst:
Update Super attribute documentation.
* gnat_rm.texi: Regenerate.
* gnat_ugn.texi: Regenerate.
|
|
System.Tasking.Protected_Objects.Lock can raise exceptions, but that
wasn't taken into account by the expansion of protected subprogram
bodies before this patch. More precisely, there were cases where
calls to System.Tasking.Initialization.Abort_Undefer were
incorrectly omitted. This patch fixes this.
gcc/ada/
* exp_ch7.adb (Build_Cleanup_Statements): Adapt to changes
made to Build_Protected_Subprogram_Call_Cleanup.
* exp_ch9.adb (Make_Unlock_Statement, Wrap_Unprotected_Call):
New functions.
(Build_Protected_Subprogram_Body): Fix resource management in
generated code.
(Build_Protected_Subprogram_Call_Cleanup): Make use of newly
introduced Make_Unlock_Statement.
|
|
The Defining_Identifier of a renaming may be a E_Constant in the context.
gcc/ada/
PR ada/114710
* exp_util.adb (Find_Renamed_Object): Recurse for any renaming.
|
|
We already checked that a global item of mode Output is not an Input of
the enclosing subprograms. With this change we also check that if this
global item is a constituent, then none of its encapsulating abstract
states is an Input of the enclosing subprograms.
gcc/ada/
* sem_prag.adb (Check_Mode_Restriction_In_Enclosing_Context):
Iterate over encapsulating abstract states.
|
|
This set of changes is aimed at streamlining the code generated for the
elaboration of local tagged types. The dispatch tables and other related
data structures are built dynamically on the stack for them and a few of
the patterns used for this turn out to be problematic for the optimizer:
1. the array of primitives in the dispatch table is default-initialized to
null values by calling the initialization routine of an unconstrained
array type, and then immediately assigned an aggregate made up of the
same null values.
2. the external tag is initialized by means of a dynamic concatenation
involving the secondary stack, but all the elements have a fixed size.
3. the _size primitive is saved in the TSD by means of the dereference of
the address of the TSD that was previously saved in the dispatch table.
gcc/ada/
* Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add s-imad32$(objext),
s-imad64$(objext) and s-imagea$(objext).
* exp_atag.ads (Build_Set_Size_Function): Replace Tag_Node parameter
with Typ parameter.
* exp_atag.adb: Add clauses for Sinfo.Utils.
(Build_Set_Size_Function): Retrieve the TSD object statically.
* exp_disp.adb: Add clauses for Ttypes.
(Make_DT): Call Address_Image{32,64] instead of Address_Image.
(Register_Primitive): Pass Tag_Typ to Build_Set_Size_Function.
* rtsfind.ads (RTU_Id): Remove System_Address_Image and add
System_Img_Address_{32;64}.
(RE_Id): Remove entry for RE_Address_Image and add entries for
RE_Address_Image{32,64}.
* rtsfind.adb (System_Descendant): Adjust to above changes.
* libgnat/a-tags.ads (Address_Array): Suppress initialization.
* libgnat/s-addima.adb (System.Address_Image): Call the appropriate
routine based on the address size.
* libgnat/s-imad32.ads: New file.
* libgnat/s-imad64.ads: Likewise.
* libgnat/s-imagea.ads: Likewise.
* libgnat/s-imagea.adb: Likewise.
* gcc-interface/Make-lang.in (GNAT_ADA_OBJS) [$(STAGE1)=False]: Add
ada/libgnat/s-imad32.o and ada/libgnat/s-imad64.o.
|