From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 114166 invoked by alias); 3 Dec 2019 08:42:10 -0000 Mailing-List: contact gcc-cvs-wwwdocs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-cvs-wwwdocs-owner@gcc.gnu.org Received: (qmail 114097 invoked by uid 9665); 3 Dec 2019 08:42:09 -0000 Date: Tue, 03 Dec 2019 08:42:00 -0000 Message-ID: <20191203084209.114093.qmail@sourceware.org> From: burnus@gcc.gnu.org To: gcc-cvs-wwwdocs@gcc.gnu.org Subject: gcc-wwwdocs branch master updated. 2e5b610bc77329bb2e1fdd3dff1efcd08b99b830 X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 77d900eae547f79868f34f5879ebaacf9c6cf07d X-Git-Newrev: 2e5b610bc77329bb2e1fdd3dff1efcd08b99b830 X-SW-Source: 2019/txt/msg00308.txt.bz2 This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "gcc-wwwdocs". The branch, master has been updated via 2e5b610bc77329bb2e1fdd3dff1efcd08b99b830 (commit) from 77d900eae547f79868f34f5879ebaacf9c6cf07d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2e5b610bc77329bb2e1fdd3dff1efcd08b99b830 Author: Tobias Burnus Date: Tue Dec 3 09:40:54 2019 +0100 Add porting-to for GCC 10 * htdocs/gcc-10/changes.html: Uncomment links to porting-to file and general documentation. * htdocs/gcc-10/porting_to.html: New; add Fortran argument-mismatch entry. diff --git a/htdocs/gcc-10/changes.html b/htdocs/gcc-10/changes.html index 5cca097..6e45c8f 100644 --- a/htdocs/gcc-10/changes.html +++ b/htdocs/gcc-10/changes.html @@ -17,11 +17,11 @@

This page is a "brief" summary of some of the huge number of improvements in GCC 10. - +

Note: GCC 10 has not been released yet, so this document is diff --git a/htdocs/gcc-10/porting_to.html b/htdocs/gcc-10/porting_to.html new file mode 100644 index 0000000..2c40419 --- /dev/null +++ b/htdocs/gcc-10/porting_to.html @@ -0,0 +1,134 @@ + + + + + +Porting to GCC 10 + + + + +

Porting to GCC 10

+ +

+The GCC 10 release series differs from previous GCC releases in +a number of ways. Some of these are a result +of bug fixing, and some old behaviors have been intentionally changed +to support new standards, or relaxed in standards-conforming ways to +facilitate compilation or run-time performance. +

+ +

+Some of these changes are user visible and can cause grief when +porting to GCC 10. This document is an effort to identify common issues +and provide solutions. Let us know if you have suggestions for improvements! +

+ + + + + + +

Fortran language issues

+ +

Argument mismatches

+ +

+GCC 10 now rejects argument mismatches occurring in the same source file. +Those are not permitted by the Fortran standard and in general have the +potential to generate invalid code. However, the Fortran standard does permit +passing an array element or a scalar string (of default character kind or of +c_char kind) as actual argument to an array dummy argument. +(For the exact wording, see the Fortran standard on argument association; +in particular, Fortran 2018, Sect. 15.5.2.4, Para. 4.) +

+ +

+Depending on their nature, argument mismatches have the potential to cause the +generation of invalid code and, hence, should be investigated. The most common +reason that code fails due to newly enforced check is the following: instead of +using an array element as actual argument, a scalar is used; one solution is to +replace the scalar by a size-one array. (This should be passed as a whole as +there is no point in passing it as array element.) Additionally, check that the +code indeed only accesses this single element. — Other mismatches occur more +rarely but usually indicate more serious bugs where a wrong result is likely +(at least for some target-platform and optimization combination). +

+ +

+If short-term fixing of those issues is not feasible, the compiler flag +-fallow-argument-mismatch (implied by -std=legacy) +downgrades the error to a warning. +

+ +

+Example: Assume a subroutine which takes an assumed-size or explicit-size array +and the array size as another argument, such as +

+ +

+      subroutine sub_assumed(array, n)
+        real array(*)
+        integer n
+        …
+      end
+
+      subroutine another_explicit(array, n)
+        integer n
+        real array(n)
+        …
+      end
+
+ +

+An invalid but comparably common use is to pass scalar to such procedures: +

+ +

+      real var
+      …
+      call sub_assumed(var, 1)
+
+ +

+This can be fixed in several ways. The simplest and most localized one is the +following; the scalar is replaced by an array. In the second subroutine, it +is assumed that the argument is both read from and written to. In the third +procedure, a single number is passed, which is assumed to be only accessed for +reading. (Note: By adding the brackets, a Fortran 66 or 77 compiler can no +longer compile it.) + +


+      subroutine caller()
+        real var(1)
+        …
+        call sub_assumed(var, 1)
+      end
+
+      subroutine caller_arg(var)
+        real var
+        real var2(1)
+        …
+        var2(1)var2(1) = var
+        call sub_assumed(var2, 1)
+        var = var2(1)
+      end
+
+      subroutine caller_readonly(var)
+        …
+! Before: var = func(42.0, 1)
+        var = func([42.0], 1)
+
+ + + + + + + ----------------------------------------------------------------------- Summary of changes: htdocs/gcc-10/changes.html | 4 +- htdocs/gcc-10/porting_to.html | 134 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+), 2 deletions(-) create mode 100644 htdocs/gcc-10/porting_to.html hooks/post-receive -- gcc-wwwdocs