public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/46978] New: TRANSPOSE corrupts structure and memory
@ 2010-12-16  9:10 m.a.hulsen at tue dot nl
  2010-12-16 10:20 ` [Bug fortran/46978] " dominiq at lps dot ens.fr
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: m.a.hulsen at tue dot nl @ 2010-12-16  9:10 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: TRANSPOSE corrupts structure and memory
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: m.a.hulsen@tue.nl


Created attachment 22783
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22783
the source files and Makefile

I found a serious issue with the TRANSPOSE intrinsic function, possibly when
combined with the reshape intrinsic.
I tried to create a small sample program, but I was unsuccessful.
Therefore I decided to start from the failing big program and made it as small
as possible but still showing the issue. It turned out to be very tricky and
there are still 4275 lines of code left.
However, all of the code in mods.f90 is necessary to build the structure mesh
and is fine. The problem appears at a single line in the small main program
after building the mesh structure.

The corruption is related to the statement:

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

at line 113 in the file mainprog.f90, which corrupt other parts of the
structure mesh. In particular the parts mesh%blocks(2)%elements and
mesh$blocks(3)%elements are overwritten. For example:
mesh%blocks(3)%elements before:
          1           1           1           1           1          21
22          23          24          25
mesh%blocks(3)%elements after:
          1           1           1           1           1          21
22          23           0  1072693248

If I remove the stop statement at line 124, I also get a message:
*** glibc detected *** mainprog: double free or corruption (!prev):
0x00000000008fe440 ***
with a corresponding backtrace.

If I uncomment lines 5, 6 and 7 in mainprog.f90, and basically
replacing the intrinsic transpose with my own version, the problem is gone.

Note, that it runs fine with gfortran from 6th June 2010 (from Tobias Burnus’
homepage), g95, ifort, Lahey/Fujitsu and nagfor.


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2010-12-23 13:43 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-16  9:10 [Bug fortran/46978] New: TRANSPOSE corrupts structure and memory m.a.hulsen at tue dot nl
2010-12-16 10:20 ` [Bug fortran/46978] " dominiq at lps dot ens.fr
2010-12-16 10:33 ` 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

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).