This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/26682] New: gfortran fails with -fwhole-program optimization
- From: "jjcogliati-r1 at yahoo dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Mar 2006 15:16:59 -0000
- Subject: [Bug fortran/26682] New: gfortran fails with -fwhole-program optimization
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following simple.f90 program:
PROGRAM hello_world
PRINT *,"Hello, World!"
END PROGRAM hello_world
does not compile with the following arguments:
gfortran -fwhole-program -O2 -o simple simple.f90
~/gcc_install/lib/gcc/i686-pc-linux-gnu/4.1.0/../../../libgfortranbegin.a(fmain.o)(.text+0x23):
In function `main':
../../../gcc-4.1.0/libgfortran/fmain.c:18: undefined reference to `MAIN__'
collect2: ld returned 1 exit status
The program compiles fine with just -O2 or -fwhole-program and prints out the
expected Hello, World!
I think the problem roughly is that -fwhole-program combined with -O2 is
optimizing out the main function since it is not getting called internally.
I was unable to find in the documentation any method of forcing external
visiblity in a fortran 90 program. There was also no mention of gfortran not
having -fwhole-program working in
http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Optimize-Options.html
--
Summary: gfortran fails with -fwhole-program optimization
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jjcogliati-r1 at yahoo dot com
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26682