flang-compiler / flang

Flang is a Fortran language front-end designed for integration with LLVM.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

flang bug about cbind

renren7111 opened this issue · comments

there is an error when compiling XIOS (lib of NEMO ocean model):
##############################
mpifort -o iduration.o -I/model/LLVM/NEMO/XIOS/inc -Mbyteswapio -Mfreeform -D__NONE__ -O3 -I /netcdf/include -I/model/LLVM/NEMO/XIOS/extern/boost -I/model/LLVM/NEMO/XIOS/extern/blitz -c /model/LLVM/NEMO/XIOS/ppsrc/xios/interface/fortran/iduration.f90
/tmp/iduration-cc5294.ll:1399:63: error: expected '('
declare void @cxios_duration_neg(%struct.xios_duration.5* sret, %struct.xios_duration.5* noalias byval (%struct.xios_duration.5 ))
^
1 error generated.
fcm_internal compile failed (256)
gmake: *** [iduration.o] Error 1
gmake -f /model/LLVM/NEMO/XIOS/Makefile -j 1 -s all failed (2) at /model/LLVM/NEMO/XIOS/tools/FCM_NEW/bin/../lib/FCM1/Build.pm line 611.
->Make: 2 seconds
->TOTAL: 6 seconds
Build failed on Tue Sep 26 09:14:51 2023.
##############################

iduration.f90:
FUNCTION xios_duration_neg(dur) RESULT(res)
USE DURATION_INTERFACE, only : xios_duration
IMPLICIT NONE
TYPE(xios_duration), INTENT(IN) :: dur
TYPE(xios_duration) :: res
res = cxios_duration_neg(dur)
END FUNCTION xios_duration_neg

duration_interface.f90:
TYPE(xios_duration) FUNCTION cxios_duration_neg(dur) BIND(C)
USE ISO_C_BINDING
IMPORT :: xios_duration
TYPE(xios_duration), VALUE :: dur
END FUNCTION cxios_duration_neg

icduration.cpp:
cxios_duration cxios_duration_neg(cxios_duration dur_c)
TRY
{
xios::CDuration dur( dur_c.year, dur_c.month, dur_c.day, dur_c.hour, dur_c.minute, dur_c.second, dur_c.timestep );
xios::CDuration res = -dur;
return { res.year, res.month, res.day, res.hour, res.minute, res.second, res.timestep };
}
CATCH_DUMP_STACK

@renren7111 This should have been fixed by #1420. Can you rebuild the compiler from the master branch and try again?

Thanks,it has been fixed.