0

Venturing out the bash profile in https://repl.it/, their installation includes both gcc as well as gfortran:

gcc --version
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
[...]
gfortran --version
GNU Fortran (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
[...]

I have no difficulty to compile a code compliant to Fortran95 with either one of the two. Yet, as gfortran is part of gcc (reference), where are functional advantages to use either the specialist (gfortran), or the collection (gcc)?

Buttonwood
  • 194
  • 1
  • 10
  • I had no idea fortran could be compiled with gcc. – orangecaterpillar Mar 24 '20 at 13:27
  • Note that both `gcc` and `gfortran` are parts of GCC (GNU compiler collection). For `gcc` to be able to compile Fortran the Fortran frontend must be installed in the GCC installation. See also https://stackoverflow.com/questions/172587/what-is-the-difference-between-g-and-gcc?rq=1 – Vladimir F Героям слава Mar 24 '20 at 13:47
  • @orangecaterpillar The opposite here; only because a .f95 shall be used in pure Windows instead of Debian, I learnt about g95 and gfortran ... – Buttonwood Mar 24 '20 at 13:57

1 Answers1

1

This is documented in the GNU Fortran manual:

A gfortran driver program is also provided, which is identical to gcc except that it automatically links the Fortran runtime libraries into the compiled program.

If your program does not depend on the Fortran run-time library, then you can link it successfully using gcc. The situation is similar to that of C++ and g++, except that C++ run-time library dependencies are perhaps more common.

Florian Weimer
  • 32,022
  • 3
  • 48
  • 92