bug in defined type default initialization

Tobias Burnus burnus@net-b.de
Sat May 17 21:37:00 GMT 2008


Tobias Burnus wrote:
> Aleksander Schwarzenberg-Czerny wrote:
>> Sample run on Copernicus Centre gatekeeper computer/Fedora:
>> [alex@gatekeeper t]$  gfortran -o t t.f90
>> [alex@gatekeeper t]$ ./t
>>           -1
>>            0   <<<<<<<<<<<<<<<<<
> The result really depends on the gfortran version. With gfortran 4.2.x 
> I get the same: -1, 0.
> With gfortran 4.3 I get: 0, 0 which is even worse whereas the current 
> 4.4 prints correctly -1, -1.
> [...]
> who is now trying to find the patch

With gfortran 4.4.0 as of 2008-03-28 (133678) it fails ("0, 0") while 
with the 2008-04-03 (133863) version it works ("-1, -1"). Assuming that 
my tree did not include any relevant patch, it must have been fixed 
between these versions, however, I cannot find any Fortran patch which 
does this.

Note: The the original dump  (-fdump-tree-original) of gfortran 4.3.0 
(of openSUSE) and 4.4.0 (of today) is identical! Thus it might be a 
middle-end problem.

Another interesting point is that

   if(a%i /= -1) call abort()

works with 4.3.0 while

   print *, a%i
   if(a%i /= -1) call abort()

fails (i.e. "0" is printed and abort() is called).

Just to make sure this bug will not reappear, I checked in the test case 
(Rev. 135479).

As this is a nasty bug, one should consider narrowing down the patch 
which fixed it. Then one can backport it to 4.3.0. (I glanced also at 
the middle-end ChangeLog, but could not find anything obvious.)

Tobias



More information about the Fortran mailing list