gfortran

Deferred-length character variable causing memory leaks depending on the optimization level

我是研究僧i 提交于 2020-07-30 06:58:11
问题 I am using gfortran 8.4 in Ubuntu with a deferred-length character variable as in the following example: PROGRAM test IMPLICIT NONE CHARACTER(LEN=:),ALLOCATABLE :: str str = '10' END PROGRAM test If I compile it using: gfortran-8 test.f90 -o test -O0 When running the program using Valgrind I get a memory leak: ==29119== HEAP SUMMARY: ==29119== in use at exit: 2 bytes in 1 blocks ==29119== total heap usage: 22 allocs, 21 frees, 13,522 bytes allocated ==29119== ==29119== LEAK SUMMARY: ==29119==

Fortran interface to itself produces annoying error

白昼怎懂夜的黑 提交于 2020-07-19 03:53:50
问题 This problem has been around for a few years, but I never heard of a good solution to it. If a Fortran subroutine includes a module with an interface to itself subroutine stuff(nz,z,dt) use allinterfaces ... an error occurs Error: 'stuff' of module 'allinterfaces', imported at (1), is also the name of the current program unit To fix it I have to declare subroutine stuff(nz,z,dt) use allinterfaces, except_this_one => stuff ... This is absurd behavior and annoying since I like to include all

Reading Binary on different Architectures - Fortran runtime error: I/O past end of record on unformatted file

折月煮酒 提交于 2020-07-10 10:27:19
问题 I am having some issues on reading a binary (unformatted restart file ~2GB ) written within a Fortran program, by the call here below: open(unit=1,file=opfile,status="unknown",form="unformatted") ! write(1) t ! write(1) Rho, Rho_ut, Rho_ur, Rho_uz, Rho_Ya ! close(1) that has been compiled with ifort on an Intel Xeon Phi 7250 CPU (KNL) architecture. When the same code, that has now been compiled with gfortran on an IBM POWER9 AC922 architecture, read this file with the call here below: open

gfortran complains about rank of element in structure constructor for allocatable component

女生的网名这么多〃 提交于 2020-07-03 07:41:29
问题 Consider the following code: subroutine tao_show_this () implicit none type b_struct integer, pointer :: good_user => null() end type type a_struct type (b_struct), allocatable :: value_ptr(:) end type type (a_struct) a a = a_struct() end subroutine Compiling with gfortran 5 or 7 gives: gfortran -c test.f90 test.f90:4:13: type b_struct 1 Error: The rank of the element in the structure constructor at (1) does not match that of the component (0/1) This code compiles fine with ifort. Is this a

How to change gfortran version

ぃ、小莉子 提交于 2020-06-17 13:19:09
问题 I am using Bellhop ray tracing algorithm for MacOS. I have downloaded the source code for MacOS without the binaries. I want to change my gfortran version from 9.2.0 to 8.3.0. I installed it using homebrew. I have version 9.2.0 installed. I have it installed at /usr/bin/ I cannot seem to find any commands online to change the version. gfortran -dumpversion This gave me my version number but I cannot seem to find a command to get a different version. I am working on macOS (Mojave V 10.14.6). I