This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
trouble with -fstrict-aliasing
- From: "Janus Weil" <jaydub66 at googlemail dot com>
- To: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>
- Date: Fri, 4 Jan 2008 22:22:29 +0100
- Subject: trouble with -fstrict-aliasing
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=pgbJh5/x0zT5CLzpQBtBKM7aqCTQX/PNwrsDrnylvDc=; b=DxuW3R6bzsU2H31IDmeWFdt5IjXNr0XGnnVfCEiMDWZBCB3zBPfPxHgncN8kB7W6v7WI/aokoT8xItV1abWHvWjSepAi+ec3VfCaFRwyr0zGYUlxTKZhtCk1E2FDm1Fb4+DCEBIB+PvyGUEVjOSXltREmcSm+aa2j18Q21rl6tA=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=V6MxUOl+qmmgJyNTNRW0DmGWpseGpzuo0hVHP8oSAZF5P1v/nSwFMN6Yib73RmX/n4HcWUELJPmV/aGzBoltub6l0V2CB1KeQ+6pUGrX0SdyodcMWGIbP9OJ7KWDq9Y3ATNJYUcRqDZRWHrOYECzocFtG0NHSMNsZcc+n9hrnwM=
Hi folks,
I have some compile-time & memory-consumption issues here, when using
the -fstrict-aliasing flag. What I'm doing is compile some 2000-line
f90 file (which is actually part of a bigger program, and I haven't
managed to produce a standalone test case yet), using a recent gcc
trunk build. The problem is that with the higher optimization flags
(-O2/-O3) compilation time really explodes:
-O0: ~ 6 sec
-O1: ~ 13 sec
-O2: ~ 3 min (!)
-O3: ~ 5 min (!)
This is just no way reasonable for a single 2k-lines file, is it? I
have compiled the same file before (with older gcc builds) without
problems, so this problem must have been introduced recently
(nov/dec?).
It seems like one of the -O2 optimizations is to blame. So I looked a
little closer, and found that -fstrict-aliasing seems to be the bad
guy:
-O1 -fstrict-aliasing: ~ 2 min
-O2 -fno-strict-aliasing: ~ 22 sec
-O3 -fno-strict-aliasing: ~ 30 sec
As long as I avoid -fstrict-aliasing everything is fine, but when I
enable it, compilation becomes really sluggish. And also memory
consumption seems to rise sharply. On an old machine with just 256MB
of memory, compilation with -O3 fails due to lack of memory.
I have trouble isolating a test case because I don't really know what
-fstrict-aliasing does, in particular I'm not sure what kind of
fortran code is affected by this option. In the manual there were only
C examples, but it seems like it only affects pointers, and I'm pretty
sure that there are no pointers used in my source file.
Can anyone give me a hint on what direction to look in, and what kind
of fortran code could be affected by -fstrict-aliasing?
Cheers,
Janus