2

I have been trying to compile an O-O fortran code with the fortran compiler of the Oracle Solaris Studio 12.4 suite (the latest as far as I know). But the compiler crashes. Here is a simplified version of my problem.

I define two simple types with one type-bound procedure each. One of the procedures has a variable of the other type as dummy argument:

MODULE MY_MODULE

   type type0
      real :: value = 0 
   contains
      procedure :: print_value
   end type type0

   type type1
      real :: value = 0
   contains
      procedure :: print_diff
   end type type1

CONTAINS

   subroutine print_value(self)
      class(type0), intent(in) :: self
      print*, self%value 
   end subroutine print_value

   subroutine print_diff(self,var0)
      class(type1), intent(in) :: self
      type(type0), intent(in) :: var0
      print*,self%value - var0%value
   end subroutine print_diff

END MODULE MY_MODULE

PROGRAM MY_PROG

   use my_module, only: type0,type1
   type(type0) :: var0
   type(type1) :: var1

   var0%value = 3
   var1%value = 10

   call var1%print_diff(var0)

END PROGRAM MY_PROG

This program compiles and executes fine with gfortran:

[> gfortran myprog.f03 -o myprog.x
[> ./myprog.x
        7.0

However, compilation with the Solaris f95 crashes:

[> f95 myprog.f03 -o myprog.x
   f90: Internal Error, code=fw-interface-ctyp1-796, last src=myprog.f03:4

If I do any further simplification to the source code, then f95 compiles successfully. For instance, it works fine if:

  • type0 has no type-bound procedure
  • type1 has no type-bound procedure
  • procedure print_diff is replaced by a subroutine with no other argument than self

Is there anything I am doing wrong? Is there an installation problem with my Solaris compiler? Is someone able to compile this code successfully with an other Solaris compiler? Does someone know what the error code means (I haven't been able to find that out)?

Reno
  • 81
  • 3
  • 1
    In general "internal error" means the compiler has a bug. This is something to discuss with the vendor, usually. – francescalus Nov 24 '15 at 10:08
  • 1
    Ican confirm the error on my machine. With gfortran it compiles and prints 7. It is a bug in the compiler and you have to report it to Oracle. A patch might be available to paying customers only. You can try to find a workaround. – Vladimir F Героям слава Nov 24 '15 at 10:49
  • Isn't this F2003 code? So what makes you think you could compile it with a F95 compiler? Disclaimer: I've never used Oracle's compiler before. – NoseKnowsAll Nov 24 '15 at 16:15
  • @NoseKnowsAll: Well, f95 based on fortran95 standard but it also includes numerous 200x features/extensions. In particular, the documentation states: "Complete support for polymorphism in Fortran 2003 is available." Maybe it does not include full support of type-bound procedures. – Reno Nov 24 '15 at 17:03
  • 1
    It formally supports them, but they have a bug. Read again: **`Internal Error`**. It is as simple as that, a bug in a piece of software (a compiler). Nothing new. Report and hope it to be fixed. It may have been already fixed, but the patch may be unavailable to you. It depends whether you pay for the support to Oracle. – Vladimir F Героям слава Nov 24 '15 at 17:38
  • Obviously the compiler is not supposed to crash. If some feature is not supported, it is supposed to tell the user and return an compilation error message. I rather meant that OO features might still be at some experimental or not-well-tested stage with this compiler (although they state differently), as compared to non-OO standards. Hence more bugged. I sent a notice to Oracle earlier this afternoon. Waiting for feedback from them... – Reno Nov 24 '15 at 20:23

1 Answers1

0

After reporting my problem to Oracle, I just got their answer:

Thank you for reporting this and sorry for the problem. This is a known problem. It has already been fixed in our current development and ported to Studio 12.4. If you have a support contract, you can get the Studio 12.4 patch for it, otherwise the next release will contain the fix.

Reno
  • 81
  • 3