Questions tagged [flang]

Flang is the LLVM Fortran compiler.

Flang is the LLVM Fortran compiler. It was previously called F18. There were other LLVM Fortran compiler projects that used the flang name.

15 questions
2
votes
1 answer

First compilation of Fortran 90 with flang in FreeBSD 12

I am trying to get a 'hello world' type program compiled in FreeBSD 12 with flang. This is my source code: PROGRAM MAIN INTEGER :: X PRINT *, "Please, enter a number" READ (*, *) X PRINT *, "The square root of ", X, " is ", SQRT(X) END…
M.E.
  • 4,955
  • 4
  • 49
  • 128
1
vote
0 answers

SIZEOF() extension in Flang

Does anyone know whether the "new" Flang LLVM Fortran frontend (available since LLVM 12) or the "old"/"classic" Flang compiler (based on PGI/NVIDIA) support the SIZEOF() function as a Fortran extension? This inquiry function is not in the Fortran…
wyphan
  • 216
  • 3
  • 12
1
vote
0 answers

Force function inline in LLVM

I have a function written in fortran: !function.f90 subroutine ffunc(i, x) use iso_c_binding implicit none integer(c_int), value :: i integer(c_int) :: x(*) x(1) = i end and c function: extern "C" void cfunction(int i, long* x) { x[0] =…
0
votes
0 answers

LLVM_ENABLE_PROJECTS requests clang but directory not found

C:\Flang\llvm-16\llvm-16.0.0\build2>cmake -G "Visual Studio 17 2022" -A x64 -DLLVM_ENABLE_PROJECTS="flang;clang" -DCMAKE_INSTALL_PREFIX="C:\Flang\FlangInstall" .. -- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.22621. --…
0
votes
1 answer

How to link to the standard libraries statically in flang-new like GFortran?

I have a C++ project that uses Fortran. When compiling under GCC, I can link in Fortran statically using target_link_libraries(Project -static-libgfortran gfortran). However, I am now compiling the same project using Clang, which means instead of…
Tyler Shellberg
  • 1,086
  • 11
  • 28
0
votes
2 answers

`d` specifier in `ignore_tkr` directive

I have this old code module foo interface subroutine bar(A) !dir$ ignore_tkr(trd) A DOUBLE COMPLEX, DIMENSION(*) :: A end subroutine end interface end module foo This is compiled fine by nvfortan and gfortran…
0
votes
0 answers

flang can not find iso_c_bindings while encapsulating a C function from a static library

I have a static library named mylib.a written in C and I am trying to do my first call to C from Fortran. I want to invoke in Fortran the following function contained in the C library: double get_step(double value); I try the following Fortran…
M.E.
  • 4,955
  • 4
  • 49
  • 128
0
votes
0 answers

Is there any reason why the library OMPtrace does not work on large codes?

I have a code that I parallelized using OpenMP. I want to make sure that the threads deployed follow the same sequence diagram that I have in mind. In order to do that, I looked for an efficient tool (library, software,..) and found the lib OMPTrace…
hakim
  • 139
  • 15
0
votes
0 answers

What shall be used in recl when opening a file in unformatted direct access?

I am trying to fully understand how to deal with binary files in Fortran. Specifically, I am reading this https://atmos.washington.edu/~salathe/osx_unix/endian.html which covers how to write binary files when the records to be written are…
M.E.
  • 4,955
  • 4
  • 49
  • 128
0
votes
0 answers

Why flang Fortran print adds a new line at a certain width?

I am trying to print a long line of integer type variables. If I do: print *, tape_data(i)%ts%year, tape_data(i)%ts%month, tape_data(i)%ts%day, & tape_data(i)%ts%hour, tape_data(i)%ts%minute,…
M.E.
  • 4,955
  • 4
  • 49
  • 128
0
votes
0 answers

Why I get Corrupted module compiling message while trying to put derived types in a module?

I am learning how to distribute the code across modules in Fortran 95. I have the following code which intends to use two derived types: file_parser_2.f95 program file_parser_2 use data_model_2 implicit none !…
M.E.
  • 4,955
  • 4
  • 49
  • 128
0
votes
0 answers

How to detect end of data in standard input in Fortran 95?

I am trying to read a CSV dataset in Fortran 95. I have originally asked this question which has been marked as duplicate, two posts have been suggested. However, when I incorporate the posts check for iostat I still get Segmentation Overflow. The…
M.E.
  • 4,955
  • 4
  • 49
  • 128
0
votes
0 answers

Functionality of libflang `sect` calls

I was looking at the perf profile for one of the spec2017 benchmark compiled with llvm. I saw hotness in few of the libflang routines. But I am not able to figure out what is the functionality of f90_sect_i8 function. I searched for sect calls but…
Maximus
  • 285
  • 5
  • 19
0
votes
1 answer

LLVM Can't cast array type to ConstantArray

I'm trying to cast an array of type [3 x double] to a ConstantArray to eventually change the underlying type from double to float. But whenever I try to cast it fails and I haven't been able to figure out why. The snippet of code from the pass that…
Aroic
  • 479
  • 2
  • 12
0
votes
1 answer

LLVM GetAnalysis() failing with required passes

I have a custom set of passes created using LLVM to run on some bitcode. I've managed to get it to compile, but whenever I try to run it with a pass that calls getAnalysis() on another pass type it fails with: Assertion `ResultPass &&…
Aroic
  • 479
  • 2
  • 12