diff options
author | Bob Duff <duff@adacore.com> | 2018-05-23 10:21:53 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2018-05-23 10:21:53 +0000 |
commit | 326776548e5959daf62f8583ee2356f2352452fc (patch) | |
tree | 6cc0ad0f60d5fe93ba5f79ae3bd4fc3e32ea5141 /gcc/ada/freeze.adb | |
parent | 95872381f0e22ef13e95788e7000ae2623ed03cd (diff) | |
download | gcc-326776548e5959daf62f8583ee2356f2352452fc.zip gcc-326776548e5959daf62f8583ee2356f2352452fc.tar.gz gcc-326776548e5959daf62f8583ee2356f2352452fc.tar.bz2 |
[Ada] Build-in-place aggregates and Address clauses
This patch fixes a bug in which if a limited volatile variable with
an Address aspect is initialized with a build-in-place aggregate
containing build-in-place function calls, the compiler can crash.
2018-05-23 Bob Duff <duff@adacore.com>
gcc/ada/
* freeze.adb: (Check_Address_Clause): Deal with build-in-place
aggregates in addition to build-in-place calls.
gcc/testsuite/
* gnat.dg/addr10.adb: New testcase.
From-SVN: r260574
Diffstat (limited to 'gcc/ada/freeze.adb')
-rw-r--r-- | gcc/ada/freeze.adb | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index 66f9dcc..032dcf51 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -710,13 +710,12 @@ package body Freeze is end; end if; - -- Remove side effects from initial expression, except in the case - -- of a build-in-place call, which has its own later expansion. + -- Remove side effects from initial expression, except in the case of + -- limited build-in-place calls and aggregates, which have their own + -- expansion elsewhere. This exception is necessary to avoid copying + -- limited objects. - if Present (Init) - and then (Nkind (Init) /= N_Function_Call - or else not Is_Expanded_Build_In_Place_Call (Init)) - then + if Present (Init) and then not Is_Limited_View (Typ) then -- Capture initialization value at point of declaration, and make -- explicit assignment legal, because object may be a constant. @@ -735,7 +734,7 @@ package body Freeze is Set_No_Initialization (Decl); - -- If the objet is tagged, check whether the tag must be + -- If the object is tagged, check whether the tag must be -- reassigned explicitly. Tag_Assign := Make_Tag_Assignment (Decl); |