This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

trouble with -fstrict-aliasing


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]