Questions tagged [gfortran]

gfortran is the GNU Fortran compiler, part of GCC. It implements the Fortran 95 standard and much of the Fortran 2008 standard. This tag should be used for questions relating to the use and behaviour of gfortran specifically; questions about the Fortran language or compilers more widely should include the Fortran tag.

See Gfortran documentation at the GCC online documentation.

2696 questions
57
votes
3 answers

Undefined reference to `omp_get_max_threads_'

I'm getting the following errors trying to compile a project: (fortran, using gfortran) undefined reference to `omp_get_max_threads_' undefined reference to `omp_get_thread_num_' Problem is, my GCC version is 4.4.3, which was suppose to support…
GennSev
  • 1,586
  • 4
  • 20
  • 29
46
votes
2 answers

What flags do you set for your GFORTRAN debugger/compiler to catch faulty code?

I think I won't find that in any textbook, because answering this takes experience. I am currently in the stage of testing/validating my code / hunting bugs to get it into production state and any errors would lead to many people suffering e.g. the…
tarrasch
  • 2,630
  • 8
  • 37
  • 61
45
votes
11 answers

Building R package and error "ld: cannot find -lgfortran"

I'm trying to install the package lars. Ubuntu 11.04 Natty 64-bit. From building I get: * installing *source* package âlarsâ ... ** libs gfortran -fpic -O3 -pipe -g -c delcol.f -o delcol.o gcc -shared -o lars.so delcol.o -lgfortran -lm…
Andrew Redd
  • 4,632
  • 8
  • 40
  • 64
37
votes
4 answers

Where to put `implicit none` in Fortran

Do I need to put implicit none inside every function and subroutine? Or is it enough to put it at the beginning of the module containing these functions and subroutines? Or is it enough to put it at the beginning of the program that is using these…
Fabricator
  • 12,722
  • 2
  • 27
  • 40
27
votes
1 answer

Can not install gfortran via homebrew

I got this message when i tried to install gfortran. ~$ brew install gfortran Error: No available formula for gfortran GNU Fortran is now provided as part of GCC, and can be installed with: brew install gcc My question is how to install gfortran…
fronthem
  • 4,011
  • 8
  • 34
  • 55
26
votes
13 answers

Mac OS X R error "ld: warning: directory not found for option"

I am trying to install an R package from source, but getting an error: * installing *source* package ‘mclust’ ... ** package ‘mclust’ successfully unpacked and MD5 sums checked ** libs gfortran-4.8 -fPIC -g -O2 -c mclust.f -o…
burger
  • 5,683
  • 9
  • 40
  • 63
22
votes
2 answers

Specify directory where gfortran should look for modules

I currently compile programs based on modules (such as main program foo which depends on module bar) as follows: gfortran -c bar.f90 gfortran -o foo.exe foo.f90 bar.o This works fine when foo.f90 and bar.f90 are in the same directory. How do I…
astay13
  • 6,857
  • 10
  • 41
  • 56
21
votes
3 answers

Stop fortran program with non-zero exit status

I'm adapting some Fortran code I haven't written, and without a lot of fortran experience myself. I just found a situation where some malformed input got silently ignored, and would like to change that code to do something more appropriate. If this…
MvG
  • 57,380
  • 22
  • 148
  • 276
21
votes
3 answers

How to pass allocatable arrays to subroutines in Fortran

The following code is returning a Segmentation Fault because the allocatable array I am trying to pass is not being properly recognized (size returns 1, when it should be 3). In this page (http://www.eng-tips.com/viewthread.cfm?qid=170599) a similar…
Nordico
  • 1,226
  • 2
  • 15
  • 31
19
votes
2 answers

gfortran for dummies: What does mcmodel=medium do exactly?

I have some code that is giving me relocation errors when compiling, below is an example which illustrates the problem: program main common/baz/a,b,c real a,b,c b = 0.0 call foo() print*, b end subroutine foo() common/baz/a,b,c …
mgilson
  • 300,191
  • 65
  • 633
  • 696
18
votes
1 answer

Force gfortran to stop program at first NaN

To debug my application (fortran 90) I want to turn all NaNs to signalling NaN. With default settings my program works without any signals and just outputs NaN data in file. I want find the point, where NaN is generated. If I can recompile program…
osgx
  • 90,338
  • 53
  • 357
  • 513
17
votes
4 answers

Reducing the size of scipy and numpy for aws lambda deployment

I am trying to deploy a python application on aws lambda. It has several large python dependencies, the largest being scipy and numpy. The result is that my application is significantly larger than the allowed 250MB. While trying to find a way to…
joek575
  • 561
  • 5
  • 9
16
votes
2 answers

gfortran line length limit

Is there a way of disabling the line length limit in the gfortran compiler? I am porting from ifort to gfortran and I wonder if there is an easy way to do so without going through the code and introduce line continuation by hand everywhere where it…
DaPhil
  • 1,509
  • 4
  • 25
  • 47
15
votes
1 answer

Does gfortran take advantage of DO CONCURRENT?

I'm currently using gfortran 4.9.2 and I was wondering if the compiler actually know hows to take advantage of the DO CONCURRENT construct (Fortran 2008). I know that the compiler "supports" it, but it is not clear what that entails. For example, if…
15
votes
2 answers

Fortran derived type assignment

Say I have a Fortran derived type type :: atype integer :: n integer :: a(10) integer, allocatable :: b(:) end type and I have two instances of this type type(atype) :: t1, t2 what exactly happens when I do the following…
stiaan
  • 153
  • 1
  • 6
1
2 3
99 100