public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dominiq at lps dot ens.fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/46978] TRANSPOSE corrupts structure and memory
Date: Thu, 16 Dec 2010 10:20:00 -0000	[thread overview]
Message-ID: <bug-46978-4-64U4mjt6ou@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-46978-4@http.gcc.gnu.org/bugzilla/>

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	other threads:[~2010-12-16 10:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-16  9:10 [Bug fortran/46978] New: " m.a.hulsen at tue dot nl
2010-12-16 10:20 ` dominiq at lps dot ens.fr [this message]
2010-12-16 10:33 ` [Bug fortran/46978] " m.a.hulsen at tue dot nl
2010-12-16 11:21 ` [Bug fortran/46978] [4.6 Regression] " burnus at gcc dot gnu.org
2010-12-16 14:49 ` burnus at gcc dot gnu.org
2010-12-16 15:27 ` jakub at gcc dot gnu.org
2010-12-16 21:32 ` [Bug fortran/46978] [4.6 Regression] TRANSPOSE with RESHAPE and ALLOCATE: Segfault burnus at gcc dot gnu.org
2010-12-17 19:28 ` mikael at gcc dot gnu.org
2010-12-19 15:47 ` mikael at gcc dot gnu.org
2010-12-20 23:25 ` mikael at gcc dot gnu.org
2010-12-20 23:29 ` mikael at gcc dot gnu.org
2010-12-22 12:37 ` mikael at gcc dot gnu.org
2010-12-23  9:13 ` m.a.hulsen at tue dot nl
2010-12-23 13:36 ` mikael at gcc dot gnu.org
2010-12-23 13:39 ` mikael at gcc dot gnu.org
2010-12-23 13:43 ` mikael at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-46978-4-64U4mjt6ou@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).