public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/66321] New: [4.9.2/5.1.0/6.0.0] errors allocating allocatable array component of pointer object component
@ 2015-05-28  0:05 damian at sourceryinstitute dot org
  2015-05-28  7:02 ` [Bug fortran/66321] " vehre at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: damian at sourceryinstitute dot org @ 2015-05-28  0:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66321

            Bug ID: 66321
           Summary: [4.9.2/5.1.0/6.0.0] errors allocating allocatable
                    array component of pointer object component
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: damian at sourceryinstitute dot org
  Target Milestone: ---

Possibly this bug is related to Bug 56471 (which is oustanding) and/or Bug
65841 (which has been fixed).  The code listing below demonstrates what appears
to be a rejection of valid code in gfortran versions 4.9.2, 5.1.0, and 6.0.0. 
After commenting the offending line, the resulting code generates a runtime
segmentation fault when the subsequent line attempts automatically allocate the
variable whose explicit source allocation was rejected in the original code.

Both versions of the code compile and execute cleanly with the Cray, Portland
Group, NAG, and Intel compilers.

Damian


localhost:seg-fault rouson$ cat compile-time-error.f90 
type Bar
   integer, allocatable :: a(:)
end type 
type Foo
  type (bar), pointer :: b
end type 
type(Foo) f
allocate(f%b)
allocate(f%b%a,source=[3]) ! Compile-time error
f%b%a = [3] ! Run-time seg fault
end 

localhost:seg-fault rouson$ gfortran compile-time-error.f90 
compile-time-error.f90:9:9:

 allocate(f%b%a,source=[3]) ! Compile-time error
         1
Error: Array specification required in ALLOCATE statement at (1)

localhost:seg-fault rouson$ sed 's/allocate(f%b%a/!allocate(f%b%a/' <
compile-time-error.f90 > run-time-error.f90
localhost:seg-fault rouson$ gfortran run-time-error.f90 

localhost:seg-fault rouson$ ./a.out

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x10ad0ab26
#1  0x10ad0a0c3
#2  0x7fff8a317f19
#3  0x10ad03e5e
#4  0x10ad03ea0
Segmentation fault: 11
localhost:seg-fault rouson$ gfortran --version
GNU Fortran (MacPorts gcc6 6-20150510_0) 6.0.0 20150510 (experimental)
Copyright (C) 2015 Free Software Foundation, Inc.


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

* [Bug fortran/66321] [4.9.2/5.1.0/6.0.0] errors allocating allocatable array component of pointer object component
  2015-05-28  0:05 [Bug fortran/66321] New: [4.9.2/5.1.0/6.0.0] errors allocating allocatable array component of pointer object component damian at sourceryinstitute dot org
@ 2015-05-28  7:02 ` vehre at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: vehre at gcc dot gnu.org @ 2015-05-28  7:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66321

vehre at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |vehre at gcc dot gnu.org
         Resolution|---                         |DUPLICATE

--- Comment #1 from vehre at gcc dot gnu.org ---
Hi Damian,

that construction rang a bell. It is similar to pr 44672, which is in review
currently and a compiler having the patch for it included compiles w/o ICE. I
try to address the comments I got on the patch today.

Regards,
Andre

*** This bug has been marked as a duplicate of bug 44672 ***


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

end of thread, other threads:[~2015-05-28  7:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-28  0:05 [Bug fortran/66321] New: [4.9.2/5.1.0/6.0.0] errors allocating allocatable array component of pointer object component damian at sourceryinstitute dot org
2015-05-28  7:02 ` [Bug fortran/66321] " vehre 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).