Silverfrost Forums

Welcome to our forums

Compiler crash

11 Sep 2012 9:22 #10727

Hi. The code below causes the latest compiler to either generate an 'internal compiler error', or bring up a crash dialog. On older versions the compiler generates dodgy code, missing out the type initialisers. Changing the order of some of the use statements, or removing the type initialisers fixes the issue (see code comments).

! Compiling this generates an internal compiler error in 6.30, older versions just
!   generate code that sometimes omits MyType initialisation 
module TypeMod
  type MyType
    integer, pointer:: intArray(:) => NULL()
    integer:: anInt = 0
    integer:: anotherInt = 0   ! comment this out to get crash with dialog rather than 'internal compiler error'
  end type MyType
end module TypeMod

module FunctionMod
contains
  subroutine GetMyType(ht)
    use TypeMod              ! stick this above interface to stop crash
    type(MyType), intent(out):: ht
  end subroutine GetMyType
end module FunctionMod

module FirstMod
  use TypeMod
end module FirstMod

module SecondMod
  use FunctionMod
end module SecondMod

subroutine CrashTheCompiler()
  use FirstMod        ! swap use FirstMod and use SecondMod to stop crash
  use SecondMod
  use TypeMod

  type(MyType):: ht2
end subroutine CrashTheCompiler

[/code]

11 Sep 2012 3:26 #10730

I have logged this for investigation.

13 Mar 2014 3:00 #13834

Some progress has been made on this issue. The crash is now avoided but for the type initialisation to work you still need to put 'USE TypMod' before the CONTAINS. This partial fix will be included in the next release.

Please login to reply.