This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/37835] New: -fno-automatic does not work for derived types with default initalizer
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Oct 2008 08:25:21 -0000
- Subject: [Bug fortran/37835] New: -fno-automatic does not work for derived types with default initalizer
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following program prints
- "2 42" with gfortran -fno-automatic
- "2 2" with NAG f95 -save and ifort -save
Expected: The SAVE is also implied for derived types with default initializer.
The problem is really the initializer as the dump shows:
static struct t myt = {.i=42}; <<<<<<< OK since SAVE
{
struct t t.1;
t.1.i = 42; <<<<<< OK if not SAVE
myt = t.1;
}
subroutine foo(n)
integer :: n
type t
integer :: i = 42
end type t
type(t) :: myt
if(n==1) myt%i = 2
print *, myt%i
end subroutine foo
call foo(1)
call foo(2)
end
--
Summary: -fno-automatic does not work for derived types with
default initalizer
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: burnus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37835