optimisation of overflowing integers

Tobias Burnus burnus@net-b.de
Tue Mar 18 20:27:00 GMT 2014


Hi,

Jorge D'Elia wrote:
> I tried to use the suggested flag -fsanitize=undefined with the (experimental) version:
> GNU Fortran (GCC) 4.9.0 20140315 (experimental) [trunk revision 208587]
> However an ICE is found:

The reason for the ICE is that you need to have an additional patch 
applied. As I wrote:

>> Try GCC/gfortran 4.9 (with the bug fix patch to PR60557), namely:

The patch has been committed in the meanwhile - thus, if you build GCC 
now or wait for this night's nightly build it should work.

However, that will only solve the ICE - you still need libbacktrace, 
which does not seem to be available on your system as you should have 
gotten a backtrace for the ICE. See Steve's email.


N. M. Maclaren wrote:
>> bar.f90:19: runtime error: signed integer overflow: 809078955 * 65539 
>> cannot be represented in type 'integer(kind=4)'
>>   0.290384561       623596113
>
> Congratulations to those responsible!  I will update my courses, as soon
> as I get a moment. 

The basic idea and implementation of the sanitzer comes from Google. 
There is meanwhile a real zoo of sanitzers in LLVM and GCC. See: 
http://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html#index-fsanitize_003daddress-593 
- while there are a few extra checks for C/C++ most apply to all 
languages, including Fortran.

The UBSan (undefined behaviour) implementation is also based on Google's 
libraries, however, the main implementation work was done by Marek and 
Jakub of Red Hat.

Tobias



More information about the Fortran mailing list