diff options
author | Robert Dewar <dewar@adacore.com> | 2007-12-03 16:01:57 +0000 |
---|---|---|
committer | Samuel Tardieu <sam@gcc.gnu.org> | 2007-12-03 16:01:57 +0000 |
commit | 403fd9399629105bedd66ba49fad9c7dd6df4d29 (patch) | |
tree | e42c486df579d12939520a69045db49086f57887 /gcc/ada/sem_util.adb | |
parent | 69b3331e2ae2122a638e373bb858c2d9b1b94f3b (diff) | |
download | gcc-403fd9399629105bedd66ba49fad9c7dd6df4d29.zip gcc-403fd9399629105bedd66ba49fad9c7dd6df4d29.tar.gz gcc-403fd9399629105bedd66ba49fad9c7dd6df4d29.tar.bz2 |
re PR ada/34287 (Simple Ada bug [Barnes' Silly])
2007-12-03 Robert Dewar <dewar@adacore.com>
Samuel Tardieu <sam@rfc1149.net>
gcc/ada/
PR ada/34287
* sem_util.adb (Safe_To_Capture_Value): Do not capture values
of variables declared in a library-level package.
gcc/testsuite/gnat.dg/
PR ada/34287
* check_elaboration_code.adb: New test.
* bug_elaboration_code.ads, bug_elaboration_code.adb: New support
files.
Co-Authored-By: Samuel Tardieu <sam@rfc1149.net>
From-SVN: r130582
Diffstat (limited to 'gcc/ada/sem_util.adb')
-rw-r--r-- | gcc/ada/sem_util.adb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index a6c35d3..600a7bf 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -8583,12 +8583,16 @@ package body Sem_Util is -- Skip if volatile or aliased, since funny things might be going on in -- these cases which we cannot necessarily track. Also skip any variable - -- for which an address clause is given, or whose address is taken. + -- for which an address clause is given, or whose address is taken. Also + -- never capture value of library level variables (an attempt to do so + -- can occur in the case of package elaboration code). if Treat_As_Volatile (Ent) or else Is_Aliased (Ent) or else Present (Address_Clause (Ent)) or else Address_Taken (Ent) + or else (Is_Library_Level_Entity (Ent) + and then Ekind (Ent) = E_Variable) then return False; end if; |