Two internal compiler errors

Janus Weil janus@gcc.gnu.org
Sun Feb 13 11:44:00 GMT 2011


Hi Arjen,

> while experimenting with the object-oriented features of Fortran 2003
> I ran into a few ICEs.

thanks for the test drive :)


> The compiler stops with a message that there was a segmentation fault,
> the reported line is line 56.
> (No syntax errors or other messages of any kind are reported)

Ok, I can confirm this with the current trunk and the following reduction:

program test_objects

   implicit none

   type, abstract :: shape
   end type

   type, extends(shape) :: rectangle
       real :: width, height
   end type

   class(shape), dimension(2) :: object

   object(1) = rectangle( 1.0, 2.0 )

end program test_objects


There are at least two problems with this:
1) Your "object" is missing one of the attributes POINTER or
ALLOCATABLE. Declaring "plain" class objects like this is forbidden.
2) gfortran currently does not support dimensionful class variables.
This of course is not a flaw of your program, but of gfortran ;)

However, it seems the respective error messages are being swallowed by
the ICE (which is caused by the last line). Could you open a PR for
this? I will take care of fixing it ...

Cheers,
Janus



More information about the Fortran mailing list