Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Mar 1995 15:57:29 -0800 (PST)
From:      Steven G Kargl  <kargl@troutmask.apl.washington.edu>
To:        joerg_wunsch@uriah.heep.sax.de
Cc:        freebsd-current@FreeBSD.org
Subject:   Re: optimization is broken for f77
Message-ID:  <199503092357.PAA10760@troutmask.apl.washington.edu>
In-Reply-To: <199503092136.WAA08416@uriah.heep.sax.de> from "J Wunsch" at Mar 9, 95 10:36:12 pm

next in thread | previous in thread | raw e-mail | index | archive | help
According to J Wunsch:
> 
> As Steven G Kargl wrote:
> > 
> > It appears that optimization of Fortran compilations is broken
> > if the source code contains continuation lines.  I have a code
> > foo1.f with several continuation lines:
> > 
> > f77 -o foo1 -g foo1.f       [compiles and runs and gives foo1.dat]
> > f77 -o foo2 -g -O foo1.f    [compiles but dies with SIGFPE] 
> > f77 -o foo3 -g -O2 foo1.f   [compiles but dies with SIGFPE at same place] 
> 
> gcc optimization problem.  I've also stumpled across it when porting
> the acm flight simulator, though acm happens to work when compiled
> with -O only.
> 
> Ask Bruce for the details.
> 

Thanks, I found out it was gcc version 2.6.2 problem.  I used f2c to
generate foo1.c, then tried

f2c foo1.f
gcc -o foo1 -g foo1.c -lf2c -lm       [compiles and runs and gives foo1.dat]
gcc -o foo2 -g -O foo1.c -lf2c -lm    [compiles but dies with SIGFPE] 
gcc -o foo3 -g -O2 foo1.c -lf2c -lm   [compiles but dies with SIGFPE] 

Strangely, I remembered that f2c could be invoked to enforce Fortran
evalution of expressions, so


f2c -krd foo1.f
gcc -o foo1 -g foo1.c -lf2c -lm       [compiles, runs and gives foo1.dat]
gcc -o foo2 -g -O foo1.c -lf2c -lm    [compiles, runs and gives foo2.dat] 
gcc -o foo3 -g -O2 foo1.c -lf2c -lm   [compiles but dies with SIGFPE] 


I've also found that gcc 2.6.3 seems to have fixed this problem.

-- 
Steven G. Kargl            | Phone: 206-685-4677 |
Applied Physics Laboratory | Fax:   206-543-6785 |
University of Washington   |---------------------|
1013 NE 40th St            | FreeBSD 2.1-current |
Seattle, WA 98105          |---------------------|



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199503092357.PAA10760>