[Bug fortran/65024] New: Internal compiler error (gfortran) concerning unlimited polymorphic pointer

matt at gneilson dot plus.com gcc-bugzilla@gcc.gnu.org
Wed Feb 11 18:02:00 GMT 2015


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

            Bug ID: 65024
           Summary: Internal compiler error (gfortran) concerning
                    unlimited polymorphic pointer
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: matt at gneilson dot plus.com

Created attachment 34732
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34732&action=edit
Sample program that produces the referenced internal compiler error.

As explained in the GNU Fortran mailing list (see
http://gcc.gnu.org/ml/fortran/2015-02/msg00047.html ).

Please find attached some annotated sample code ('test.f90') that produces the
error in question. The compiler seems to have trouble with the subroutine that
I've named 'BUG' (lines 37-50); more specifically, the compiler appears to be
complaining about line 48 (which I have labelled line "C"). The 'BUG'
subroutine calls the subroutine named 'NEXT' to associate the 'e' pointer with
a piece of preallocated memory, and then points the unlimited polymorphic
'e%info' variable to the piece of memory associated with the pointer 'p'.
Attempting to compile the code as-is produces the following output:

### Beginning of Terminal output ###

matt$ gfortran -v -save-temps -o test test.f90 
Driving: gfortran -mmacosx-version-min=10.10.1 -v -save-temps -o test test.f90
-l gfortran -shared-libgcc
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin14.0.0/4.9.2/lto-wrapper
Target: x86_64-apple-darwin14.0.0
Configured with: ../gcc-4.9-20141029/configure --enable-languages=c++,fortran
Thread model: posix
gcc version 4.9.2 20141029 (prerelease) (GCC) 
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.10.1' '-v' '-save-temps' '-o'
'test' '-shared-libgcc' '-mtune=core2'
 /usr/local/libexec/gcc/x86_64-apple-darwin14.0.0/4.9.2/f951 test.f90 -fPIC
-quiet -dumpbase test.f90 -mmacosx-version-min=10.10.1 -mtune=core2 -auxbase
test -version -fintrinsic-modules-path
/usr/local/lib/gcc/x86_64-apple-darwin14.0.0/4.9.2/finclude -o test.s
GNU Fortran (GCC) version 4.9.2 20141029 (prerelease)
(x86_64-apple-darwin14.0.0)
    compiled by GNU C version 4.9.2 20141029 (prerelease), GMP version 6.0.0,
MPFR version 3.1.2-p10, MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU Fortran (GCC) version 4.9.2 20141029 (prerelease)
(x86_64-apple-darwin14.0.0)
    compiled by GNU C version 4.9.2 20141029 (prerelease), GMP version 6.0.0,
MPFR version 3.1.2-p10, MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
test.f90: In function ‘bug’:
test.f90:48:0: internal compiler error: in gfc_conv_component_ref, at
fortran/trans-expr.c:1660
       e%info => p      ! line "C"
 ^

test.f90:48:0: internal compiler error: Abort trap: 6
gfortran: internal compiler error: Abort trap: 6 (program f951)
Abort trap: 6

### End of Terminal output ###

Oddly enough, the code compiles without error if I comment-out the call to
'NEXT' (line 42, which I've labelled line "A") and uncomment lines 43-45 (which
I've labelled lines "B_1", "B_2", and "B_3"), even though the 'NEXT' subroutine
contains *exactly* the same content as lines 43-45.

Andre Vehreschild responded to my post on the GNU Fortran mailing list, and he
recommended that I add the following information:

"When translating the pointer assignment in the select type the backend_decl of
the _vptr's component-ref is not initialized (== NULL), leading to the crash
experienced here. I haven't encountered something similar yet, therefore I can
only guess: Something going wrong in the resolve-stage?"


More information about the Gcc-bugs mailing list