https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95215
--- Comment #2 from John Donners <john.donners at atos dot net> --- thanks for reviewing this. Indeed, the compiler bug does not occur when using the intelmicemul target: gfortran -foffload=x86_64-intelmicemul-linux-gnu -g -fopenmp -O3 bla.f90 /lib/../lib64/crt1.o: In function `_start': (.text+0x20): undefined reference to `main' /tmp/ccfY1ov8.o: In function `therm_ice_': /home_nfs_robin_ib/bdonnersj/tmp/bla.f90:61: undefined reference to `budget_' /home_nfs_robin_ib/bdonnersj/tmp/bla.f90:61: undefined reference to `budget_' collect2: error: ld returned 1 exit status but it does occur for the nvptx-none target: $ gfortran -foffload=nvptx-none -g -fopenmp -O3 bla.f90 during GIMPLE pass: ompdevlow bla.f90: In function ‘thermodynamics_._omp_fn.1’: bla.f90:45: internal compiler error: in gimplify_expr, at gimplify.c:14079 45 | call therm_ice | 0x7727cf gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc/gcc/gimplify.c:14079 0x77deab gimple_regimplify_operands(gimple*, gimple_stmt_iterator*) ../../gcc/gcc/gimplify-me.c:247 0x89fb57 execute_omp_device_lower ../../gcc/gcc/omp-offload.c:1975 0x89fb57 execute ../../gcc/gcc/omp-offload.c:2011 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. mkoffload: fatal error: x86_64-pc-linux-gnu-accel-nvptx-none-gcc returned 1 exit status compilation terminated. lto-wrapper: fatal error: /software/compilers/gcc-offload/10.1.0/gnu-9.2.0/libexec/gcc/x86_64-pc-linux-gnu/10.1.0//accel/nvptx-none/mkoffload returned 1 exit status compilation terminated. /usr/bin/ld: error: lto-wrapper failed collect2: error: ld returned 1 exit status I do not know what happens for the amdgcn-amdhsa target.