public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Using Optimization flag in Fortran
@ 2009-12-01 13:25 Vardhan, Sundara (GE Infra, Energy)
  2009-12-01 13:53 ` Tim Prince
  0 siblings, 1 reply; 3+ messages in thread
From: Vardhan, Sundara (GE Infra, Energy) @ 2009-12-01 13:25 UTC (permalink / raw)
  To: gcc-help

Hi All

Recently I added the -O3 flag to compile gfortran code. The application
uses OPEN() call to open files. These calls are made in a sequence, one
after another to open about 4 files before any operation on any of these
files are performed. This code works fine when compiled with no
Optimization flags. However upon adding the Optimization flags (be it -O
or -O3), the first OPEN() works fine and the next OPEN() call fails. I
suspect that the optimization flag turns on some check which may be
causing this failure. I would very much appreciate your help and advice
on what may be the reason for such a behaviour.

Thanks in advance

With Regards

Vardhan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Using Optimization flag in Fortran
  2009-12-01 13:25 Using Optimization flag in Fortran Vardhan, Sundara (GE Infra, Energy)
@ 2009-12-01 13:53 ` Tim Prince
  2009-12-01 15:04   ` Vardhan, Sundara (GE Infra, Energy)
  0 siblings, 1 reply; 3+ messages in thread
From: Tim Prince @ 2009-12-01 13:53 UTC (permalink / raw)
  To: Vardhan, Sundara (GE Infra, Energy); +Cc: gcc-help

Vardhan, Sundara (GE Infra, Energy) wrote:

> Recently I added the -O3 flag to compile gfortran code. The application
> uses OPEN() call to open files. These calls are made in a sequence, one
> after another to open about 4 files before any operation on any of these
> files are performed. This code works fine when compiled with no
> Optimization flags. However upon adding the Optimization flags (be it -O
> or -O3), the first OPEN() works fine and the next OPEN() call fails. I
> suspect that the optimization flag turns on some check which may be
> causing this failure. 
It looks more likely you have a bug in your program whose ill effect is 
worsened with optimization.  Perhaps you could find it by setting -O 
along with -Wall and subscript range checking.
It may also be useful to assure that you have a more stable version of 
gfortran than would be furnished by some of the "enterprise" linux distros.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: Using Optimization flag in Fortran
  2009-12-01 13:53 ` Tim Prince
@ 2009-12-01 15:04   ` Vardhan, Sundara (GE Infra, Energy)
  0 siblings, 0 replies; 3+ messages in thread
From: Vardhan, Sundara (GE Infra, Energy) @ 2009-12-01 15:04 UTC (permalink / raw)
  To: tprince; +Cc: gcc-help

Hi Tim

Thanks much for your reply. I will try this out as soon as I get a
system to work on. I am working on RedHat Linux enterprise version but a
very old gcc - version 4.1.2.

With Regards

Vardhan 

-----Original Message-----
From: Tim Prince [mailto:n8tm@aol.com] 
Sent: Tuesday, December 01, 2009 8:53 AM
To: Vardhan, Sundara (GE Infra, Energy)
Cc: gcc-help@gcc.gnu.org
Subject: Re: Using Optimization flag in Fortran

Vardhan, Sundara (GE Infra, Energy) wrote:

> Recently I added the -O3 flag to compile gfortran code. The 
> application uses OPEN() call to open files. These calls are made in a 
> sequence, one after another to open about 4 files before any operation

> on any of these files are performed. This code works fine when 
> compiled with no Optimization flags. However upon adding the 
> Optimization flags (be it -O or -O3), the first OPEN() works fine and 
> the next OPEN() call fails. I suspect that the optimization flag turns

> on some check which may be causing this failure.
It looks more likely you have a bug in your program whose ill effect is
worsened with optimization.  Perhaps you could find it by setting -O
along with -Wall and subscript range checking.
It may also be useful to assure that you have a more stable version of
gfortran than would be furnished by some of the "enterprise" linux
distros.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-12-01 15:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-01 13:25 Using Optimization flag in Fortran Vardhan, Sundara (GE Infra, Energy)
2009-12-01 13:53 ` Tim Prince
2009-12-01 15:04   ` Vardhan, Sundara (GE Infra, Energy)

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).