[Patch, Fortran] PR fortran/35846: ICE on character array constructor

Daniel Kraft d@domob.eu
Sun Sep 21 07:11:00 GMT 2008


Daniel Kraft wrote:
> Tobias Burnus wrote:
>> Hi Daniel,
>>
>> Daniel Kraft wrote:
>>> this is a fix for PR fortran/35846 where character array constructor
>>> ICEd in certain situations because gfc_conv_string_length could be
>>> called with a charlength structure whose length was NULL. [...]
>>>
>>> After fixing the ICE, the problem with the global variables pointed out
>>> broke bounds-checking for the tests, which I fixed by saving & restoring
>>> their values.
>>
>> I think you just made it more difficult to hit the bug rather than
>> fully fixing the bug. If one adds another nested constructor one
>> still gets:
> 
> Hi Tobias,
> 
> thanks for catching this one!  I'm not in my best testing shape today it 
> seems...  But while I'm surely not in a position to claim the patch is 
> right or correct, I still believe that the problem here was just that I 
> missed to call flatten_array_ctors_without_strlen on the first 
> constructor element when I took it out, so that in your example there 
> still remained an array constructor in the "flattened" expression.
> 
> This is fixed with the new patch and your test compiles fine, too, and 
> outputs the expected values.
> 
> The new patch is just regression testing.  What do you think about this 
> one?  Or do you think the way this patch works is completely wrong and I 
> should try to find another solution?  I just thought it would be the 
> best idea to reuse the existing logic in gfc_conv_string_length for 
> gfc_conv_expr_descriptor/gfc_conv_string_length.

Regression test finished, and of course it should be "reusing the logic 
of *gfc_conv_expr*..."

> Yours,
> Daniel
> 
>> internal compiler error: in gfc_conv_array_constructor_expr,
>>                          at fortran/trans-expr.c:3356
>>
>> using the following program
>>
>> implicit none
>> character(len=3) :: c(3)
>> c = 'a'
>> c = (/ (/ 'A'//(/ trim(c(1)), 'a' /)/)//'c', 'dcd' /)
>> print *, c(1)
>> print *, c(2)
>> print *, c(3)
>> end
>>
>> NAG f95 and ifort print for this program:
>>  Aac
>>  Aac
>>  dcd
> 


-- 
Done:     Arc-Bar-Cav-Sam-Val-Wiz, Dwa-Elf-Gno-Hum-Orc, Law-Neu-Cha, Fem-Mal
To go:    Hea-Kni-Mon-Pri-Ran-Rog-Tou



More information about the Fortran mailing list