[Patch, Fortran] PR5469

Tobias Burnus burnus@net-b.de
Mon Nov 26 16:44:00 GMT 2012


l_push_char allocates memory which is freed with free_line. However, 
currently, the memory is not always freed when calling generate_error.

If one aborts, that's fine. However, generate_error can also set the 
iostat variable. Thus, one should ensure that the memory is always freed.

I wouldn't mind if someone, who knows libgfortran/io better than I, 
could confirm that the patch is okay. I don't want too free memory which 
is later used.

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

Tobias


PS: Test case see PR. (I don't think it makes sense to include it in the 
test suite.)

PPS: I see the following failures when regtesting; the LTO and the 
realloc one I know, but I haven't see the reassoc_4.f before. It cannot 
be due to my patch and when I run it manually, it also works:

FAIL: gfortran.dg/lto/pr45586 f_lto_pr45586_0.o-f_lto_pr45586_0.o link, 
-O0 -flto  (internal compiler error)
FAIL: gfortran.dg/realloc_on_assign_5.f03  -O0  execution test
FAIL: gfortran.dg/reassoc_4.f  -O   scan-tree-dump-times reassoc1 "[0-9] 
\\* " 22
-------------- next part --------------
A non-text attachment was scrubbed...
Name: io_free_line.diff
Type: text/x-patch
Size: 3875 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20121126/1ddd43f1/attachment.bin>


More information about the Fortran mailing list