LKedward / fhash

fpm package implementing a hash table with support for generic keys and values.
https://lkedward.github.io/fhash/
MIT License
38 stars 8 forks source link

Intel fortran build error: intrinsic assignment error #9

Open glemieux opened 3 years ago

glemieux commented 3 years ago

When building a program with fhash as a dependency using fpm specifying ifort as the compiler I received the following error:

$ fpm build --compiler ifort
 + ifort -c app/main.f90 -warn all -check:all:noarg_temp_created -error-limit 1 -O0 -g -assume byterecl -traceback -module build/ifort_BFE5DBA90E3838BC/mapred_project -I build/ifort_BFE5DBA90E3838BC/mapred_project -o build/ifort_BFE5DBA90E3838BC/mapred_project/app_main.f90.o
 + ifort -c build/dependencies/fhash/src/fhash_data_container.f90 -warn all -check:all:noarg_temp_created -error-limit 1 -O0 -g -assume byterecl -traceback -module build/ifort_BFE5DBA90E3838BC/mapred_project -I build/ifort_BFE5DBA90E3838BC/mapred_project -o build/ifort_BFE5DBA90E3838BC/mapred_project/build_dependencies_fhash_src_fhash_data_container.f90.o
build/dependencies/fhash/src/fhash_data_container.f90(96): error #8304: In an intrinsic assignment statement, variable shall not be polymorphic.   [RAW]
      raw = data
------^
build/dependencies/fhash/src/fhash_data_container.f90(244): catastrophic error: Too many errors, exiting
compilation aborted for build/dependencies/fhash/src/fhash_data_container.f90 (code 1)
 Command failed
ERROR STOP 

Error termination. Backtrace:
#0  0x55ccb6e5409c in ???
#1  0x55ccb6e622bb in ???
#2  0x55ccb6e625ac in ???
#3  0x2ba3f5588e8b in GOMP_parallel
    at /home/conda/feedstock_root/build_artifacts/ctng-compilers_1610729750655/work/.build/x86_64-conda-linux-gnu/src/gcc/libgomp/parallel.c:171
#4  0x55ccb6e8a65f in ???
#5  0x55ccb6e97142 in ???
#6  0x55ccb6e2613f in ???
#7  0x2ba3f58fc554 in ???
#8  0x55ccb6e261b8 in ???
LKedward commented 3 years ago

Thanks for reporting @glemieux; looks like I'm doing something non-standard here. I didn't get the same error as you reported, but I've put together a fix (see #10) that now seems to work with ifort 2021.1.2. Which version of ifort are you running?

If you get a chance, would you be able to trial the proposed fix in your fpm project:

[dependencies]
fhash = { git = "https://github.com/LKedward/fhash.git" , branch="fix-ambig-generic"}
glemieux commented 3 years ago

Thanks for taking a look at this. I'm running ifort 17.0.1 20161005. The error still seems to be persisting, unfortunately.

LKedward commented 3 years ago

Thanks, it looks like assignment to an allocatable polymorphic variable is not supported in your version of ifort (support was added in v18.0).

I can get the library compiling with ifort 17.0.1 if I replace these assignment statements with explicit allocation statements, unfortunately I then run into strange runtime errors with the tests and demos which I can only put down to a compiler bug.