# GFortran releases

**URL:** <https://fortran-lang.discourse.group/t/gfortran-releases/2704>\
**Category:** Announcements\
**Created:** [January 31, 2022, 3:25pm UTC](https://fortran-lang.discourse.group/t/gfortran-releases/2704 "2022-01-31T15:25:57Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![vmagnin](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/vmagnin/32/28_2.png) [@vmagnin](https://fortran-lang.discourse.group/u/vmagnin)\
**Post date:** [January 31, 2022, 3:25pm UTC](https://fortran-lang.discourse.group/t/gfortran-releases/2704/1 "2022-01-31T15:25:57Z")

</div>

Each GCC release comes with specific Fortran improvements. This is a place to announce or discuss these new GFortran features. And global GCC improvements can of course also be discussed.

[https://gcc.gnu.org/gcc-11/changes.html](https://gcc.gnu.org/gcc-11/changes.html)

> - GCC 11 adds support for non-rectangular loop nests in OpenMP constructs and the allocator routines of [OpenMP 5.0](https://www.openmp.org/specifications/), including initial `allocate` clause support in C/C++. The `OMP_TARGET_OFFLOAD` environment variable and the active-levels routines are now supported. For C/C++, the `declare variant` and `map` support has been extended. **For Fortran, OpenMP 4.5 is now fully supported and OpenMP 5.0 support has been extended, including the following features which were before only available in C and C++: `order(concurrent)` , `device_type` , memorder-clauses for `flush` , `lastprivate` with `conditional` modifier, `atomic` construct and `reduction` clause extensions of OpenMP 5.0, `if` clause with `simd` and `cancel` modifiers, `target data` without `map` clause, and limited support for the `requires` construct.**
> - **Version 2.6 of the [OpenACC](https://www.openacc.org/) specification continues to be maintained and improved in the C, C++ and Fortran compilers.** See the [implementation status](https://gcc.gnu.org/wiki/OpenACC/Implementation%20Status#status-11) section on the OpenACC wiki page and the [run-time library documentation](https://gcc.gnu.org/onlinedocs/gcc-11.1.0/libgomp/Enabling-OpenACC.html) for further information.
> - **Fortran: Added `DEPRECATED` to `!GCC$` 's `attributes` directive.**

---

<div class="post-metadata">

**Author:** ![vmagnin](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/vmagnin/32/28_2.png) [@vmagnin](https://fortran-lang.discourse.group/u/vmagnin)\
**Post date:** [January 31, 2022, 3:28pm UTC](https://fortran-lang.discourse.group/t/gfortran-releases/2704/2 "2022-01-31T15:28:42Z")

</div>

Note that GCC 12.0.1 is available in Fedora Rawhide. But the first stable version of GCC 12 will be GCC 12.1, expected to be released in April 2022.

[https://www.gnu.org/software/gcc/gcc-12/changes.html](https://www.gnu.org/software/gcc/gcc-12/changes.html)

> **OpenMP**
> 
> - OpenMP 5.0 support has been extended: The `close` map modifier and the `affinity` clause are now supported. **In addition Fortran gained additionally the following features which were available in C and C++ before: `declare variant` is now available, `depobj` , `mutexinoutset` and `iterator` can now also be used with the `depend` clause, `defaultmap` has been updated for OpenMP 5.0, and the `loop` directive and combined directives involving the `master` directive have been added.**
> - The following OpenMP 5.1 features have been added: support for expressing OpenMP directives as C++ 11 attributes, the `masked` and `scope` construct, the `nothing` and `error` directives, and using `primary` with the `proc_bind` clause and `OMP_PROC_BIND` environment variable, the `reproducible` and `unconstrained` modifiers to the `order` clause, and, for C/C++ only, the `align` and `allocator` modifiers to the `allocate` clause and the `atomic` extensions are now available. The `OMP_PLACE` environment variable supports the OpenMP 5.1 features. In addition the `OMP_NUM_TEAMS` and `OMP_TEAMS_THREAD_LIMIT` environment variables and their associated API routines are now supported **as well as the memory-allocation routines added for Fortran and extended for C/C++ in OpenMP 5.1. In Fortran code, strictly structured blocks can be used.**
> - The [OpenMP Implementation Status](https://gcc.gnu.org/onlinedocs/libgomp/OpenMP-Implementation-Status.html) can be found in the libgomp manual.

> **Fortran:** OpenMP code using the `omp_lib.h` include file can no longer be compiled with `-std=f95` but now requires at least `-std=f2003` . Alternatively, use the `omp_lib` module, which still supports `-std=f95` and is recommended to be used instead in general.

> **Fortran**
> 
> - **WG5/N1942, “TS 29113 Further Interoperability of Fortran with C”, is now fully supported.** In addition to implementing previously missing functionality, such as support for character arguments of length greater than one in functions marked `bind(c)` and gaps in the handling for assumed-rank arrays, numerous other bugs have been fixed, and an extensive set of new conformance test cases has been added.
> - GCC 12 now uses `OPERATION` as the name of the function to the `CO_REDUCE` intrinsic for the pairwise reduction, thus conforming to the **Fortran 2018 standard.** Previous versions used `OPERATOR` which conforms to TS 18508.

---

<div class="post-metadata">

**Author:** ![Pap](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/pap/32/1305_2.png) [@Pap](https://fortran-lang.discourse.group/u/Pap)\
**Post date:** [February 22, 2022, 7:04pm UTC](https://fortran-lang.discourse.group/t/gfortran-releases/2704/3 "2022-02-22T19:04:01Z")

</div>

The problem with GCC is that only extreme rolling distributions in the “bleeding edge” actually provide the latest version in their repositories. More conventional distributions are usually some versions behind. For example, Debian “stable” is at GCC 10.2 and won’t change until their next stable version. I am mainly using Slackware and Slackware-current based distributions (named Salix and Slackel, respectively). Slackware stable was stuck at GCC 5.5.0 for years, and only recently they switched to GCC 11.2 in the new Slackware version (they skipped everything between 5.5 and 11.2). Slackware-current is a rolling distribution so it’s more up-to-date, but still not a bleeding edge distribution. I am guessing it will take a few months for them to move to GCC 12.0.1, and by then GCC 12.1 or more will be out.

A solution to the problem is to download and compile the GCC bundle yourself (I typically compile only what’s needed for gfortran). It is not hard to do that, but it’s not easy either (like 1-2 hours of intense compiling using every single thread your CPU has, and typically with computer’s fans spinning fast). Not to mention a new GCC version may or may not change something in the configuration files, so you have to deeply dive into their READMEs to see if anything has to be configured differently than the previous version.

---

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [February 22, 2022, 7:30pm UTC](https://fortran-lang.discourse.group/t/gfortran-releases/2704/4 "2022-02-22T19:30:58Z")

</div>

To easily stay on the open source cutting edge, at least for Fortran, you can use Windows :). From [equation.com](http://www.equation.com/servlet/equation.cmd?fa=fortran) you can download a gfortran binary snapshot, currently

GNU Fortran (GCC) 12.0.1 20220213 (experimental)

I have used the gfortran binaries from this site for years.

---

<div class="post-metadata">

**Author:** ![Pap](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/pap/32/1305_2.png) [@Pap](https://fortran-lang.discourse.group/u/Pap)\
**Post date:** [February 22, 2022, 7:36pm UTC](https://fortran-lang.discourse.group/t/gfortran-releases/2704/5 "2022-02-22T19:36:41Z")

</div>

> [@Beliavsky](#):
>
> To easily stay on the open source cutting edge, at least for Fortran, you can use Windows :

Never, ever, ever 😆 But it’s good to know about it.  
However their website doesn’t seem to work well with Firefox. Maybe they want me to use… Edge.

---

<div class="post-metadata">

**Author:** ![vmagnin](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/vmagnin/32/28_2.png) [@vmagnin](https://fortran-lang.discourse.group/u/vmagnin)\
**Post date:** [February 22, 2022, 8:23pm UTC](https://fortran-lang.discourse.group/t/gfortran-releases/2704/6 "2022-02-22T20:23:57Z")

</div>

That’s a distribution problem, not a GFortran problem.  
Is there any external packager like conda in Slackware to install GFortran?

---

<div class="post-metadata">

**Author:** ![Pap](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/pap/32/1305_2.png) [@Pap](https://fortran-lang.discourse.group/u/Pap)\
**Post date:** [February 22, 2022, 8:44pm UTC](https://fortran-lang.discourse.group/t/gfortran-releases/2704/7 "2022-02-22T20:44:06Z")

</div>

> [@vmagnin](#):
>
> Is there any external packager like conda in Slackware to install GFortran?

Yes, of course it is a distribution problem. You can use external packagers, but usually I either wait for the next distribution release, or use Slackware-current, or Void Linux. In this particular case, I had to do so, because they delayed next version more than they usually do. Imagine, GCC 5.5 for almost six years… It didn’t even support submodules. 😆

---

<div class="post-metadata">

**Author:** ![vmagnin](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/vmagnin/32/28_2.png) [@vmagnin](https://fortran-lang.discourse.group/u/vmagnin)\
**Post date:** [February 22, 2022, 8:50pm UTC](https://fortran-lang.discourse.group/t/gfortran-releases/2704/8 "2022-02-22T20:50:03Z")

</div>

> [@Pap](#):
>
> Imagine, GCC 5.5 for almost six years…

A nightmare 🎃 !

I tried Slackware a long time ago, at the end of the 90’s. It was courageous 😵‍💫, as it was my first Linux distro! And hardware problems were frequent in those days… I don’t remember how much time I was able to stick with it…

---

<div class="post-metadata">

**Author:** ![Pap](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/pap/32/1305_2.png) [@Pap](https://fortran-lang.discourse.group/u/Pap)\
**Post date:** [February 22, 2022, 9:30pm UTC](https://fortran-lang.discourse.group/t/gfortran-releases/2704/9 "2022-02-22T21:30:08Z")

</div>

Slackware was for… adventurous people back in the 90s. Nowadays, it is much easier. There is a saying, “if you install distro X, you learn distro X, if you install Slackware, you learn Linux”.  
However, I do not use Slackware itself. [Salix](https://www.salixos.org/) is derived from Slackware, but adds several improvements while still being 100% compatible with Slackware. [Slackel](http://www.slackel.gr) does the same, but for Slackware-current, which in general is stable even though it’s a “testing” distribution, and GCC is close to up-to-date there (GCC 11.2 right now). And there is also [Void Linux](https://voidlinux.org/) which is not a fork but its own thing, and a “stable rolling distribution”. Void Linux has GCC 10.2.1 right now. So you can stay relatively close to the latest GCC version, but unless you choose to live on the cutting edge with a distribution that updates like crazy (I don’t), you will have to either compile the latest GCC version or use an external packager, which I consider dangerous.

---

<div class="post-metadata">

**Author:** ![shahmoradi](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/shahmoradi/32/3151_2.png) [@shahmoradi](https://fortran-lang.discourse.group/u/shahmoradi)\
**Post date:** [February 22, 2022, 10:15pm UTC](https://fortran-lang.discourse.group/t/gfortran-releases/2704/10 "2022-02-22T22:15:04Z")

</div>

The issue appears to be the unnecessary `_` in the original link shared by Beliavsky (it does not work on any browser). This [link](http://www.equation.com/servlet/equation.cmd?fa=fortran) appears to work on at least three browsers that I just checked. The website responds very slowly. Googling the website name also gives a direct link to the website.

(Link above now fixed, thanks – Beliavsky)

---

<div class="post-metadata">

**Author:** ![Pap](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/pap/32/1305_2.png) [@Pap](https://fortran-lang.discourse.group/u/Pap)\
**Post date:** [February 22, 2022, 10:23pm UTC](https://fortran-lang.discourse.group/t/gfortran-releases/2704/11 "2022-02-22T22:23:56Z")

</div>

Yes, it works now. Thank you!

---

<div class="post-metadata">

**Author:** ![fortran4r](https://avatars.discourse-cdn.com/v4/letter/f/9de0a6/32.png) [@fortran4r](https://fortran-lang.discourse.group/u/fortran4r)\
**Post date:** [February 22, 2022, 11:27pm UTC](https://fortran-lang.discourse.group/t/gfortran-releases/2704/12 "2022-02-22T23:27:06Z")

</div>

I use Fedora, which always has the most recent GFortran.

---

<div class="post-metadata">

**Author:** ![msz59](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@msz59](https://fortran-lang.discourse.group/u/msz59)\
**Post date:** [February 22, 2022, 11:38pm UTC](https://fortran-lang.discourse.group/t/gfortran-releases/2704/13 "2022-02-22T23:38:06Z")

</div>

You can (probably) install Homebrew in any Linux (I do have it on MX21 Linux) which comes (I guess, I do not have it at hand) with 11.2.0 - at least this is the version MacOS Homebrew offers.

---

<div class="post-metadata">

**Author:** ![wyphan](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/wyphan/32/632_2.png) [@wyphan](https://fortran-lang.discourse.group/u/wyphan)\
**Post date:** [February 23, 2022, 12:10am UTC](https://fortran-lang.discourse.group/t/gfortran-releases/2704/14 "2022-02-23T00:10:31Z")

</div>

@Pap I think the equivalent for adventurous people nowadays would be Arch Linux?

For me, I personally use [Spack](https://spack.io/), which looks like it’s becoming the _de facto_ standard of deploying software in HPC circles. I can simply issue `spack install gcc@master` and it will fetch and compile GCC `master` branch from the official Git tree.

---

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [February 23, 2022, 1:16am UTC](https://fortran-lang.discourse.group/t/gfortran-releases/2704/15 "2022-02-23T01:16:09Z")

</div>

Here is a

> **code using assumed rank arrays.**
>
> ```auto
> module m
> implicit none
> public :: mean,avg
> ! older way to have same name for function with multiple ranks
> ! is an interface with module procedures
> interface avg
> module procedure avg_0,avg_1,avg_2
> end interface avg
> contains
> function mean(x) result(y)
> real, intent(in) :: x(..) ! assumed rank argument
> real :: y
> select rank (x)
> rank (0) ; y = x ! scalar case
> rank (1) ; y = sum(x)/max(1,size(x))
> rank (2) ; y = sum(x)/max(1,size(x))
> rank default ; stop "mean not implemented for rank > 2"
> end select
> end function mean
> !
> function avg_0(x) result(y) ! rank 0 argument
> real, intent(in) :: x
> real :: y
> y = x
> end function avg_0
> !
> function avg_1(x) result(y) ! rank 1 argument
> real, intent(in) :: x(:)
> real :: y
> y = sum(x)/max(1,size(x))
> end function avg_1
> !
> function avg_2(x) result(y) ! rank 2 argument
> real, intent(in) :: x(:,:)
> real :: y
> y = sum(x)/max(1,size(x))
> end function avg_2
> end module m
> !
> program test_assumed_rank
> use m, only: avg ! interface with module procedures
> use m, only: mean ! function with assumed rank argument
> implicit none
> integer, parameter :: n1 = 1000, n2 = 5
> real :: x(n1,n2)
> character (len=*), parameter :: fmt="(*(f6.3))"
> call random_seed()
> call random_number(x)
> ! demonstrate rank 0, 1, 2 cases
> print "(*(a6))","avg","mean","check"
> print fmt,avg(x(1,1)),mean(x(1,1)),x(1,1) ! scalar
> print fmt,avg(x(:,1)),mean(x(:,1)),sum(x(:,1))/n1 ! 1D
> print fmt,avg(x),mean(x),sum(x)/(n1*n2) ! 2D          
> end program test_assumed_rank
> ! works with gfortran and Intel Fortran
> ! sample output:
> ! avg mean check
> ! 0.662 0.662 0.662
> ! 0.507 0.507 0.507
> ! 0.506 0.506 0.506
> 
> ```

On Windows it compiles with gfortran 12.0.1 from Equation. On WSL2 `gfortran --version` says  
`GNU Fortran (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0` and it cannot compile the code. It does compile and run with gfortran-10. I don’t see the word “rank” at [GCC 10 Release Series — Changes, New Features, and Fixes - GNU Project](https://gcc.gnu.org/gcc-10/changes.html), but I do see entries for Assumed rank and SELECT RANK [Chart of Fortran 2018 Features supported by GNU Fortran](https://gcc.gnu.org/wiki/Fortran2018Status). So that site and the analogous sites for F2008 and F2003 seem most informative about gfortran.

---

<div class="post-metadata">

**Author:** ![vmagnin](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/vmagnin/32/28_2.png) [@vmagnin](https://fortran-lang.discourse.group/u/vmagnin)\
**Post date:** [February 23, 2022, 7:23am UTC](https://fortran-lang.discourse.group/t/gfortran-releases/2704/16 "2022-02-23T07:23:15Z")

</div>

> [@Beliavsky](#):
>
> [Chart of Fortran 2018 Features supported by GNU Fortran](https://gcc.gnu.org/wiki/Fortran2018Status). So that site and the analogous sites for F2008 and F2003 seem most informative about gfortran.

Although the 2018 Status page was updated on the 2021-10-29, I am not sure the whole page is up to date: for example, exploring co-arrays, I have used `this_image()` and `num_images()` with GFortran 10.2.

---

<div class="post-metadata">

**Author:** ![plevold](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/plevold/32/754_2.png) [@plevold](https://fortran-lang.discourse.group/u/plevold)\
**Post date:** [February 23, 2022, 7:32am UTC](https://fortran-lang.discourse.group/t/gfortran-releases/2704/17 "2022-02-23T07:32:55Z")

</div>

> [@Pap](#):
>
> More conventional distributions are usually some versions behind. For example, Debian “stable” is at GCC 10.2 and won’t change until their next stable version.

Yes, this is a problem at times. The GCC team does however publish [container images](https://hub.docker.com/_/gcc) for the different releases. I think compiling source code using the desired GCC version in a container is a good solution. In terms of reproducibility it is also extremely advantageous.

---

<div class="post-metadata">

**Author:** ![vmagnin](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/vmagnin/32/28_2.png) [@vmagnin](https://fortran-lang.discourse.group/u/vmagnin)\
**Post date:** [February 23, 2022, 7:50am UTC](https://fortran-lang.discourse.group/t/gfortran-releases/2704/18 "2022-02-23T07:50:56Z")

</div>

> [@plevold](#):
>
> I think compiling source code using the desired GCC version in a container is a good solution. In terms of reproducibility it is also extremely advantageous.

Is there an impact on speed?

---

<div class="post-metadata">

**Author:** ![plevold](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/plevold/32/754_2.png) [@plevold](https://fortran-lang.discourse.group/u/plevold)\
**Post date:** [February 23, 2022, 7:56am UTC](https://fortran-lang.discourse.group/t/gfortran-releases/2704/19 "2022-02-23T07:56:19Z")

</div>

I haven’t done any extensive timing comparisons, but I don’t think there’s any significant impact on speed. Containers share the Linux kernel with the host (i.e. the operating system you’re running) so it’s very lightweight compared to virtual machines.

---

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [May 6, 2022, 6:43pm UTC](https://fortran-lang.discourse.group/t/gfortran-releases/2704/20 "2022-05-06T18:43:32Z")

</div>

From Thomas Koenig in [comp.lang.fortran](https://groups.google.com/g/comp.lang.fortran/c/HphQEYs88hc):

gcc 12.1 has been released, which includes gfortran 12.1.

Here are the sections relevant to Fortran in the changes file:

Fortran:

- WG5/N1942, “TS 29113 Further Interoperability of Fortran with C”, is  
now fully supported. In addition to implementing previously missing  
functionality, such as support for character arguments of length  
greater than one in functions marked bind(c) and gaps in the handling  
for assumed-rank arrays, numerous other bugs have been fixed, and an  
extensive set of new conformance test cases has been added.
- GCC 12 now uses OPERATION as the name of the function to the  
CO\_REDUCE intrinsic for the pairwise reduction, thus conforming to  
the Fortran 2018 standard. Previous versions used OPERATOR which  
conforms to TS 18508.
- On POWER systems which support it, the -mabi=ieeelongdouble option  
now selects the IEEE 128-bit floating point format for REAL(KIND=16).  
R16\_IBM and R16\_IEEE have been added to the -fconvert option, the  
CONVERT specifyer of the OPEN statement and the GFORTRAN\_CONVERT\_UNIT  
environment variable.

OpenMP:  
o OpenMP 5.0 support has been extended: The close map modifier  
and the affinity clause are now supported. In addition Fortran  
gained additionally the following features which were available  
in C and C++ before: declare variant is now available, depobj,  
mutexinoutset and iterator can now also be used with the depend  
clause, defaultmap has been updated for OpenMP 5.0, and the  
loop directive and combined directives involving the master  
directive have been added.  
o The following OpenMP 5.1 features have been added: support for  
expressing OpenMP directives as C++ 11 attributes, the masked  
and scope construct, the nothing and error directives, and  
using primary with the proc\_bind clause and OMP\_PROC\_BIND  
environment variable, the reproducible and unconstrained  
modifiers to the order clause, and, for C/C++ only, the align  
and allocator modifiers to the allocate clause and the atomic  
extensions are now available. The OMP\_PLACE environment  
variable supports the OpenMP 5.1 features. In addition the  
OMP\_NUM\_TEAMS and OMP\_TEAMS\_THREAD\_LIMIT environment variables  
and their associated API routines are now supported as well as  
the memory-allocation routines added for Fortran and extended  
for C/C++ in OpenMP 5.1. In Fortran code, strictly structured  
blocks can be used.  
o The OpenMP\_Implementation\_Status can be found in the libgomp  
manual.

[Next page](https://fortran-lang.discourse.group/t/gfortran-releases/2704.md?page=2)
