aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
AgeCommit message (Collapse)AuthorFilesLines
2025-06-05ada: Implement built-in-place expansion of two-pass array aggregatesEric Botcazou5-216/+324
These are array aggregates containing only component associations that are iterated with iterator specifications, as per RM 4.3.3(20.2/5-20.4/5). It is implemented for the array aggregates that are used to initialize an object, as specified by RM 7.6(17.2/3-17.3/3) for immutably limited types and types that need finalization, but for all types like other aggregates. gcc/ada/ChangeLog: * exp_aggr.adb (Build_Two_Pass_Aggr_Code): New function containing most of the code initially present in Two_Pass_Aggregate_Expansion. (Two_Pass_Aggregate_Expansion): Remove redundant N parameter. Implement built-in-place expansion for (static) object declarations and allocators, using Build_Two_Pass_Aggr_Code for the main work. (Expand_Array_Aggregate): Adjust Two_Pass_Aggregate_Expansion call. Replace Etype (N) by Typ in a couple of places. * exp_ch3.adb (Expand_Freeze_Array_Type): Remove special case for two-pass array aggregates. (Expand_N_Object_Declaration): Do not adjust the object when it is initialized by a two-pass array aggregate. * exp_ch4.adb (Expand_Allocator_Expression): Apply the processing used for container aggregates to two-pass array aggregates. * exp_ch6.adb (Validate_Subprogram_Calls): Skip calls present in initialization expressions of N_Object_Declaration nodes that have No_Initialization set. * sem_ch3.adb (Analyze_Object_Declaration): Detect the cases of an array originally initialized by an aggregate consistently.
2025-06-05ada: Add missing Ghost aspect to Lemma_Not_In_Range_Big2xx32 in s-arit32.adbJohannes Kliemann1-0/+1
gcc/ada/ChangeLog: * libgnat/s-arit32.adb (Lemma_Not_In_Range_Big2xx32): Add missing Ghost aspect.
2025-06-05ada: Fix reproducer generationRonan Desplanques1-24/+26
This patch fixes reproducer generation in the case of crashes in the back end in the presence of preprocessing dependencies. gcc/ada/ChangeLog: * generate_minimal_reproducer.adb (Generate_Minimal_Reproducer): Fix handling of preprocessing dependencies.
2025-06-05ada: Reject Valid_Value arguments originating from StandardViljar Indus4-9/+10
The constraint for Valid_Value not applying to types from Standard should also apply to all types derived from those types. gcc/ada/ChangeLog: * doc/gnat_rm/implementation_defined_attributes.rst: Update the documentation for Valid_Value. * sem_attr.adb (Analyze_Attribute): Reject types where the root type originates from Standard. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2025-06-05ada: Error about assignment to limited target on aggregate with "for of" ↵Gary Dismukes1-1/+1
iterator The compiler reports a spurious error about an assignment to a limited object on an aggregate of a array type with limited components that has an association with a "for of" iterator. This is fixed by arranging to have the Assignment_OK flag set on the indexed_names generated by the expander for initializing the aggregate object. gcc/ada/ChangeLog: * exp_aggr.adb (Two_Pass_Aggregate_Expansion): Change call to Make_Assignment for the indexed aggregate object to call Change_Make_OK_Assignment instead.
2025-06-05ada: Add error message for a declared-too-late abstract state constituentSteve Baird1-23/+56
In the error case of an undefined abstract state constituent, we want to help users distinguish between the case where the constituent is "really" undefined versus being defined "too late" (i.e., after a body). So in the latter case we generate an additional message. gcc/ada/ChangeLog: * sem_prag.adb (Analyze_Constituent): In the specific case case of a defined-too-late abstract state constituent, generate an additional error message.
2025-06-05ada: Fix various issues in the SARIF reportViljar Indus3-6/+28
gcc/ada/ChangeLog: * diagnostics-sarif_emitter.adb (Print_Invocations): fix commandLine and executionSuccessful nodes. Fix typo in the name for startLine. * osint.adb (Modified Get_Current_Dir) Fix generation of the current directory. (Relative_Path): Avoid relative paths starting with a path separator. * osint.ads: Update the documentation for Relative_Path.
2025-06-05ada: Fix unnecessarily large allocation in New_StringRonan Desplanques1-11/+24
This patches fixes an issue where Interfaces.C.Strings.New_String allocates more memory than necessary when passed a string that contains a NUL character. gcc/ada/ChangeLog: * libgnat/i-cstrin.adb (New_String): Fix size of allocation.
2025-06-05ada: Implement use implies with experimental extensionsquirek6-37/+77
The patch implements the experimental feature to allow use package clauses within the context area to imply with. gcc/ada/ChangeLog: * sem_ch8.adb (Analyze_Package_Name): Add code to expand use clauses such that they have an implicit with associated with them when extensions are enabled. * sem_ch10.ads (Analyze_With_Clause): New. * sem_ch10.adb (Analyze_With_Clause): Add comes from source check for warning. (Expand_With_Clause): Moved to the spec. * sem_util.adb, sem_util.ads (Is_In_Context_Clause): Moved from sem_prag. * sem_prag.adb (Analyze_Pragma): Update calls to Is_In_Context_Clause. (Is_In_Context_Clause): Moved to sem_util.
2025-06-05ada: Extend and clarify documentation of stack size settings for WindowsPiotr Trojanek4-18/+20
The original documentation for more recent versions of Windows didn't specify whether the specified stack size acts as a "reserved" or "committed" stack size. Also, clarify the wording for older versions of Windows. gcc/ada/ChangeLog: * doc/gnat_ugn/platform_specific_information.rst (Setting Stack Size from gnatlink): Improve documentation. * gnat-style.texi: Regenerate. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2025-06-05ada: Spurious accessibility error with -gnatcsquirek3-3/+8
The patch fixes an issue in the compiler whereby a spurious accessibility error gets generated in semantic checking mode (-gnatc) when an explicitly aliased formal gets used as an actual for an access disriminant in a return object. gcc/ada/ChangeLog: * accessibility.adb (Check_Return_Construct_Accessibility): Disable check generation when we are only checking semantics. * opt.ads: Add new flag for -gnatc mode * switch-c.adb (Scan_Front_End_Switches): Set flag for -gnatc mode
2025-06-05ada: Mark the types of operator arguments as usedViljar Indus1-0/+5
When a use type clause is used then it makes the type and all of its operators use visible in the context. When analyzing whether a use type clause is effective we should additionally mark the types of an overloaded operator as cases where the use type clause is effective. gcc/ada/ChangeLog: * sem_ch8.adb (Mark_Use_Type): Additionally mark the types of the parameters and return values as used when analyzing an operator.
2025-06-05ada: Fix couple of remaining incompatibilities with CHERI architectureEric Botcazou2-16/+21
These are the usual problematic patterns in the expanded code. gcc/ada/ChangeLog: * exp_ch9.adb (Build_Dispatching_Requeue): Take 'Tag of the concurrent object instead of doing an unchecked conversion. * exp_pakd.adb (Expand_Packed_Address_Reference): Perform address arithmetic using an operator of System.Storage_Elements.
2025-06-05ada: Fix buffer overflow for function call returning discriminated limited ↵Eric Botcazou2-85/+33
record This occurs when the discriminated limited record type is declared with default values for its discriminants, is not controlled, and the context of the call is anonymous, i.e. the result of the call is not assigned to an object. In this case, a temporary is created to hold the result of the call, with the default values of the discriminants, but the result may have different values for the discriminants and, in particular, may be larger than the temporary, which leads to a buffer overflow. This problem does not occur when the context is an object declaration, so the fix just makes sure that the expansion in an anonymous context always uses the model of an object declaration. It requires a minor tweak to the helper function Entity_Of of the Sem_Util package. gcc/ada/ChangeLog: * exp_ch6.adb (Expand_Actuals): Remove obsolete comment. (Make_Build_In_Place_Call_In_Anonymous_Context): Always use a proper object declaration initialized with the function call in the cases where a temporary is needed, with Assignment_OK set on it. * sem_util.adb (Entity_Of): Deal with rewritten function call first.
2025-06-05ada: Fix New_Char_Array with empty arraysRonan Desplanques1-27/+35
This patch fixes an integer underflow issue on calls of the form New_Char_Array (X) with X'Last < X'First - 2. That integer underflow caused attempts at allocating impossibly large amount of memory in some cases. gcc/ada/ChangeLog: * libgnat/i-cstrin.adb (Position_Of_Nul): Change specification and adjust body accordingly. (New_Char_Array): Fix size of allocation. (To_Chars_Ptr): Adapt to Position_Of_Nul change.
2025-06-05ada: Fix adareducer oracle generationRonan Desplanques1-1/+2
This patch adds a missing "-quiet" switch to the compiler invocations performed by generated oracles. Without that switch, log lines could be present before bug boxes for crashes in gigi and that caused the crash detection logic to fail. gcc/ada/ChangeLog: * generate_minimal_reproducer.adb (Generate_Minimal_Reproducer): Fix oracle generation.
2025-06-05ada: Fix Generate_Minimal_Reproducer on instantiationsRonan Desplanques1-8/+33
Before this patch, the code that creates a copy of the semantic closure with the default naming convention was incorrect when the compiler was processing a library unit that was an instantiation of a generic with a body. This patch adds code to detect that situation and adjusts the copying process accordingly. gcc/ada/ChangeLog: * generate_minimal_reproducer.adb (Generate_Minimal_Reproducer): Fix when main library item is an instantiation.
2025-06-05ada: Fix compile-time failure due to duplicated attribute subprograms.Steve Baird1-15/+24
For a given type, and for certain attributes (the 4 streaming attributes and, for Ada2022, the Put_Image attribute), the compiler needs to keep track of whether a subprogram has already been generated for the given type/attribute pair. In some cases this was being done incorrectly; the compiler ended up generating duplicate subprograms (with the same name), resulting in compilation failures. This could occur if the prefix of an attribute reference denoted a subtype (more precisely, a non-first subtype). This includes the case of a subtype declaration that is implicitly introduced by the compiler to capture the binding between a formal type in a generic and the corresponding actual type in an instantiation. gcc/ada/ChangeLog: * exp_attr.adb (Expand_N_Attribute_Reference): When accessing the maps declared in package Cached_Attribute_Ops, the key value passed to Get or to Set should never be the entity node for a subtype. Use the entity of the corresponding type declaration instead.
2025-06-05ada: Mark constants inside a declare expression as referencedViljar Indus1-0/+1
Expressions within a declare expression were simply bound to locally defined constants. However they were never marked as referenced. This would trigger an unreferenced constant warning if -gnatwu was used. gcc/ada/ChangeLog: * sem_res.adb (Resolve_Declare_Expression): Mark used local variables inside a declare expression as referenced.
2025-06-05ada: Cleanup preanalysis of static expressions (part 6)Javier Miranda12-124/+155
Rename Preanalyze_Spec_Expression as Preanalyze_And_Resolve_Spec_Expression, Preanalyze_Assert_Expression as Preanalyze_And_Resolve_Assert_Expression, and Preanalyze_Default_Expression as Preanalyze_And_Resolve_Default_Expression; cleanup the version of Preanalyze_Assert_Expression without context type. gcc/ada/ChangeLog: * sem.ads: Update reference to renamed subprogram in documentation. * sem_ch3.ads (Preanalyze_Assert_Expression): Renamed. (Preanalyze_Spec_Expression): Renamed. * sem_ch3.adb (Preanalyze_Assert_Expression): Renamed and code cleanup. (Preanalyze_Spec_Expression): Renamed. (Preanalyze_Default_Expression): Renamed. * contracts.adb: Update calls to renamed subprograms. * exp_pakd.adb: Ditto. * exp_util.adb: Ditto. * freeze.adb: Ditto. * sem_ch12.adb: Ditto. * sem_ch13.adb: Ditto. * sem_ch6.adb: Ditto. * sem_prag.adb: Ditto. * sem_res.adb (Preanalyze_And_Resolve): Add to the version without context type the special handling for GNATprove mode provided by the version with context type; required to cleanup the body of Preanalyze_Assert_Expression.
2025-06-05ada: Spurious accessibility error with -gnatcsquirek1-0/+7
The patch fixes an issue in the compiler whereby a spurious accessibility error gets generated in semantic checking mode (-gnatc) when an explicitly aliased formal gets used as an actual for an access disriminant in a return object. gcc/ada/ChangeLog: * accessibility.adb (Check_Return_Construct_Accessibility): Disable check generation when we are only checking semantics.
2025-06-05ada: Use absolute paths in SARIF reportsViljar Indus7-86/+460
gcc/ada/ChangeLog: * diagnostics-json_utils.adb: Add new method To_File_Uri to convert any path to the URI standard. * diagnostics-json_utils.ads: Likewise. * diagnostics-sarif_emitter.adb: Converted Artifact_Change types to use the Source_File_Index instead of the file name to store the source file. Removed the body from Destroy (Elem : in out Artifact_Change) since it no longer contained elements with dynamic memory. Updated the implementation of Equals (L, R : Artifact_Change) to take into account the changes for Artifact_Change. Print_Artifact_Location: Use the Source_File_Index as an input argument. Now prints the uriBaseId attribute and a relative path from the uriBaseId to the file in question as the value of the uri attribute. New method Print_Original_Uri_Base_Ids to print the originalUriBaseIds node. Print_Run no prints the originalUriBaseIds node. Use constants instead of strings for all the SARIF attributes. * osint.adb: Add new method Relative_Path to calculate the relative path from a base directory. Add new method Root to calculate the root of each directory. Add new method Get_Current_Dir to get the current working directory for the execution environment. * osint.ads: Likewise. * clean.adb: Use full names for calls to Get_Current_Dir. * gnatls.adb: Likewise.
2025-06-05ada: Avoid calling Resolve with Stand.Any_Fixed as the expected typeSteve Baird1-0/+2
When we call Resolve for an expression, we pass in the expected type for that expression. In the absence of semantic errors, that expected type should never be any of the "Any_xxx" types declared in stand.ads (e.g., Any_Array, Any_Numeric, Any_Real). In particular, it should never be Any_Fixed. Fix a case in which this rule was being violated. gcc/ada/ChangeLog: * sem_res.adb (Set_Mixed_Mode_Operand): If we are about to call Resolve passing in Any_Fixed as the expected type, then instead pass in the fixed point type of the other operand (i.e., B_Typ).
2025-06-05ada: Compiler crash on array aggregate association iterating over function ↵Gary Dismukes1-29/+86
result The compiler triggers a bug box when compiling an array aggregate with an iterated_component_association that iterates over another array object, failing when trying to retrieve a Choices field, which isn't an allowed field for N_Iterated_Component_Association nodes. This occurs in procedure Check_Function_Writable_Actuals, which wasn't accounting for the iterated association forms. gcc/ada/ChangeLog: * sem_util.adb (Check_Function_Writable_Actuals): Add handling for N_Iterated_Component_Association and N_Iterated_Element_Association. Fix a typo in an RM reference (6.4.1(20/3) => 6.4.1(6.20/3)). (Collect_Expression_Ids): New procedure factoring code for collecting identifiers from expressions of aggregate associations. (Handle_Association_Choices): New procedure factoring code for handling id collection for expressions of aggregate associations with multiple choices. Removed redundant test of Box_Present from original code.
2025-05-25Daily bump.GCC Administrator1-0/+4
2025-05-24Ada: move ACATS 2.6 testsuite to acats-2 directoryEric Botcazou1-1/+1
This is in preparation for the installation of the ACATS 4.2 testsuite. gcc/ada/ * gcc-interface/Make-lang.in (ACATSDIR): Use acats-2 directory. gcc/testsuite/ * ada/acats/*: Rename into ada/acats-2/*. * ada/acats-2/run_all.sh: Adjust to above renaming. * ada/acats-2/support/impdefc.a: New file.
2025-05-14Daily bump.GCC Administrator1-0/+6
2025-05-13Remove -q quiet option from some GNAT bootstrap command linesNicolas Boulenguez2-3/+3
gcc/ada/ PR ada/87778 * Make-generated.in: Remove -q gnatmake option. * gcc-interface/Makefile.in: Likewise.
2025-05-06Daily bump.GCC Administrator1-0/+6
2025-05-05Ada: Fix assertion failure on Finalizable aspect for tagged record typeEric Botcazou1-11/+19
This is a (benign) assertion failure on the mainline for the new Finalizable aspect put on a tagged record type when not all the primitives are declared. This compiles and runs on the 15 branch because assertions are disabled. gcc/ada/ PR ada/120104 * exp_ch3.adb (Expand_Freeze_Record_Type): For a controlled tagged type, freeze only the controlled primitives that are present. gcc/testsuite/ * gnat.dg/specs/finalizable1.ads: New test.
2025-05-01Daily bump.GCC Administrator1-0/+12
2025-04-30Fix GNAT build failure for x86/FreeBSDEric Botcazou2-0/+173
gcc/ada/ PR ada/112958 * Makefile.rtl (LIBGNAT_TARGET_PAIRS) [x86 FreeBSD]: Add specific version of s-dorepr.adb. * libgnat/s-dorepr__freebsd.adb: New file.
2025-04-30Fix compilation failure on FreeBSDEric Botcazou1-1/+1
[changelog] PR ada/112958 * init.c (__gnat_error_handler) [__FreeBSD__]: Fix typo.
2025-04-28Daily bump.GCC Administrator1-0/+6
2025-04-27Drop targetm.promote_prototypes from C, C++ and Ada frontendsH.J. Lu1-24/+0
Remove the targetm.calls.promote_prototypes call from C, C++ and Ada frontends. gcc/ PR c/48274 PR middle-end/112877 PR middle-end/118288 * gimple.cc (gimple_builtin_call_types_compatible_p): Remove the targetm.calls.promote_prototypes call. * tree.cc (tree_builtin_call_types_compatible_p): Likewise. gcc/ada/ PR middle-end/112877 * gcc-interface/utils.cc (create_param_decl): Remove the targetm.calls.promote_prototypes call. gcc/c/ PR c/48274 PR middle-end/112877 PR middle-end/118288 * c-decl.cc (start_decl): Remove the targetm.calls.promote_prototypes call. (store_parm_decls_oldstyle): Likewise. (finish_function): Likewise. * c-typeck.cc (convert_argument): Likewise. (c_safe_arg_type_equiv_p): Likewise. gcc/cp/ PR middle-end/112877 * call.cc (type_passed_as): Remove the targetm.calls.promote_prototypes call. (convert_for_arg_passing): Likewise. * typeck.cc (cxx_safe_arg_type_equiv_p): Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-04-18Daily bump.GCC Administrator1-0/+4
2025-04-17ada: bump Library_Version to 16.Jakub Jelinek1-1/+1
gcc/ada/ChangeLog: * gnatvsn.ads: Bump Library_Version to 16.
2025-04-13Daily bump.GCC Administrator1-0/+6
2025-04-12Ada: Natural/Positive not ignored in subprogram renamingEric Botcazou1-1/+2
The language says that the profile of a subprogram renaming-as-declaration must be mode conformant with that of the renamed subprogram, and that the parameter subtypes are taken from the renamed subprogram. GNAT implements the rule, except when Natural and Positive are involved, which may lead to the wrong conclusion that it does not. gcc/ada/ PR ada/119643 * sem_ch8.adb (Inherit_Renamed_Profile): Add guard against the peculiarities of Natural and Positive. gcc/testsuite/ * gnat.dg/renaming17.adb: New test.
2025-04-08Daily bump.GCC Administrator1-0/+9
2025-04-07Ada: Fix wrong 'Access to aliased constrained array of controlled typeEric Botcazou2-6/+22
For technical reasons, the recently reimplemented finalization machinery for controlled types requires arrays of controlled types to be allocated with their bounds, including in the case where their nominal subtype is constrained. However, in this case, the type of 'Access for the arrays is pointer-to-constrained-array and, therefore, its value must designate the array itself and not the bounds. gcc/ada/ * gcc-interface/utils.cc (convert) <POINTER_TYPE>: Use fold_convert to convert between thin pointers. If the source is a thin pointer with zero offset from the base and the target is a pointer to its array, displace the pointer after converting it. * gcc-interface/utils2.cc (build_unary_op) <ATTR_ADDR_EXPR>: Use fold_convert to convert the address before displacing it.
2025-04-05Daily bump.GCC Administrator1-0/+12
2025-04-04Ada: Fix thinko in Eigensystem for complex Hermitian matricesEric Botcazou2-61/+66
The implementation solves the eigensystem for a NxN complex Hermitian matrix by first solving it for a 2Nx2N real symmetric matrix and then interpreting the 2Nx1 real vectors as Nx1 complex ones, but the last step does not work. The patch fixes the last step and also performs a small cleanup throughout the implementation, mostly in the commentary and without functional changes. gcc/ada/ * libgnat/a-ngcoar.adb (Eigensystem): Adjust notation and fix the layout of the real symmetric matrix in the main comment. Adjust the layout of the associated code accordingly and correctly turn the 2Nx1 real vectors into Nx1 complex ones. (Eigenvalues): Minor similar tweaks. * libgnat/a-ngrear.adb (Jacobi): Minor tweaks in the main comment. Adjust notation and corresponding parameter names of functions. Fix call to Unit_Matrix routine. Adjust the comment describing the various kinds of iterations to match the implementation.
2025-03-28Daily bump.GCC Administrator1-0/+5
2025-03-27Ada: Fix too late initialization of tasking runtime with standalone libraryEric Botcazou1-2/+4
The Tasking_Runtime_Initialize routine installs the tasking version of the RTS_Lock manipulation routines and thus needs to be called very early before the elaboration of all the Ada units of the program, including those of the runtime itself. This is guaranteed by the binder when the tasking runtime is explicitly dragged into the link. However, for a standalone dynamic library that does not depend on the tasking runtime and is auto-initialized, no such guarantee holds, even though the library might be later dragged into a link that contains the tasking runtime. This change causes the routine to be called even earlier, in particular at load time when a (standalone) dynamic library is involved in the link, so as to meet the requirements. It will cause the routine to be called twice if the main subprogram is generated by the binder, but this is harmless since the routine is idempotent. ada/ * libgnarl/s-tasini.adb (Tasking_Runtime_Initialize): Add pragma Linker_Constructor for the procedure.
2025-03-26Daily bump.GCC Administrator1-0/+22
2025-03-25Add support of --enable-host-pie to the native Ada compilerEric Botcazou2-39/+60
gcc/ada/ PR ada/119440 * gcc-interface/Make-lang.in (GCC_LINK): Filter out -pie in stage 1 (GCC_LLINK): Likewise. * gcc-interface/Makefile.in (COMPILER): Delete and replace by CC. (COMPILER_FLAGS): Delete. (ALL_COMPILERFLAGS): Delete and replace by ALL_CFLAGS. (ALL_ADAFLAGS): Move around. (enable_host_pie): New substituted variable. (LD_PICFLAG): Likewise. Do not add it to TOOLS_LIBS. (LIBIBERTY): Test enable_host_pie. (LIBGNAT): Likewise and use libgnat_pic.a if yes. (TOOLS_FLAGS_TO_PASS): Pass $(PICFLAG) under CFLAGS & $(LD_PICFLAG) under LDFLAGS. Also pass through ADA_CFLAGS. (common-tools): Add $(ALL_CFLAGS) $(ADA_CFLAGS) to the --GCC string of $(GNATLINK) commands. (../../gnatdll$(exeext)): Likewise. (gnatmake-re): Likewise. (gnatlink-re): Likewise. (gnatlib-shared-dual): Remove all the object files at the end. gnattools/ PR ada/119440 * configure.ac (host-pie): New switch. (host-bind-now): Likewise. Substitute PICFLAG and LD_PICFLAG. * configure: Regenerate. * Makefile.in (PICFLAG): New substituted variable. (LD_PICFLAG): Likewise. (TOOLS_FLAGS_TO_PASS): Pass $(PICFLAG) under CFLAGS & $(LD_PICFLAG) under LDFLAGS. Do not pass -I- under ADA_INCLUDES. (TOOLS_FLAGS_TO_PASS_RE): Likewise.
2025-03-20Daily bump.GCC Administrator1-0/+18
2025-03-19Fix formatting of version message for gnat driverEric Botcazou1-3/+4
Like the main driver (as well as gccgo, gccrs, gcov, etc) the gnat driver prints the standard version message in response to the --version switch, but it is not properly formatted. gcc/ada * gnatvsn.adb (Gnat_Free_Software): Fix message formatting.
2025-03-19Fix misoptimization at -O2 in LTO modeEric Botcazou1-0/+8
This is a regression in recent releases. The problem is that the IPA mod/ref pass looks through the (nominal) type of a pointer-to-discriminated-type parameter in a call to a subprogram in order to see the (actual) type used for the dereferences of the parameter in the callee, which is a pointer-to-constrained-subtype. Historically the discriminated type is marked with the may_alias attribute because of the symmetric effect for the argument in the caller, so we mark the constrained subtype with the attribute now for the sake of the callee. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Record_Subtype>: Set the may_alias attribute if a specific GCC type is built.