This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/57906] New: Coarray components: Assignment optimized away (gfortran.dg/coarray/lib_realloc_1.f90)
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 16 Jul 2013 10:30:44 +0000
- Subject: [Bug fortran/57906] New: Coarray components: Assignment optimized away (gfortran.dg/coarray/lib_realloc_1.f90)
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57906
Bug ID: 57906
Summary: Coarray components: Assignment optimized away
(gfortran.dg/coarray/lib_realloc_1.f90)
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
gfortran.dg/coarray/lib_realloc_1.f90 (r200955) fails if compiled with
optimization. It has:
type t
integer, allocatable :: CAF[:]
end type t
...
x = y
which gives with -O0 the dump:
D.1903 = x;
x = y;
x.caf = D.1903.caf;
Namely: The fields of the struct "x" are updated from "y" - but the "caf" field
is re-set to the previous value of x.
(Reason: The x.caf.data is a pointer, whose previous address has to be kept.
That's a special feature of coarray components.)
With optimization, the "x.caf = D.1903.caf" line is effectively lost - such
that x.caf.data and y.caf.data point to the same memory.