[Patch, fortran] PR34537 - ICE or wrong code for TRANSFER of constant string to character

Tobias Burnus burnus@net-b.de
Fri Jan 11 15:13:00 GMT 2008


Tobias Burnus wrote:
> (CCed gcc-patches; for patch, see fortran@)
>
> Paul Richard Thomas wrote:
>   
>> Regetested on Cygwin_NT (will do the lot on x86_ia64 tonight) - OK for trunk?
>>   
>>     
> OK. Thanks for the patch.
>   
I forgot the following. Please change the test case as follows as it has
out-of-bound problems:

  allocate(ptr(8))
  ptr = transfer('Sample#0'//achar(0),ptr) ! Causes ICE

is bad, because you transfer 9 bytes to a (pointer to a) 8-byte array.
Please change the test to:

  allocate(ptr(9))
  ptr = transfer('Sample#0'//achar(0),ptr) ! Causes ICE
  if (any (ptr .ne. ['S','a','m','p','l','e','#','0', achar(0)])) call abort

(Note also the added "achar(0)" in the if clause.)

I filled -bounds-check errors for those as gfortran - contrary to NAG
f95 - does not detect them: PR 34740, 34741).

Tobias



More information about the Gcc-patches mailing list