diff options
author | sam <sam@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-12-03 16:01:57 +0000 |
---|---|---|
committer | sam <sam@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-12-03 16:01:57 +0000 |
commit | b2a25df571038094efdd4d847090275122398f0e (patch) | |
tree | e42c486df579d12939520a69045db49086f57887 /gcc/ada/sem_util.adb | |
parent | 9657701b00cba41816454791967970d2417ce1e0 (diff) | |
download | gcc-b2a25df571038094efdd4d847090275122398f0e.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130582 138bc75d-0d04-0410-961f-82ee72b054a4
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 a6c35d3e9ef..600a7bf8818 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; |