public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/43532]  New: Segfault using shape intrinsic function with deferred-shape array
@ 2010-03-26 11:23 pchwood at yahoo dot com
  2010-03-27 17:59 ` [Bug libfortran/43532] " pault at gcc dot gnu dot org
  2010-03-28 21:19 ` [Bug fortran/43532] " burnus at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: pchwood at yahoo dot com @ 2010-03-26 11:23 UTC (permalink / raw)
  To: gcc-bugs

Reported and confirmed in the fortran mailing list.
test case, trimmed down by Janus:

   implicit none

   type myobj
      real :: myarray(10)
   end type myobj

   real        :: array(10)
   type(myobj) :: obj

   call myfunc(obj,array)

contains

   subroutine myfunc(this, array)
      type(myobj) :: this
      real        :: array(:)
      write (*,*) 'shape bound', shape(this%myarray)
      write (*,*) 'shape input', shape(array)
      write (*,*) shape(array) /= shape(this%myarray) ! SEGFAULT
   end subroutine myfunc

end


-- 
           Summary: Segfault using shape intrinsic function with deferred-
                    shape array
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pchwood at yahoo dot com


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


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

* [Bug libfortran/43532] Segfault using shape intrinsic function with deferred-shape array
  2010-03-26 11:23 [Bug libfortran/43532] New: Segfault using shape intrinsic function with deferred-shape array pchwood at yahoo dot com
@ 2010-03-27 17:59 ` pault at gcc dot gnu dot org
  2010-03-28 21:19 ` [Bug fortran/43532] " burnus at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pault at gcc dot gnu dot org @ 2010-03-27 17:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pault at gcc dot gnu dot org  2010-03-27 17:59 -------
With the function calls interchanged, the problem goes away. ie. with:

write (*,*) shape(this%myarray) /= shape(array) ! SEGFAULT

I can't see from the code yet why this is happening but can confirm the bug.

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-03-27 17:59:38
               date|                            |


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


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

* [Bug fortran/43532] Segfault using shape intrinsic function with deferred-shape array
  2010-03-26 11:23 [Bug libfortran/43532] New: Segfault using shape intrinsic function with deferred-shape array pchwood at yahoo dot com
  2010-03-27 17:59 ` [Bug libfortran/43532] " pault at gcc dot gnu dot org
@ 2010-03-28 21:19 ` burnus at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-03-28 21:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2010-03-28 21:19 -------
Valgrind shows:

==4509== Conditional jump or move depends on uninitialised value(s)
==4509==    at 0x4EB51A3: _gfortran_shape_4 (shape_i4.c:47)
==4509==    by 0x40091E: myfunc.1553 (hjfdf.f90:19)
==4509==    by 0x400A87: MAIN__ (hjfdf.f90:10)
==4509==    by 0x400AC2: main (hjfdf.f90:10)
==4509== 
==4509== Use of uninitialised value of size 8
==4509==    at 0x4EB51E2: _gfortran_shape_4 (shape_i4.c:53)
==4509==    by 0x40091E: myfunc.1553 (hjfdf.f90:19)
==4509==    by 0x400A87: MAIN__ (hjfdf.f90:10)
==4509==    by 0x400AC2: main (hjfdf.f90:10)
==4509== 
==4509== Invalid write of size 4
==4509==    at 0x4EB51E2: _gfortran_shape_4 (shape_i4.c:53)
==4509==    by 0x40091E: myfunc.1553 (hjfdf.f90:19)
==4509==    by 0x400A87: MAIN__ (hjfdf.f90:10)
==4509==    by 0x400AC2: main (hjfdf.f90:10)
==4509==  Address 0x0 is not stack'd, malloc'd or (recently) free'd


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |32834
              nThis|                            |
          Component|libfortran                  |fortran
           Keywords|                            |wrong-code
      Known to fail|                            |4.1.2 4.2.1 4.3.4 4.4.4
                   |                            |4.5.0


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


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

end of thread, other threads:[~2010-03-28 21:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-26 11:23 [Bug libfortran/43532] New: Segfault using shape intrinsic function with deferred-shape array pchwood at yahoo dot com
2010-03-27 17:59 ` [Bug libfortran/43532] " pault at gcc dot gnu dot org
2010-03-28 21:19 ` [Bug fortran/43532] " burnus 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).