[Developers] (compiler) bug while using AEIDevelopment/TmunuBase

Erik Schnetter schnetter at cct.lsu.edu
Wed Oct 4 11:23:37 CDT 2006


On Oct 4, 2006, at 10:19:03, Luca Baiotti wrote:

[...]

> Instead the segmantation fault is caused by
> something in the inner if-statement: if I remove its content, the
> segmantation fault disppears.
>
> I I turn off optimization. the segmentation fault also disappears.
>
> This problem is easily reproduced by running the attached parfile.
>
> Is this a compiler bug or what?

This is very likely a compiler problem with too much optimisation.   
Such problems have appeared before, notably with the Intel compiler.

The compiler generates faster code by executing some part of the  
statements in the if statement all the time, even if the if condition  
is false.  (Of course, the variables are not really changed unless  
the if condition is true, but part of the calculation is performed  
nonetheless.)

According to my understanding of the Fortran standard, this is an  
illegal optimisation, because the Fortran compiler cannot prove that  
these array elements are actually "defined" (in the Fortran sense).   
Indeed they are not, which leads to a segmentation fault.

The usual work-around includes opening a problem report with the  
compiler vendor, so that this problem is removed in future versions.   
At the time, you can try lower optimisation settings to avoid the  
problem.  Look particularly for options that disable "prefetching".   
Of course, using a different compiler will also help.

It would also be possible to circumvent this problem from the driver;  
the driver could pass fake arrays (e.g. the x-coordinate array)  
instead of grid functions that have no storage.  The danger is that  
this will mask real errors in the code, so it should not be the default.

-erik

-- 
Erik Schnetter <schnetter at cct.lsu.edu>

My email is as private as my paper mail.  I therefore support encrypting
and signing email messages.  Get my PGP key from www.keyserver.net.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://www.cactuscode.org/pipermail/developers/attachments/20061004/3ae1e506/attachment.bin 


More information about the Developers mailing list