public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/26682] New: gfortran fails with -fwhole-program optimization
@ 2006-03-14 15:17 jjcogliati-r1 at yahoo dot com
2006-03-14 15:19 ` [Bug fortran/26682] " pinskia at gcc dot gnu dot org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: jjcogliati-r1 at yahoo dot com @ 2006-03-14 15:17 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/26682] gfortran fails with -fwhole-program optimization
2006-03-14 15:17 [Bug fortran/26682] New: gfortran fails with -fwhole-program optimization jjcogliati-r1 at yahoo dot com
@ 2006-03-14 15:19 ` pinskia at gcc dot gnu dot org
2007-10-01 10:58 ` fxcoudert at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-14 15:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2006-03-14 15:19 -------
I have a fix already in mind for this simple issue. Though -fwhole-program is
not going to be fixed for Fortran code until the front-end stops having more
than one decl per function.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |link-failure
Last reconfirmed|0000-00-00 00:00:00 |2006-03-14 15:19:46
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26682
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/26682] gfortran fails with -fwhole-program optimization
2006-03-14 15:17 [Bug fortran/26682] New: gfortran fails with -fwhole-program optimization jjcogliati-r1 at yahoo dot com
2006-03-14 15:19 ` [Bug fortran/26682] " pinskia at gcc dot gnu dot org
@ 2007-10-01 10:58 ` fxcoudert at gcc dot gnu dot org
2007-10-03 9:47 ` fxcoudert at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-10-01 10:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from fxcoudert at gcc dot gnu dot org 2007-10-01 10:58 -------
There are three different issues:
1. -fwhole-program should be documented as not working for the Fortran
programs.
2. The Fortran main program (MAIN__) needs to be kept by the -fwhole-program
optimization; I think one way of achieving this is to mark it as
"externally_visible", but I might be wrong (I've already been wrong on that
issue,!).
3. We need to generate a correct call graph for Fortran code, either by
emitting one single decl per function, or by making the cgraph calculation
aware of this possible situation.
I'll try to tackle 1 and 2, but 3 needs to wait until 4.3 is branched.
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |fxcoudert at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Keywords| |documentation
Last reconfirmed|2007-07-13 15:47:54 |2007-10-01 10:58:25
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26682
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/26682] gfortran fails with -fwhole-program optimization
2006-03-14 15:17 [Bug fortran/26682] New: gfortran fails with -fwhole-program optimization jjcogliati-r1 at yahoo dot com
2006-03-14 15:19 ` [Bug fortran/26682] " pinskia at gcc dot gnu dot org
2007-10-01 10:58 ` fxcoudert at gcc dot gnu dot org
@ 2007-10-03 9:47 ` fxcoudert at gcc dot gnu dot org
2007-10-03 21:27 ` fxcoudert at gcc dot gnu dot org
2007-10-03 21:30 ` fxcoudert at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-10-03 9:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from fxcoudert at gcc dot gnu dot org 2007-10-03 09:46 -------
Subject: Bug 26682
Author: fxcoudert
Date: Wed Oct 3 09:46:46 2007
New Revision: 128977
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128977
Log:
PR fortran/26682
* options.c (gfc_post_options): Issue an error when
-fwhole-program is used.
* doc/invoke.texi (-fwhole-program): Document that Fortran
doesn't support this option.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/doc/invoke.texi
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/options.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26682
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/26682] gfortran fails with -fwhole-program optimization
2006-03-14 15:17 [Bug fortran/26682] New: gfortran fails with -fwhole-program optimization jjcogliati-r1 at yahoo dot com
` (2 preceding siblings ...)
2007-10-03 9:47 ` fxcoudert at gcc dot gnu dot org
@ 2007-10-03 21:27 ` fxcoudert at gcc dot gnu dot org
2007-10-03 21:30 ` fxcoudert at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-10-03 21:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from fxcoudert at gcc dot gnu dot org 2007-10-03 21:27 -------
Subject: Bug 26682
Author: fxcoudert
Date: Wed Oct 3 21:27:39 2007
New Revision: 128993
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128993
Log:
PR fortran/26682
* trans-decl.c (build_function_decl): Set "externally_visible"
attribute on the MAIN program decl.
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-decl.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26682
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/26682] gfortran fails with -fwhole-program optimization
2006-03-14 15:17 [Bug fortran/26682] New: gfortran fails with -fwhole-program optimization jjcogliati-r1 at yahoo dot com
` (3 preceding siblings ...)
2007-10-03 21:27 ` fxcoudert at gcc dot gnu dot org
@ 2007-10-03 21:30 ` fxcoudert at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-10-03 21:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from fxcoudert at gcc dot gnu dot org 2007-10-03 21:30 -------
I've fixed 1 and 2 (and added an error message when -fwhole-program is used
with Fortran), and there is a separate PR to track 3, so I'll close this one.
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26682
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-10-03 21:30 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-14 15:17 [Bug fortran/26682] New: gfortran fails with -fwhole-program optimization jjcogliati-r1 at yahoo dot com
2006-03-14 15:19 ` [Bug fortran/26682] " pinskia at gcc dot gnu dot org
2007-10-01 10:58 ` fxcoudert at gcc dot gnu dot org
2007-10-03 9:47 ` fxcoudert at gcc dot gnu dot org
2007-10-03 21:27 ` fxcoudert at gcc dot gnu dot org
2007-10-03 21:30 ` fxcoudert at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).