flang-compiler / flang

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

Compiler error when building siesta application #531

Closed kiranchandramohan closed 5 years ago

kiranchandramohan commented 6 years ago

Siesta (https://launchpad.net/siesta) is an open source application for electronic structure calculations and ab initio molecular dynamics simulations.

The following internal error is produced by the compiler while compiling the file Src/m_mixing.F90 in the Siesta application.

/tmp/m_mixing-13a554.ll:358: error: use of undefined type named 'struct.BSS12'
%5 = bitcast %struct.BSS12* @.BSS12 to i64*

The lines in questions are:

call fake_history_from_linear(mix%next)
call fake_history_from_linear(mix%next_conv)

where the module variables are defined higher up in the module initialisation section as:

! The next mixing method following this method
type(tMixer), pointer :: next => null()

! The next mixing method following this method
type(tMixer), pointer :: next_conv => null()

Note : If the save statement is removed then the compilation passes successfully.

pawosm-arm commented 6 years ago

This is the problem with modulewise SAVE attribute. I've hit this problem before when one of my proposed fixes made RAPS16 to fail and I had to close my pull request and propose different solution: https://github.com/flang-compiler/flang/pull/469

pawosm-arm commented 5 years ago

I'm able to build m_mixing.F90 of siesta-4.1-b4 without errors or warnings. Can be closed I guess?

kiranchandramohan commented 5 years ago

Thanks, @pawosm-arm for informing. Thanks, @gklimowicz for the fix.