http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46978

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2010-12-16 
10:20:47 UTC ---
It works for me on powerpc-apple-darwin9, revision 167865, and
x86_64-apple-darwin10.5.0, revision 167880, in both 32 and 64 bit modes,
with/without '-Ofast -g'. Could you provide the output of 'gfortran -v'?

Note that valgrind reports

==64764== Memcheck, a memory error detector
==64764== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==64764== Using Valgrind-3.6.0 and LibVEX; rerun with -h for copyright info
==64764== Command: a.out
==64764== 
 mesh%blocks(1)%elements
           1           1           1           1           1           1       
   1           1           1           1           2           2           2   
       2           1           2           3           4           5         
11          12          13          14          15           1           2     
     4           5
 mesh%blocks(2)%elements
           1           1           1           1           1           1       
   1           1           1           1           2           2           6   
       7           8           9          10          16          17         
18          19          20           3           6
 mesh%blocks(3)%elements
           1           1           1           1           1          21       
  22          23          24          25
 mesh%blocks(4)%elements
           1           1           1           1           1          26       
  27          28          29          30
==64764== Invalid write of size 8
==64764==    at 0x100002696: MAIN__ (main.f90:113)
==64764==  Address 0x100773b40 is 0 bytes after a block of size 208 alloc'd
==64764==    at 0x100063915: malloc (vg_replace_malloc.c:236)
==64764==    by 0x1000242DB:
__meshgen_construct_m_MOD_add_to_mesh_object_geometry (mod.f90:2014)
==64764== 
 mesh%blocks(1)%elements
           1           1           1           1           1           1       
   1           1           1           1           2           2           2   
       2           1           2           3           4           5         
11          12          13          14          15           1           2     
     4           5
 mesh%blocks(2)%elements
           1           1           1           1           1           1       
   1           1           1           1           2           2           6   
       7           8           9          10          16          17         
18          19          20           3           6
 mesh%blocks(3)%elements
           1           1           1           1           1          21       
  22          23          24          25
 mesh%blocks(4)%elements
           1           1           1           1           1          26       
  27          28          29          30
==64764== 
==64764== HEAP SUMMARY:
==64764==     in use at exit: 3,116 bytes in 136 blocks
==64764==   total heap usage: 1,507 allocs, 1,371 frees, 3,127,743 bytes
allocated
==64764== 
==64764== LEAK SUMMARY:
==64764==    definitely lost: 3,028 bytes in 135 blocks
==64764==    indirectly lost: 0 bytes in 0 blocks
==64764==      possibly lost: 0 bytes in 0 blocks
==64764==    still reachable: 88 bytes in 1 blocks
==64764==         suppressed: 0 bytes in 0 blocks
==64764== Rerun with --leak-check=full to see details of leaked memory
==64764== 
==64764== For counts of detected and suppressed errors, rerun with: -v
==64764== ERROR SUMMARY: 9 errors from 1 contexts (suppressed: 0 from 0)

where the line 113 of main.f90 is

      mesh%objects(1)%coor = transpose ( reshape ( a, (/2,nno/) ) )

and the line 2014 of mods.f90 is the last line of the allocate

    allocate ( &
      mesh%objects(newobject)%coor(nnodes,mesh%objects(newobject)%ndim), &
      mesh%objects(newobject)%refcoor(nnodes,mesh%objects(newobject)%ndim), &
      mesh%objects(newobject)%grpelm(nnodes,2) )

I did not look further to the code

Reply via email to