public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32665]  New: allocatable array on lhs deleted while still in use on rhs
@ 2007-07-07  9:29 dfranke at gcc dot gnu dot org
  2007-07-09 22:42 ` [Bug fortran/32665] " pault at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-07-07  9:29 UTC (permalink / raw)
  To: gcc-bugs

While experimenting with testcases from PR31320, I hit this:

$> cat alloc.f90
TYPE :: x
  INTEGER, ALLOCATABLE :: a(:)
END TYPE
TYPE(x) :: a

a = x((/ 1, 2, 3 /))
a = x((/ a%a, 4 /))
end

$> gfortran-svn -g -Wall -fdump-tree-original allocatable.f90 && ./a.out
Segmentation fault

$> valgrind --tool=memcheck --leak-check=full ./a.out
[...]
==2287== Invalid read of size 4
==2287==    at 0x804895F: MAIN__ (allocatable.f90:8)
==2287==    by 0x8048C78: main (fmain.c:22)
==2287==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==2287==
==2287== Process terminating with default action of signal 11 (SIGSEGV)
==2287==  Access not within mapped region at address 0x0
==2287==    at 0x804895F: MAIN__ (allocatable.f90:8)
==2287==    by 0x8048C78: main (fmain.c:22)

>From trre-dump:
[...]
     _gfortran_deallocate (a.a.data, &D.1050);
      a.a.data = 0B;
[...]
        D.1029 = (int4[0:] *) a.a.data;
[...]
          while (1)
            {
              if (S.6 > a.a.dim[0].ubound) goto L.1;
              (*(int4[0:] *) atmp.4.data)[offset.5] = (*D.1029)[S.6 * D.1034 +
D.1030];
              offset.5 = offset.5 + 1;
              S.6 = S.6 + 1;
            }
          L.1:;


$> gcc version 4.3.0 20070705 (experimental)


-- 
           Summary: allocatable array on lhs deleted while still in use on
                    rhs
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dfranke at gcc dot gnu dot org


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


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

end of thread, other threads:[~2007-07-17 17:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-07  9:29 [Bug fortran/32665] New: allocatable array on lhs deleted while still in use on rhs dfranke at gcc dot gnu dot org
2007-07-09 22:42 ` [Bug fortran/32665] " pault at gcc dot gnu dot org
2007-07-13  9:50 ` pault at gcc dot gnu dot org
2007-07-13  9:58 ` dfranke at gcc dot gnu dot org
2007-07-13 13:48 ` pault at gcc dot gnu dot org
2007-07-16  9:45 ` patchapp at dberlin dot org
2007-07-16 12:01 ` pault at gcc dot gnu dot org
2007-07-17 17:23 ` pault at gcc dot gnu dot org
2007-07-17 17:49 ` pault at gcc dot gnu dot 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).