[d2n-analysis-talk] fortran bounds check

David Flay flay at jlab.org
Fri Nov 30 10:47:50 EST 2012


On Thu, Nov 29, 2012 at 4:16 PM, Brad Sawatzky <brads at jlab.org> wrote:

>
> Oh yeah.  The other scary bug in old code is associated with
> uninitialized variables.  Older versions of fortran automagically
> initialized variables to zero -- I've run across old code that relied on
> this informal behaviour.  As you might imagine, this can result in some
> weird indeterminate bugs on compilers that don't initialize by default
> (ie. all GNU compilers).  The code execution can depend on whatever
> happened to be in in a given block of memory at allocation time.
>
> It is wise to make sure the "-finit-local-zero" flag is used (which can
> cause a performance hit), and/or use "-Wall" which should flag variables
> that get used without explicit initialization.
>

Thanks Brad.  Looking at the 'make' file (it's actually a bash script), it
has -fbounds-check included.  I added -Wall, which just showed me unused
variables.  Before using -Wall, I had just some warnings about obsolete
'pause' statements (I cleaned up the old 'if' statements).

-- 
-----------------------------------------------------------
David Flay
Physics Department
Temple University
Philadelphia, PA 19122

office: Barton Hall, BA319
phone: (215) 204-1331

e-mail: flay at jlab.org
           flay at temple.edu

website: http://www.jlab.org/~flay
             http://quarks.temple.edu
-----------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mailman.jlab.org/pipermail/d2n-analysis-talk/attachments/20121130/5ca60519/attachment.html 


More information about the d2n-analysis-talk mailing list