public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/15851] New: pragma Volatile not respected for variables with default value
@ 2004-06-06 17:47 jc at apinc dot org
2004-10-12 4:06 ` [Bug ada/15851] " pinskia at gcc dot gnu dot org
2004-11-01 1:37 ` pinskia at gcc dot gnu dot org
0 siblings, 2 replies; 3+ messages in thread
From: jc at apinc dot org @ 2004-06-06 17:47 UTC (permalink / raw)
To: gcc-bugs
In the following code, there is no generated code for testing wether v1 is
really equals to v2, even with the pragma Volatile:
with Ada.Text_IO; use Ada.Text_IO;
procedure bug_volatile is
v1 : Integer := 0;
v2 : Integer := 0;
pragma Volatile (v1);
pragma Volatile (v2);
begin
if v1 = v2 then
Put_Line ("v1 = v2");
end if;
delay 1.0;
if v1 = v2 then
Put_Line ("v1 = v2");
end if;
end bug_volatile;
Neither the first nor the second test are made. I believe both test should be
made, since the values might have been modified by an external event (another
process, another task, hardware, ...) and this is why we made them "volatile".
An equivalent C code actually generates both tests.
GCC version:
Reading specs from /usr/lib/gcc/i486-linux/3.4.0/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,
objc,ada,treelang --prefix=/usr --libexecdir=/usr/lib
--with-gxx-include-dir=/usr/include/c++/3.4 --enable-shared --with-system-zlib
--enable-nls --enable-threads=posix --without-included-gettext
--program-suffix=-3.4 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk
--disable-werror i486-linux
Thread model: posix
gcc version 3.4.0 (Debian 20040516)
Program was compiled with:
gcc -S bug_volatile.adb
and
gcc -O2 -S bug_volatile.adb
Both commands don't generate code for the tests.
If I didn't give default value, oviously tests are made. However with a warning
during compilation about v1 and v2 never assigned a value. Again this might be
an incorrect warning since we explicitly made variables volatiles, so they *may*
be assigned a value by something else (well, probably giving a warning is
better).
Regards,
JC
--
Summary: pragma Volatile not respected for variables with default
value
Product: gcc
Version: 3.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jc at apinc dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i486-pc-linux-gnu
GCC host triplet: i486-pc-linux-gnu
GCC target triplet: i486-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15851
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug ada/15851] pragma Volatile not respected for variables with default value
2004-06-06 17:47 [Bug ada/15851] New: pragma Volatile not respected for variables with default value jc at apinc dot org
@ 2004-10-12 4:06 ` pinskia at gcc dot gnu dot org
2004-11-01 1:37 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-12 4:06 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15851
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug ada/15851] pragma Volatile not respected for variables with default value
2004-06-06 17:47 [Bug ada/15851] New: pragma Volatile not respected for variables with default value jc at apinc dot org
2004-10-12 4:06 ` [Bug ada/15851] " pinskia at gcc dot gnu dot org
@ 2004-11-01 1:37 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-01 1:37 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-11-01 01:37 -------
Confirmed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-11-01 01:37:55
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15851
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-11-01 1:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-06 17:47 [Bug ada/15851] New: pragma Volatile not respected for variables with default value jc at apinc dot org
2004-10-12 4:06 ` [Bug ada/15851] " pinskia at gcc dot gnu dot org
2004-11-01 1:37 ` pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).