public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/55172] New: ICE on invalid: gfc_variable_attr(): Bad array reference
@ 2012-11-01 22:42 abensonca at gmail dot com
  2012-11-02 11:07 ` [Bug fortran/55172] [4.7/4.8 Regression] [OOP] " janus at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: abensonca at gmail dot com @ 2012-11-01 22:42 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55172
           Summary: ICE on invalid: gfc_variable_attr(): Bad array
                    reference
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: abensonca@gmail.com


The following test case produces and ICE with gfortran 4.8 (r193051):

module gn
  type :: ncb
  end type ncb
  type, public :: tn
     class(ncb), allocatable, dimension(:) :: cb
  end type tn
contains
  integer function name(self)
    implicit none
    class (tn), intent(in) :: self
    select type (component => self%cb(i))
    end select
  end function name
end module gn

$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/home/abenson/Galacticus/Tools/libexec/gcc/x86_64-unknown-
linux-gnu/4.8.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --
prefix=/home/abenson/Galacticus/Tools --enable-languages=c,c++,fortran --
disable-multilib --with-gmp=/home/abenson/Galacticus/Tools
Thread model: posix
gcc version 4.8.0 20121031 (experimental) (GCC) 

$ gfortran -c bug4.F90 -o bug4.o
bug4.F90:14.13:

end module gn
             1   
Internal Error at (1):
gfc_variable_attr(): Bad array reference


The code is invalid because the "name" function contains "implicit none" but 
the variable "i" used in:

    select type (component => self%cb(i))

is not explicitly defined. If I remove the "implicit none" or explicitly 
define "i" the ICE goes away.


(Reported by Janus at http://gcc.gnu.org/ml/fortran/2012-11/msg00005.html):
With 4.7 the ICE also occurs, but only after the correct error message:

    select type (component => self%cb(i))
                                       1
Error: Symbol 'i' at (1) has no IMPLICIT type


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

end of thread, other threads:[~2014-01-19 12:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-01 22:42 [Bug fortran/55172] New: ICE on invalid: gfc_variable_attr(): Bad array reference abensonca at gmail dot com
2012-11-02 11:07 ` [Bug fortran/55172] [4.7/4.8 Regression] [OOP] " janus at gcc dot gnu.org
2012-11-02 12:10 ` janus at gcc dot gnu.org
2012-11-25 15:55 ` rguenth at gcc dot gnu.org
2012-11-29  8:41 ` jakub at gcc dot gnu.org
2013-01-02 12:35 ` pault at gcc dot gnu.org
2013-01-04 20:51 ` pault at gcc dot gnu.org
2013-01-05  7:52 ` [Bug fortran/55172] [4.7 only] [OOP] gfc_variable_attr(): Bad array reference in SELECT TYPE pault at gcc dot gnu.org
2013-04-11  7:59 ` [Bug fortran/55172] [4.7 Regression] " rguenth at gcc dot gnu.org
2014-01-19 12:20 ` pault 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).