diff --git a/integration_tests/CMakeLists.txt b/integration_tests/CMakeLists.txt index bed67f058c..bb9b5cc511 100644 --- a/integration_tests/CMakeLists.txt +++ b/integration_tests/CMakeLists.txt @@ -1832,6 +1832,8 @@ RUN(NAME openmp_37 LABELS gfortran GFORTRAN_ARGS -fopenmp) RUN(NAME openmp_38 LABELS gfortran GFORTRAN_ARGS -fopenmp) RUN(NAME openmp_39 LABELS gfortran GFORTRAN_ARGS -fopenmp) +RUN(NAME fortran_01 LABELS gfortran llvm fortran) + RUN(NAME compiler_version_01 LABELS gfortran llvm llvm_wasm llvm_wasm_emcc) RUN(NAME exit_01 LABELS gfortran llvm llvm_wasm llvm_wasm_emcc) diff --git a/integration_tests/fortran_01.f90 b/integration_tests/fortran_01.f90 new file mode 100644 index 0000000000..16c890c03f --- /dev/null +++ b/integration_tests/fortran_01.f90 @@ -0,0 +1,7 @@ +program fortran_01 + use iso_c_binding, only: c_ptr!, c_loc + implicit none + integer, pointer :: x + type(c_ptr) :: ptr + ! ptr = c_loc(x) +end program \ No newline at end of file diff --git a/src/libasr/codegen/asr_to_fortran.cpp b/src/libasr/codegen/asr_to_fortran.cpp index 04c4210bfa..8bcdfe6196 100644 --- a/src/libasr/codegen/asr_to_fortran.cpp +++ b/src/libasr/codegen/asr_to_fortran.cpp @@ -246,6 +246,9 @@ class ASRToFortranVisitor : public ASR::BaseVisitor import_struct_type.push_back(struct_name); } break; + } case ASR::ttypeType::CPtr: { + r = "type(c_ptr)"; + break; } default: throw LCompilersException("The type `"