[Bug fortran/84848] [8 Regression] FAIL: gfortran.dg/coarray/event_3.f08 -fcoarray=single -O2 -latomic execution test
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Mar 23 16:24:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84848
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org,
| |jakub at gcc dot gnu.org,
| |vehre at gcc dot gnu.org
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This sounds like UB (use of uninitialized var), though I know next to nothing
about type(event_type), but looking around I see various examples in Fortran
pdfs that use type(event_type) and never initialize it in any special way.
So, based on that the bug is likely in the -fcoarray=single support of
event_type that we fail to zero initialize the vars we create for it, or, if
some initialization is required from users, in the testcase.
In any case, on x86_64-linux with -fcoarray=single I see in the *.original
dump:
exchange ()
{
integer(kind=4) cnt;
(integer(kind=4)) x = (integer(kind=4)) x + 1;
(integer(kind=4)) x = (integer(kind=4)) x + 1;
cnt = (integer(kind=4)) x;
if (cnt != 2)
{
_gfortran_error_stop_numeric (1, 0);
}
L.1:;
(integer(kind=4)) x = (integer(kind=4)) x + -2;
}
(this is fine, it only uses the x from the parent function) and
global_event ()
{
static void exchange (void);
integer(kind=4) x;
exchange ();
}
As x is automatic variable and is not initialized, the x++ statements invoke
(from middle-end POV) UB by incrementing uninitialized variable.
More information about the Gcc-bugs
mailing list