The problem is that a transient scope is created during the analysis of the
actual parameters of the instantiation and this discombobulates the complex
handling of scopes in Sem_Ch12.
gcc/ada/
PR ada/78175
* sem_ch12.adb (Hide_Current_Scope): Deal with a transient scope
as current scope.
(Remove_Parent): Likewise.
gcc/testsuite/
* gnat.dg/generic_inst15.adb: New test.
* gnat.dg/generic_inst15_pkg-g.ads: New helper.
* gnat.dg/generic_inst15_pkg.ads: Likewise.
The current error message is:
abstract1.ads:7:13: error: "abstract" not allowed here, ignored
but "abstract" is indeed allowed there if you complete the declaration.
The patch changes it to:
abstract1.ads:7:13: error: "abstract" allowed only for record extension, ...
gcc/ada/
PR ada/55324
* par-ch3.adb (P_Type_Declaration): Give a better error message
for illegal "abstract" in a type derivation.
gcc/testsuite/
* gnat.dg/specs/abstract1.ads: New test.
pr119115.c is broken (since it was added?) but because we only
attempt to compile/run it on a 256b target I never noticed it.
This patch adds -std=gnu99 to make it compile.
Regtested on rv64gcv_zvl512b. Going to push after the CI run.
Regards
Robin
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/base/pr119115.c: Add -std=gnu99.
PR fortran/122513
gcc/fortran/ChangeLog:
* resolve.cc (check_default_none_expr): Do not allow an
iterator in a locality spec. Allow a named constant to be
used within the loop.
gcc/testsuite/ChangeLog:
* gfortran.dg/pr122513.f90: New test.
While I haven't been able to reproduce the failure Sam reported, based on the
RTL checking failure point and the code in question it was pretty clear the
code that was supposed to guard against a variable bit extract was just
checking the wrong argument to verify it was a constant integer -- it missed a
level of XEXP object extraction.
I passed this patch along to Sam and he verified it fixes his kernel build.
I've bootstrapped and regression tested on x86_64. Pushing to the trunk.
Pushing to the trunk.
PR rtl-optimization/122536
gcc/
* simplify-rtx.cc (simplify_context::simplify_binary_operation_1): Fix
guard against variable bit extracts in recent change.
Some libstdc++ tests were failing with import std because ADL didn't find
rethrow_exception, even though it's a friend. The problem turned out to be
because it's not in the same namespace, and in C++17 ADL only makes hidden
friends visible. But in C++20 P1787 changed [basic.lookup.argdep]/4.2 to
directly include all friends in the lookup.
Note that my change still excludes class members, even though the standard
doesn't specify that; including implicit object member functions would just
break, and even foreign static/xobj member functions seem like they would be
strange to include.
gcc/cp/ChangeLog:
* name-lookup.cc (name_lookup::adl_class_fns): Include all
namespace-scope friends.
gcc/testsuite/ChangeLog:
* g++.dg/lookup/koenig16.C: New test.
27_io/headers/iostream/synopsis.cc was failing with modules because pushdecl
called update_binding for a redeclared import while passing the built-in
clog as "old". This could also be fixed by discarding the builtin in
e.g. import_module_binding, but this seems straightforward.
gcc/cp/ChangeLog:
* name-lookup.cc (pushdecl): Discard built-in sooner.
gcc/testsuite/ChangeLog:
* g++.dg/modules/builtin-9_a.C: New test.
* g++.dg/modules/builtin-9_b.C: New test.
Since the implementation namespaces __detail and __exception_ptr aren't
exported from std, ADL can't find these functions there. Adding friend
declarations makes it work.
libstdc++-v3/ChangeLog:
* include/bits/quoted_string.h: Add ADL friends.
* libsupc++/exception_ptr.h: Add ADL friend.
In OpenMP, pointers are implicitly mapped - which means for Fortran that
their pointer target is also mapped. However, for uninitialized memory,
this means that some random pointee with some random amount of memory is
copied - in the good case, size == 0, but if not, odd things can happen.
Solution: Use 'fptr => null()' before the target mapping or - as done here -
declare the pointer inside the region.
libgomp/ChangeLog:
PR libgomp/122543
* testsuite/libgomp.fortran/omp_target_memset.f90: Move fptr inside
the target to avoid implicit mapping of its uninit pointee.
* testsuite/libgomp.fortran/omp_target_memset-2.f90: Likewise.
Messing with macros before possibly importing the stdc++.h header unit is
bad form; better to mess with (other) macros afterward.
libstdc++-v3/ChangeLog:
* src/c++23/std.cc.in: Move TBB macro shenanigans after
bits/stdc++.h.
<cassert> isn't suitable for a header unit, because by design it depends on
the user NDEBUG macro. So let's not include it in <bits/stdc++.h>.
libstdc++-v3/ChangeLog:
* include/precompiled/stdc++.h: Remove <cassert>.
* testsuite/util/exception/safety.h: Add <cassert>.
* testsuite/17_intro/headers/c++1998/stdc++_assert_neg.cc:
Don't define _GLIBCXX_NO_ASSERT.
In r15-3499 I added attributes to _Ios_Openmode to avoid -Wswitch false
positives; let's do the same for the other enums in ios_base.
It also seems to me that with these attributes, the tests don't need to
include the end/max/min cases.
libstdc++-v3/ChangeLog:
* include/bits/ios_base.h: Add attribs to _Ios_Fmtflags,
_Ios_Iostate, _ios_seekdir.
* testsuite/27_io/ios_base/types/fmtflags/case_label.cc: Remove
unneeded cases.
* testsuite/27_io/ios_base/types/iostate/case_label.cc: Likewise.
* testsuite/27_io/ios_base/types/openmode/case_label.cc: Likewise.
* testsuite/27_io/ios_base/types/seekdir/case_label.cc: Likewise.
21_strings/basic_string_view/cons/wchar_t/3.cc was failing with import std
because as in the reduced testcase, the module includes an instantiation of
the template constructor for <const char *, const char *>, and importing the
module was wrongly adding that instantiation to CLASSTYPE_MEMBER_VEC, so it
became part of the overload set independent of its template.
tsubst_function_decl doesn't add to CLASSTYPE_MEMBER_VEC, and importing
should work the same.
gcc/cp/ChangeLog:
* module.cc (trees_in::decl_value): Don't add an instantiation to
CLASSTYPE_MEMBER_VEC.
gcc/testsuite/ChangeLog:
* g++.dg/modules/clone-5_a.C: New test.
* g++.dg/modules/clone-5_b.C: New test.
20_util/rel_ops.cc was failing because the gcm didn't represent
[[deprecated]] on a namespace. Are there any other attributes we're
missing?
gcc/cp/ChangeLog:
* module.cc (module_state::write_namespaces): Handle
TREE_DEPRECATED.
(module_state::read_namespaces): Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/modules/namespace-15_a.C: New test.
* g++.dg/modules/namespace-15_b.C: New test.
... where it currently runs into:
libgomp: cuCtxSynchronize error: an illegal memory access was encountered
... for nvptx, or similarly for GCN:
Memory access fault by GPU node-1 (Agent handle: 0x34d77290) on address 0x7fff3c553000. Reason: Page not present or supervisor privilege.
Fix-up for commit r16-4961-ge2cbcd1b27c0da92bdcd96664064d3d0c1d44e6f
"Fix gimple_copy for OpenMP atomic load/store [PR122281, PR105001]".
PR libgomp/122281
libgomp/
* testsuite/libgomp.c/pr122281.c: Fix for non-USM offloading
execution.
A hopefully temporary fix for if-expression that has been rewritten into an
if-statement, where a object reference has the if-statement as its parent,
but is not part of the condition, then statements or else statements.
gcc/ada/ChangeLog:
* exp_util.adb (Get_Current_Value_Condition): Guard against orphaned
references in rewritten if-expressions.
The alignment check for address clauses had historically been performed
universally by GNAT, until a decade ago when it was disabled by default
on non-strict-alignment platforms.
This seems questionable when an alignment clause is also given for the
entity since the intent is clear, so the change restores it as well as
its associated warning.
Moreover, this alignment check had historically been subsumed into the
language-defined Range_Check, until two decades ago when it became the
implementation-defined Alignment_Check, while still being part of the
Range_Check to ease the transition. Now is probably a good time to cut
the apron strings and make Alignment_Check standalone.
gcc/ada/ChangeLog:
* doc/gnat_rm/representation_clauses_and_pragmas.rst (Address
Clauses): Adjust description of alignment checks.
* sem_ch13.adb (Address_Clause_Check_Record): Remove now unused
Alignment_Checks_Suppressed component.
(Alignment_Checks_Suppressed): Delete.
(Analyze_Attribute_Definition_Clause) <Attribute_Alignment>: Do not
consider the status of range checks to decide whether to generate an
alignment check. Always generate it if an alignment clause is also
given for the entity.
<Attribute_Alignment>: Generate an alignment check if an address
clause is also given for the entity.
(Register_Address_Clause_Check): Adjust for above removal.
(Validate_Address_Clauses): Test the Check_Address_Alignment flag
on the clause to decide whether to give the warning.
* gnat_rm.texi: Regenerate.
* gnat_ugn.texi: Regenerate.
The Apply_Alignment_Check procedure no longer exists.
gcc/ada/ChangeLog:
* checks.adb (Apply_Address_Clause_Check): Adjust self-reference in
the opening comment.
The compile-time evaluation relied on source locations to decide whether a
variable reference occurs within a WHILE loop where the evaluation can
assume the loop condition. Now this relies exclusively on the AST structure.
gcc/ada/ChangeLog:
* exp_util.adb (Find_In_Enclosing_Context): Refactor from handling of
IF statements.
(Get_Current_Value_Condition): Reuse IF code for WHILE statements.
The compile-time evaluation relied on source locations to decide whether a
variable reference occurs within an IF statement where the evaluation can
assume the IF condition. This was unreliable, especially for rewritten and
internally generated IF statements, whose End_Span is typically left as zero.
This patch makes the evaluation exclusively dependent on the AST structure
itself, while the source location and the span of an if statement is only used
in assertion.
gcc/ada/ChangeLog:
* exp_util.adb (Get_Current_Value_Condition): Rewrite to not rely on
Sloc and End_Span of an if statement.
When copying AST we created an orphaned copy of a scalar range. This was
confusing the compile-time evaluator, because we couldn't determine location of
a scalar range within an IF statement by looking at its parenthood chain.
gcc/ada/ChangeLog:
* sem_util.adb (Update_Semantic_Fields): Preserve tree structure when
copying scalar range of a discrete type.
Frontend inlining, which is now deprecated and only enabled with switch -gnatN
is used, used to reset source locations for subprograms from predefined units.
This was a workaround to prevent the debugger from visiting internal code in
Ada.Tags, but this problem no longer occurs (even when switch -gnatN is used)
and is no longer needed. This patch removes it, because it confused
compile-time evaluation, which makes use of source locations to recognize code
within IF statements.
gcc/ada/ChangeLog:
* inline.adb (Process_Sloc): Remove.
The syntax is plain invalid because a box can be accepted as a positional
parameter only in the first place.
gcc/ada/ChangeLog:
PR ada/61127
* sem_ch12.adb (Associations.Match_Positional): Remove the always
false condition that guards the error on a positional box.
The compiler can crash with a Storage_Error for a failed precondition
when compiling a call to a dispatching subprogram where an actual for a
controlling formal is given by an if_expression whose dependent expressions
are tag-indeterminate calls. This problem showed up on a build of Alire
(on the compilation of alire-roots.adb) done during a build_gnat_world
mailserver (as well as having been noticed and reported separately by
another engineering team).
The code in Sem_Disp.Check_Dispatching_Call for checking nondispatching
procedure calls for actuals that are calls to abstract tag-indeterminate
functions did not account for conditional expressions, and attempted to
retrieve the (nonexistent) Expression field from an N_If_Expression node,
failing the precondition for Expression. It was discovered that none of
the code checking for illegal calls to abstract tag-indeterminate functions
in procedure calls is needed, and the whole related "elsif" part is removed
by this change. (Note that there is separate checking done separately
within Check_Dispatching_Call that will catch nondispatching calls to
abstract functions.)
gcc/ada/ChangeLog:
* sem_disp.adb (Check_Dispatching_Call): Remove "elsif" that does error
checking for abstract tag-indeterminate calls (seems to be no longer
needed).
When unnesting a loop, its body is moved inside a procedure, and inner
entities have their scope adjusted. The current GNAT Tree at this stage
is incoherent wrt scope information, and some nested entities are
incorrectly scoped, possibly leading to a crash of the unnester.
The existing Fixup_Inner_Scopes procedure has been added to adjust the
incoherences after the fact because fixing them earlier has proven to be
more complex than expected. This change adds one more adjustment by this
procedure for TSS (Type Support Subprogram) that may be embedded within
N_Freeze_Entity nodes.
gcc/ada/ChangeLog:
* exp_ch7.adb (Fixup_Inner_Scopes): Adjust to handle N_Freeze_Entity nodes.
* exp_unst.adb (Get_Level): Assert when the function didn't find the
nested level (indicates that inner sub has scope pointing higher in
the stack)
This patch extends the set of names recognized by
Is_Predefined_File_Name so that names that start with "a-" and are longer
than 12 characters are considered predefined.
This is motivated by the need to make gprname work with the in-tree
a-strunb__shared.ads file that uses GNAT syntax extensions but whose name
wasn't considered predefined before this patch.
gcc/ada/ChangeLog:
* fname.adb (Is_Predefined_File_Name): Tweak.
We should not mix "syntactic" and "semantic" for the same field
in different node kinds.
The Expression field was both syntactic (in N_Exception_Declaration) and
semantic (in all other node kinds). This patch makes it always
syntactic.
Expression is the last such field, so we remove all code and comments
that allowed for such mixing.
The Expression field in N_Exception_Declaration was never properly
documented; fix that.
No change in overall compiler behavior.
An alternative would be to change the name of this Expression
field to be something else (Exception_Declaration_Expression?),
and keep it as "semantic". That would cause an earthquake in gigi,
because gigi wants to treat exception declarations more-or-less
like normal object declarations, with the Expression field being
the initialization expression. So we don't do that.
gcc/ada/ChangeLog:
* gen_il-gen-gen_nodes.adb (N_Exception_Declaration):
Change Expression from Sm to Sy, to match other Expression fields.
* gen_il-gen.adb (Setter_Needs_Parent):
Expression no longer needs to be a special case.
(Check_For_Syntactic_Field_Mismatch):
Do not exempt Expression from the Sy/Sm mixing rule.
This was the last such case, so remove all the exemption code.
* gen_il-gen.ads: Update comments to match new code.
* sinfo.ads (N_Exception_Declaration):
Document the meaning of the Expression field, because it
doesn't follow from the RM syntax of exception_declaration.
* exp_ch11.adb: Minor comment fixes.
The RM 13.1(7/5) subclause contains the following sentences: "If the size
of an object is greater than that of its subtype, the additional bits are
padding bits. For an elementary object, these padding bits are normally
read and updated along with the others."
GNAT implements it only for objects of integer and fixed-point types.
For objects of floating-point types, the padding bits are ignored (and
therefore not initialized) with a warning:
warning: 32 bits of "F" unused [enabled by default]
Implementing it for objects of floating-point types does not seem worth the
hassle, so rejecting nonconfirming size clauses is probably the cleanest
approach (clauses giving the object a size lower than that of its subtype
are already rejected for objects of floating-point types).
gcc/ada/ChangeLog:
* sem_ch13.adb (Analyze_Attribute_Definition_Clause)
<Attribute_Size>: Tweak wording of existing error message for the
size of all elementary objects. Move error handling for aliased
objects into the block for objects and give a similar error for
(nonaliased) floating-point objects.
Rewriting of an address of a slice, e.g. "X (Low .. High)'Address" into an
address of an indexed component, e.g. "X (Low)'Address", was only done as a
workaround for some freezing issue. Apparently this freezing issue is now
solved and the rewriting is causing problems for GNATprove. (This rewriting,
if needed, should be rather done in expansion and not resolution.)
gcc/ada/ChangeLog:
* sem_attr.adb (Resolve_Attribute): Remove rewriting of a slice
address expression.
Put_Image should start printing the tree from the Root instead
of the First_Child.
gcc/ada/ChangeLog:
* libgnat/a-cbmutr.adb (Put_Image): Fix the condition and starting point
for printing the tree.
* libgnat/a-cimutr.adb (Put_Image): Likewise.
* libgnat/a-comutr.adb (Put_Image): Likewise.
When the frontend is called by it should treat all ghost
code as checked. Avoid removing expansion in ignored ghost code regions
when Codepeer_Mode is active.
gcc/ada/ChangeLog:
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Avoid disabling
the expander for ignored ghost regions if Codepeer_Mode is active.
* sem_ch7.adb (Analyze_Package_Body_Helper): Likewise.
* freeze.adb (Freeze_Entity): Avoid triggering special freezing
action for entities within ignored ghost regions in Codepeer_Mode.
Errors for ghost incompatibilities of qualified names should not
be applied to prefixes but rather only the final selector.
gcc/ada/ChangeLog:
* ghost.adb (Is_Ok_Context): consider ghost prefix to always
be a valid ghost context.
This patch introduces the 'Constructor attribute and implements its direct
attribute definition syntax within subprogram specification. This new shorthand
avoids having to come up with an arbitrary subprogram name and to type out the
constructor aspect. Before, constructors where defined through the aspect
Constructor, which has been removed.
Furthermore, this patch prepares for the expansion of direct attribute
definitions to other attributes.
gcc/ada/ChangeLog:
* errout.adb (Set_Msg_Node): Support N_Attribute_Reference and
nodes that denotes direct attribute definitions.
* exp_dbug.ads: Description for the encoding of direct attribute
definitions as tick are hard to deal in entity names.
* erroutc.adb
(Set_Msg_Insertion_Name): Replace underscore between prefix and
attribute name in direct attribute definitions; at this point we
lost the semantic information of node type and we resort to match
the string name as described in exp_dbug.adb.
* exp_aggr.adb (Convert_To_Positional): Use Needs_Construction and
Has_Default_Constructor.
* exp_ch3.adb (Build_Record_Init_Proc)
(Expand_N_Object_Declaration): Likewise.
* exp_attr.adb (Expand_N_Attribute_Reference): Likewise.
* exp_ch4.adb (Expand_N_Allocator): Likewise.
* exp_ch6.adb
(Prepend_Constructor_Procedure_Prologue): Use
Is_Constructor_Procedure.
(Make_Parent_Constructor_Call): Use
Direct_Attribute_Definition_Name.
* gen_il-fields.ads: Remove Constructor_List and Constructor_Name.
* gen_il-gen-gen_entities.adb: Likewise.
* einfo.ads (Needs_Construction): Add description.
(Has_Delayed_Aspects): Adjust indentation.
* par-ch13.adb (P_Attribute_Designators): Parse attribute
designators.
(P_Representation_Clause): Use P_Attribute_Designators.
* par-ch6.adb (P_Subprogram): Support attribute designators in
subprogram name.
(Rewrites_Entity_If_Direct_Attribute_Def): Fix the specification
node in case of direct attribute definitions.
* par-endh.adb (Check_End, Same_Label): Likewise.
* par.adb (P_Attribute_Designators): Specification.
* sem_attr.adb (Analyze_Attribute): Error when using 'Constructor
outside procedure specification.
(Analyze_Attribute): Add error handling code.
* sem_ch3.adb (Analyze_Aspect_Specifications): Likewise.
* sem_ch6.adb (Analyze_Direct_Attribute_Definition): Handle direct
attribute definitions. Add error handling code for the
'Construction attribute and set constructor flags when necessary.
(Analyze_Subprogram_Specification): Use
Analyze_Direct_Attribute_Definition.
* sem_util.adb (Direct_Attribute_Definition_Name): Name of
entities created for direct attribute definitions. We emit an
error if multiple attributes.
(Is_Direct_Attribute_Subp_Spec): Helper to check whether a
subprogram specification is a direct attribute definition.
(Is_Constructor_Procedure): Helper to check whether a subprogram
is a constructor procedure.
(Has_Default_Constructor): Check whether the default constructor
exists.
(Default_Constructor): Not used anymore.
(Parameter_Count): Likewise.
(Process_End_Label): Get_Attribute_Reference_Name_String encodes
also direct attribute definition end labels.
* sem_util.ads: Likewise.
* snames.ads-tmpl: Support for 'Constructor attribute.
* snames.adb-tmpl (Is_Direct_Attribute_Definition_Name): Helper to
check attributes allowed in direct attribute definitions.
* aspects.ads: Remove constructor aspect.
* sem_ch13.adb: Likewise.
The actuals for parameters of formal packages are visible in the instance
if the formal packages either are declared with a box or contain defaulted
parameters. This is essentially implemented in Check_Generic_Actuals and
Restore_Private_Views, with the help of the Is_Visible_Formal flag.
This documents more prominently the processing and streamlines it, as well
as removes a couple of questionable calls to Set_Is_Hidden, thus plugging
a couple more loopholes in the implementation.
gcc/ada/ChangeLog:
PR ada/122161
* sem_ch12.adb: Improve the description of Check_Generic_Actuals,
Restore_Private_Views and Switch_View, and alphabetize them.
(Check_Generic_Actuals): Make actuals visible only if needed.
(Install_Formal_Packages): Pass exact Is_Formal_Box parameter and
remove call to Set_Is_Hidden.
(Instantiate_Formal_Package): Use Next_Non_Pragma consistently in
the loop computing the visibility of actuals.
(Analyze_Package_Instantiation): Use named second parameter in the
call to Restore_Private_Views.
(Analyze_Subprogram_Instantiation): Likewise.
(Instantiate_Package_Body): Likewise and for Check_Generic_Actuals.
(Instantiate_Subprogram_Body): Likewise.
(Restore_Env): Replace call to Restore_Private_Views.
(Restore_Private_Views): Remove default value for second parameter
and test of presence for first parameter. Consistently clear the
Is_Potentially_Use_Visible flag when setting the Is_Hidden flag.
Remove call to Set_Is_Hidden for a formal package of the enclosing
generic unit, if any.
We should not mix "syntactic" and "semantic" for the same field
in different node kinds.
The Actions field is both syntactic and semantic. This patch
makes it always syntactic.
No change in overall compiler behavior.
gcc/ada/ChangeLog:
* gen_il-gen.adb (N_Short_Circuit):
Make Actions syntactic.
(N_Case_Expression_Alternative): Likewise.
* gen_il-gen-gen_nodes.adb (Create_Type):
No longer exempt Actions from the syntactic/semantic ordering rule.
(Check_For_Syntactic_Field_Mismatch):
No longer exempt Actions from the syntactic/semantic mixing rule.
* sinfo.ads (N_Compound_Statement):
Add comment.
The comment has been documenting a 'Present(S)' that has been long
gone (>17y).
gcc/ada/ChangeLog:
* sem_aux.adb (Enclosing_Dynamic_Scope): Remove comment.
The following fields are not used in GNAT nor in any of its clients.
Neither the setters nor the getters are called.
Node fields:
Do_Storage_Check
Enclosing_Variant
Handler_List_Entry
Is_Subprogram_Descriptor
Renaming_Exception
Default_Expression
Entity fields:
Is_Unimplemented
This patch removes all of them.
gcc/ada/ChangeLog:
* einfo.ads: Remove unused fields.
* gen_il-fields.ads: Likewise.
* gen_il-gen-gen_entities.adb: Likewise.
* gen_il-gen-gen_nodes.adb: Likewise.
* sinfo.ads: Likewise.
* gen_il-gen.adb (Compile): Remove obsolete comment.
A recent patch added a procedure in the spec of System.Stream_Attributes
but failed to add the corresponding body in the CHERI-specific body of
this package. This patch fixes this.
gcc/ada/ChangeLog:
* libgnat/s-stratt__cheri.adb (W_80IEEE): New procedure.
This patch reduces the scope of a recently introduced variable because
it was much larger than it needed to be.
gcc/ada/ChangeLog:
* libgnat/s-stratt.adb (W_80IEEE): Make constant local.
The following fields are Set_ but not used in GNAT. We get rid of them
or document them as follows:
- Has_Pragma_Controlled
Remove.
- Corresponding_Entry_Body
Document that it is used by codepeer.
- Is_Activation_Record
Document that it is used by llvm.
- Is_Discriminant_Check_Function
Document that it is used by codepeer.
- Original_Access_Type
No change (already documented that it is used by codepeer).
gcc/ada/ChangeLog:
* einfo.ads (Has_Pragma_Controlled): Remove.
(Is_Activation_Record): Document usage by llvm.
* gen_il-fields.ads (Opt_Field_Enum):
Remove Has_Pragma_Controlled.
* gen_il-gen-gen_entities.adb (Access_Kind):
Remove Has_Pragma_Controlled.
* sem_prag.adb:
Remove setting of Has_Pragma_Controlled.
* sinfo.ads (Corresponding_Entry_Body):
Document usage by codepeer.
An object initialized by a C++-imported constructor call has the
constructor function call transformed into a procedure call, and the
call is inserted after the object declaration.
If the object has say an address clause, that transformation separates
the declaration from the address clause, causing the translation of
the call to fail.
Keep such clauses next to the declaration by inserting the constructor
procedure call after them.
gcc/ada/ChangeLog:
* exp_ch3.adb (Expand_N_Object_Declaration): Insert ctor call
after representation clauses.
Check_Vanishing_Fields calls Same_Node_To_Fetch_From, which was calling
Node_To_Fetch_From, which will raise an exception (as it should) on
..._Type_Only fields if called early (when the Base_Type,
Implementation_Base_Type, or Root_Type has not yet been set).
Other exceptions can also be raised when Check_Vanishing_Fields
is called early.
An exception handler was used to ignore any such exceptions. That was
correct, but it is annoying in gdb with "catch exception". (Note that
efficiency doesn't matter much, because Check_Vanishing_Fields is not
done in production mode.)
We now call Node_To_Fetch_From_If_Set, remove other potential raises,
and remove the now-unnecessary exception handler.
Note that other calls to Node_To_Fetch_From will still raise an
exception (as they should) for such "early" calls.
gcc/ada/ChangeLog:
* atree.adb (Same_Node_To_Fetch_From):
Use Node_To_Fetch_From_If_Set, and remove handler.
* einfo-utils.adb (Root_Type_If_Set):
Return Empty if Base_Type_If_Set returns Empty.
Return Empty if we find Etype (T) = Empty.
(Underlying_Type): Use "Has_Non_Limited_View..." instead
of "Present (Non_Limited_View...)", because the latter raises
an exception when given the wrong Ekind.
On some platforms, Long_Long_Float'Size (and Long_Long_Float'Stream_Size)
is 128 but only 80 bits are effectively used. This pack makes it so
'Write in this case write zeros for the padding bits instead of
unspecified values.
gcc/ada/ChangeLog:
* gen_il-fields.ads (Is_IEEE_Extended_Precision): New flag.
* gen_il-gen-gen_entities.adb: Likewise.
* gen_il-internals.adb (Image): Likewise.
* treepr.adb (Image): Likewise.
* einfo.ads: Document new flag.
* cstand.adb (Copy_Float_Type, Register_Float_Type): Use new flag.
* libgnat/s-stratt.ads (W_80IEEE): New procedure.
* libgnat/s-stratt.adb (W_80IEEE): Likewise.
* exp_strm.adb (Get_Primitives): Select new procedure when
appropriate.
* rtsfind.ads: Register new runtime procedure.
* sem_ch3.adb (Build_Derived_Numeric_Type,
Analyze_Subtype_Declaration): Propagate new flag.
It comes from the implementation of an optimization for static concatenation
in Resolve_String_Literal, which causes the original subtype of the literal
to be lost. Now this subtype must be preserved in the case where the left
operand of the concatenation may be null, per the 4.5.3(5) subclause.
gcc/ada/ChangeLog:
PR ada/122160
* sem_res.adb (Resolve_Op_Concat_Rest): Do not build the subtype of
the second operand again if it has already been built.
(Resolve_String_Literal): Do not defer the creation of the subtype
for the right operand of a concatenation whose left operand may be
the null string.
There are cases where GNAT introduces a dependence on the secondary stack
in a build-in-place function with a result subtype that is definite, when
this dependence could be avoided. In particular this is done for record
types that requires finalization due to having a controlled component.
At one time such functions required the secondary stack in order to
properly handle cases where the function might raise an exception
(to avoid improper finalization in the caller), but that is no longer
necessary. We remove the dependence of these functions on the SS,
along with the BIPalloc formal and the generation of the big if_statement
that uses that formal.
An additional small change is to revise the condition for determining when
to generate SS mark/release within functions.
gcc/ada/ChangeLog:
* exp_ch6.ads (Make_Build_In_Place_Call_In_Allocator): Simplify comment.
* exp_ch6.adb (Make_Build_In_Place_Call_In_Allocator): Remove obsolete
comment about not being able to allocate fixed-size controlled results
on the caller side, and replace another obsolete comment with a simpler
comment. Call Build_Allocate_Deallocate_Proc when the function doesn't
need a BIPalloc formal to ensure that function results with controlled
parts allocated on the caller side will be chained for finalization.
(Make_Build_In_Place_Call_In_Object_Declaration): Call Needs_BIP_Collection
on the function's Entity_Id rather than the function call.
(Needs_BIP_Collection): If a BIP function doesn't need a BIPalloc formal
then it doesn't need a BIP collection either; return False in that case.
(Needs_BIP_Alloc_Form): Remove test of Needs_BIP_Collection.
* exp_ch7.adb (Expand_Cleanup_Actions): Move test of Uses_Sec_Stack
to be the first conjunct in setting of Needs_Sec_Stack_Mark, and put
the other tests in a disjunction subsidiary to that. Improve preceding
comment.
We should not mix "syntactic" and "semantic" for the same field
in different node kinds.
Change the name of Default_Expression (a syntactic field) on
N_Formal_Object_Declaration to be Expression. This avoids
the conflict with the name-named semantic field of
N_Parameter_Specification.
It is also more uniform with other syntactic categories that
use default_expression in the syntax rules. See, for example,
COMPONENT_DECLARATION in sinfo.ads, which is presumably intended
to be uniform with OBJECT_DECLARATION.
Fix the comment on N_Formal_Object_Declaration to refer
to the new field name Expression.
gcc/ada/ChangeLog:
* gen_il-gen-gen_nodes.adb: Rename Default_Expression to be
Expression.
* gen_il-gen.adb (Check_For_Syntactic_Field_Mismatch): Do not
exempt Default_Expression from the rule.
* par-ch12.adb (P_Formal_Object_Declarations): Use renamed setter.
* sem_ch12.adb (Default): Use renamed getter.
(Analyze_Formal_Object_Declaration): Likewise.
* sprint.adb (Sprint_Node_Actual): Use renamed getter.
* sinfo.ads: Fix comments.