This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, fortran] PR34820 , PR34143 and PR32795 - some allocatable component bugs


Hi Paul,

Paul Richard Thomas wrote:
> I propose to commit this patch, which has been corrected for bit-rot
> and to post a new PR for the memory leaks.
>   
(I think I properly applied the patch, but I might have messed up locally.)

In general, the patch works quite well but some of test cases in the PRs
remain unfixed; I did not quickly see whether those are related or
independent bugs.


Regarding PR 34820: While the several of the examples of Daniel Franke
are fixed, my original test case (comment 0; or the FOR line in comment
13) still show a memory leak (valgrind --leak-check=full output, see
comment 0).


For PR 34820: Interestingly, the original test case in the TAR file
compiles without any problems, but compiling the example from comment 3
gives a segmentation fault (but no ICE anymore) for line 6, namely
   subroutine read_grid_header()

Valgrind shows:

==30978== Invalid read of size 8
==30978==    at 0x5DCEFE: fold_convert (fold-const.c:2493)
==30978==    by 0x4A003F: structure_alloc_comps (trans-array.c:5531)
==30978==    by 0x4ABA84: gfc_generate_function_code (trans-decl.c:2802)

The line is

fold_convert (tree type, tree arg)
{
  tree orig = TREE_TYPE (arg); // line 2493

which called as follows from structure_alloc_comps

          tmp =  array_type_nelts (TREE_TYPE (decl));
          tmp = fold_convert (gfc_array_index_type, tmp);


For PR 34143: Again, the original test case works, but the example of
Dominque (comment 13) shows:

 derived type, ik=           4
[...]
 bounds, full implicit section          -1           2    <-- should not it be 4?


NAG f95, g95 and ifort agrees with Dominque and print "1 4" instead of
"-1 2".

> Bootstrapped and regtested on FC9/x86_i64 - OK for trunk
>   
I will have a look later.

Tobias


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]