[Patch, Fortran] PR45170 - Fix deferred-length issue

Tobias Burnus burnus@net-b.de
Thu May 24 14:33:00 GMT 2012


This patch fixes an ordering problem with deferred string lengths. For

   str = str2(:nn)

where "nn" is a something a tad more complicated than a local variable 
(e.g. a non-VALUE dummy argument), the result was wrong: the temporary 
variable with the string length was used before it was set.

The attached patch fixes the issue. However, I wonder whether the block 
should/could always be added.

Build and regtested on x86-64-linux.
OK for the trunk?

  * * *

Remaining deferred-length issues:

- PR 47674: a = a(:n); reallocation messed up; "realloc" should be 
enough as the length has to be always <= previous length [memory content 
is then guaranteed to remain untouched]. Alternatively, a temporary is 
required
- PR 49954: String length is wrong for "array(:)(1:1)": It's wrongly the 
one of "array" instead of 1; there might be some extra issues.
- PR 50221: Some odd array assignment issues.
- PR 51976: Deferred-string components. Needs a hidden component for the 
string length. Tricky: expr->ts.u.cl->backend_decl is wrong as that 
points to the component - missing the component ref ("var->comp"). 
Similar to the issue of PR49954.

Tobias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: deferred-string-dummy-len.diff
Type: text/x-patch
Size: 4051 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120524/ed067bd2/attachment.bin>


More information about the Gcc-patches mailing list