public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/45440]  New: [OOP] ALLOCATE with SOURCE gives an ICE (segfault)
@ 2010-08-28 11:17 burnus at gcc dot gnu dot org
  2010-08-28 11:34 ` [Bug fortran/45440] " janus at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-08-28 11:17 UTC (permalink / raw)
  To: gcc-bugs

The following segfaults with the current trunk, a 20100701 trunk, and a 4.5.1
build.


type t
  integer :: x
  real :: y(5)
  logical, allocatable :: z(:)
end type t

type(t) :: mt

mt%x = 1
mt%y = [1,2,3,4,5]
allocate ( mt%z, source = [ .true., .false., .true.]) ! <<< ICE(segfault)
print *, mt%x
print *, mt%y
print *, mt%z
!print *, mt ! Invalid - ultimate allocatable component
end


Expected: As with ifort and crayftn: It compiles and ./a.out prints
 1
 1.,  2.,  3.,  4.,  5.
 T,  F,  T


-- 
           Summary: [OOP] ALLOCATE with SOURCE gives an ICE (segfault)
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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


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

* [Bug fortran/45440] ALLOCATE with SOURCE gives an ICE (segfault)
  2010-08-28 11:17 [Bug fortran/45440] New: [OOP] ALLOCATE with SOURCE gives an ICE (segfault) burnus at gcc dot gnu dot org
@ 2010-08-28 11:34 ` janus at gcc dot gnu dot org
  2010-08-28 11:46 ` [Bug fortran/45440] [F03] " janus at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-08-28 11:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from janus at gcc dot gnu dot org  2010-08-28 11:34 -------
Confirmed. One does not even need allocatable components for this. The
following also fails:

logical, allocatable :: z(:)
allocate ( z, source = [ .true., .false., .true.]) ! <<< ICE(segfault)
print *, z
end


-- 

janus 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-08-28 11:34:22
               date|                            |
            Summary|[OOP] ALLOCATE with SOURCE  |ALLOCATE with SOURCE gives
                   |gives an ICE (segfault)     |an ICE (segfault)


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


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

* [Bug fortran/45440] [F03] ALLOCATE with SOURCE gives an ICE (segfault)
  2010-08-28 11:17 [Bug fortran/45440] New: [OOP] ALLOCATE with SOURCE gives an ICE (segfault) burnus at gcc dot gnu dot org
  2010-08-28 11:34 ` [Bug fortran/45440] " janus at gcc dot gnu dot org
@ 2010-08-28 11:46 ` janus at gcc dot gnu dot org
  2010-08-28 11:51 ` janus at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-08-28 11:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from janus at gcc dot gnu dot org  2010-08-28 11:46 -------
valgrind says:

==29743== Invalid read of size 4
==29743==    at 0x52B37DB: __gmpz_set (in /usr/lib/libgmp.so.3.5.2)
==29743==    by 0x532C37: conformable_arrays (resolve.c:6525)
==29743==    by 0x533175: resolve_allocate_expr (resolve.c:6679)
==29743==    by 0x533EA6: resolve_allocate_deallocate (resolve.c:6990)
==29743==    by 0x537AB4: resolve_code (resolve.c:9017)
==29743==    by 0x541422: resolve_codes (resolve.c:13320)
==29743==    by 0x54151D: gfc_resolve (resolve.c:13347)
==29743==    by 0x51E86A: resolve_all_program_units (parse.c:4187)
==29743==    by 0x51EEE5: gfc_parse_file (parse.c:4416)
==29743==    by 0x562C6E: gfc_be_parse_file (f95-lang.c:241)
==29743==    by 0xA35DA8: compile_file (toplev.c:971)
==29743==    by 0xA38051: do_compile (toplev.c:2321)
==29743==  Address 0x7c is not stack'd, malloc'd or (recently) free'd


-- 

janus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu dot org
      Known to fail|                            |4.5.2 4.6.0
            Summary|ALLOCATE with SOURCE gives  |[F03] ALLOCATE with SOURCE
                   |an ICE (segfault)           |gives an ICE (segfault)


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


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

* [Bug fortran/45440] [F03] ALLOCATE with SOURCE gives an ICE (segfault)
  2010-08-28 11:17 [Bug fortran/45440] New: [OOP] ALLOCATE with SOURCE gives an ICE (segfault) burnus at gcc dot gnu dot org
  2010-08-28 11:34 ` [Bug fortran/45440] " janus at gcc dot gnu dot org
  2010-08-28 11:46 ` [Bug fortran/45440] [F03] " janus at gcc dot gnu dot org
@ 2010-08-28 11:51 ` janus at gcc dot gnu dot org
  2010-08-28 11:55 ` janus at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-08-28 11:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from janus at gcc dot gnu dot org  2010-08-28 11:51 -------
The following variant segfaults as well (same backtrace):

logical, allocatable :: z(:)
logical, dimension(1:3) :: src = (/ .true., .false., .true. /)
allocate ( z, source = src)
print *, z
end


-- 


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


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

* [Bug fortran/45440] [F03] ALLOCATE with SOURCE gives an ICE (segfault)
  2010-08-28 11:17 [Bug fortran/45440] New: [OOP] ALLOCATE with SOURCE gives an ICE (segfault) burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2010-08-28 11:51 ` janus at gcc dot gnu dot org
@ 2010-08-28 11:55 ` janus at gcc dot gnu dot org
  2010-08-28 14:06 ` burnus at gcc dot gnu dot org
  2010-08-29 17:23 ` janus at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-08-28 11:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from janus at gcc dot gnu dot org  2010-08-28 11:55 -------
It works though when explicitly specifying the size of z to allocate:

logical, allocatable :: z(:)
allocate ( z(3), source =  [ .true., .false., .true. ] )
print *, z
end


-- 


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


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

* [Bug fortran/45440] [F03] ALLOCATE with SOURCE gives an ICE (segfault)
  2010-08-28 11:17 [Bug fortran/45440] New: [OOP] ALLOCATE with SOURCE gives an ICE (segfault) burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2010-08-28 11:55 ` janus at gcc dot gnu dot org
@ 2010-08-28 14:06 ` burnus at gcc dot gnu dot org
  2010-08-29 17:23 ` janus at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-08-28 14:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from burnus at gcc dot gnu dot org  2010-08-28 14:05 -------
(In reply to comment #4)
> It works though when explicitly specifying the size of z to allocate:
> 
> logical, allocatable :: z(:)
> allocate ( z(3), source =  [ .true., .false., .true. ] )

Congratulation - you have found another bug:

"C633 (R631) If allocate-object is an array either allocate-shape-spec-list
shall appear or source-expr shall appear [...]"

In your example both appear. ("source-expr" is either SOURCE= or MOLD=.)


-- 


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


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

* [Bug fortran/45440] [F03] ALLOCATE with SOURCE gives an ICE (segfault)
  2010-08-28 11:17 [Bug fortran/45440] New: [OOP] ALLOCATE with SOURCE gives an ICE (segfault) burnus at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2010-08-28 14:06 ` burnus at gcc dot gnu dot org
@ 2010-08-29 17:23 ` janus at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-08-29 17:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from janus at gcc dot gnu dot org  2010-08-29 17:22 -------
cf. PR 44529


-- 


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


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

end of thread, other threads:[~2010-08-29 17:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-28 11:17 [Bug fortran/45440] New: [OOP] ALLOCATE with SOURCE gives an ICE (segfault) burnus at gcc dot gnu dot org
2010-08-28 11:34 ` [Bug fortran/45440] " janus at gcc dot gnu dot org
2010-08-28 11:46 ` [Bug fortran/45440] [F03] " janus at gcc dot gnu dot org
2010-08-28 11:51 ` janus at gcc dot gnu dot org
2010-08-28 11:55 ` janus at gcc dot gnu dot org
2010-08-28 14:06 ` burnus at gcc dot gnu dot org
2010-08-29 17:23 ` janus 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).