2
0
mirror of git://gcc.gnu.org/git/gcc.git synced 2025-04-09 19:11:14 +08:00

decl.c (gnat_to_gnu_entity): Even when they are never assigned...

* gcc-interface/decl.c (gnat_to_gnu_entity): Even when they
        are never assigned, volatile entities are not constant for code
        generation purposes.

        * gnat.dg/volatile3.adb: New test.

From-SVN: r140545
This commit is contained in:
Olivier Hainque 2008-09-22 10:29:29 +00:00 committed by Olivier Hainque
parent 5e038cad0b
commit 22868cbf56
4 changed files with 27 additions and 0 deletions
gcc
ada
ChangeLog
gcc-interface
testsuite

@ -1,3 +1,9 @@
2008-09-22 Olivier Hainque <hainque@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity): Even when they
are never assigned, volatile entities are not constant for code
generation purposes.
2008-09-21 Laurent Guerby <laurent@guerby.net>
PR ada/5911

@ -548,6 +548,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
bool const_flag
= ((kind == E_Constant || kind == E_Variable)
&& Is_True_Constant (gnat_entity)
&& !Treat_As_Volatile (gnat_entity)
&& (((Nkind (Declaration_Node (gnat_entity))
== N_Object_Declaration)
&& Present (Expression (Declaration_Node (gnat_entity))))

@ -1,3 +1,7 @@
2008-09-22 Olivier Hainque <hainque@adacore.com>
* gnat.dg/volatile3.adb: New test.
2008-09-22 Ira Rosen <irar@il.ibm.com>
PR tree-optimization/37482

@ -0,0 +1,16 @@
-- { dg-do compile }
-- { dg-options "-O2" }
procedure volatile3 is
v1 : Integer := 0;
v2 : Integer := 0;
pragma Volatile (v1);
pragma Volatile (v2);
begin
if v1 /= v2 then
raise Program_Error;
end if;
end;
-- { dg-final { scan-assembler "__gnat_rcheck" } }