This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/41335] VOLATILE in Fortran does not take effect
- From: "kargl at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Sep 2009 18:18:34 -0000
- Subject: [Bug libfortran/41335] VOLATILE in Fortran does not take effect
- References: <bug-41335-18178@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #5 from kargl at gcc dot gnu dot org 2009-09-11 18:18 -------
(In reply to comment #4)
> I tested "real, volatile" and "double precision, volatile" with fixed form and
> free form and "real*" works, "double*" - not.
>
> So it is not a question of a source form now, but rather why "double precision,
> volatile :: a" ignores volatile attribute?
>
Can you define what you mean by works? The intermediate code that
-fdump-tree-original produces is identical for the REAL(4) and REAL(8)
with the obvious difference of the kind type parameter.
program VolatileTest
double precision, volatile :: a
double precision :: uA, uB, b, c
real, volatile :: ra
real :: ruA, ruB, rb, rc
read(*,*) uA, uB, ruA, ruB
a = uA * uA
b = uB * uB
c = a - b
ra = ruA * ruA
rb = ruB * ruB
rc = ra - rb
print *, c, rb
end program VolatileTest
gives
volatiletest ()
{
volatile real(kind=8) a;
real(kind=8) b;
real(kind=8) c;
volatile real(kind=4) ra;
real(kind=4) rb;
real(kind=4) rc;
real(kind=4) rua;
real(kind=4) rub;
real(kind=8) ua;
real(kind=8) ub;
{
struct __st_parameter_dt dt_parm.0;
dt_parm.0.common.filename = &"dd.f90"[1]{lb: 1 sz: 1};
dt_parm.0.common.line = 6;
dt_parm.0.common.flags = 128;
dt_parm.0.common.unit = 5;
_gfortran_st_read (&dt_parm.0);
_gfortran_transfer_real (&dt_parm.0, &ua, 8);
_gfortran_transfer_real (&dt_parm.0, &ub, 8);
_gfortran_transfer_real (&dt_parm.0, &rua, 4);
_gfortran_transfer_real (&dt_parm.0, &rub, 4);
_gfortran_st_read_done (&dt_parm.0);
}
a = (volatile real(kind=8)) (ua * ua);
b = (real(kind=8)) (ub * ub);
c = (real(kind=8)) (a - b);
ra = (volatile real(kind=4)) (rua * rua);
rb = (real(kind=4)) (rub * rub);
rc = (real(kind=4)) (ra - rb);
{
struct __st_parameter_dt dt_parm.1;
dt_parm.1.common.filename = &"dd.f90"[1]{lb: 1 sz: 1};
dt_parm.1.common.line = 13;
dt_parm.1.common.flags = 128;
dt_parm.1.common.unit = 6;
_gfortran_st_write (&dt_parm.1);
_gfortran_transfer_real (&dt_parm.1, &c, 8);
_gfortran_transfer_real (&dt_parm.1, &rb, 4);
_gfortran_st_write_done (&dt_parm.1);
}
}
main (integer(kind=4) argc, character(kind=1) * * argv)
{
static integer(kind=4) options.2[8] = {68, 255, 0, 0, 0, 1, 0, 1};
_gfortran_set_args (argc, argv);
_gfortran_set_options (8, &options.2[0]);
volatiletest ();
return 0;
}
--
kargl at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41335