flang-compiler / flang

Flang is a Fortran language front-end designed for integration with LLVM.
Other
800 stars 134 forks source link

Internal compiler error. get_int_cval-not ST_CONST #138

Closed janusw closed 7 years ago

janusw commented 7 years ago

Dear flang team,

compiling the attached file minkowski.f90 (had to rename to txt to attach) with the current master results in an ICE:

$ flang minkowski.f90 
F90-F-0000-Internal compiler error. get_int_cval-not ST_CONST       0 (minkowski.f90: 62)
F90/x86-64 Linux Flang - 1.5 2017-05-01: compilation aborted

I'm pretty sure it's valid Fortran (95?) code. At least I'm aware of four other compilers which can handle it without a problem (gfortran, ifort, sunf95, pgf95). The example is a reduced version of https://github.com/janusw/GiBUU_2016/blob/master/code/numerics/minkowski.f90.

Cheers, Janus

sscalpone commented 7 years ago

Hi Janus, do you have the modules handy. constants and matrix_module.

janusw commented 7 years ago

Hi Janus, do you have the modules handy. constants and matrix_module.

Sure, they're here: https://github.com/janusw/GiBUU_2016/blob/master/code/database/constants.f90 https://github.com/janusw/GiBUU_2016/blob/master/code/numerics/matrix_module.f90

In any case, the reduced example I attached is self-contained and does not need any other modules ...

Cheers, Janus

janusw commented 7 years ago

Further reduced test case:

module ones_and_zeros

  implicit none

  real, parameter :: zero(2,2) = 0.
  real, parameter ::  one(2,2) = reshape((/ 1., 0., &
                                            0., 1. /), (/2,2/))
  real, parameter :: minus_one(2,2) = reshape(zero-one, (/2,2/))

end module

Same error as before.

janusw commented 7 years ago

Just tried the fix in b0cd28f: Works like a charm and (almost) makes all of https://github.com/janusw/GiBUU_2016 compile well with flang.

Thanks for the quick fix!

Cheers, Janus