From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6B8023858415; Thu, 19 Oct 2023 15:11:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6B8023858415 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1697728298; bh=Lzf4XLcryWNRyJGcBmfDmQp1AanH9V95ndk6/r0xtuw=; h=From:To:Subject:Date:From; b=Y+TtZmkfUo7QxEyQkTxV5Yu4rpGGWZfEazGOm03Lb+/AV9BLZaMqOHSzMPfP/WBHS tQ8DrmUcmy0xBXlLRgOZtfYBs9hupSQ6kX3VOI+282XNk40SrQYgmTOEeKtwWwK4OT XWp4no2XlktB0htFXJOZnlr8VW2HYIaySey91fGk= From: "zed.three at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/111880] New: [9/10/11/12/13] False positive warning of obsolescent COMMON block with Fortran submodule Date: Thu, 19 Oct 2023 15:11:37 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 13.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: zed.three at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111880 Bug ID: 111880 Summary: [9/10/11/12/13] False positive warning of obsolescent COMMON block with Fortran submodule Product: gcc Version: 13.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: zed.three at gmail dot com Target Milestone: --- Created attachment 56152 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D56152&action=3Dedit Minimal source code demonstrating issue. Compiler Explorer link with complete reproducer: https://godbolt.org/z/dd45enhWe module third_party_module integer :: some_param common /not_my_code/ some_param end module third_party_module module foo use third_party_module interface module subroutine bar() end subroutine bar end interface end module foo submodule (foo) foo_submod contains module procedure bar end procedure bar end submodule foo_submod Compiling the above minimal program like: gfortran -std=3Df2018 -c foo.f90 gives the following warnings: foo.f90:3:22: 3 | common /not_my_code/ some_param | 1 Warning: Fortran 2018 obsolescent feature: COMMON block at (1) foo.f90:14:14: 14 | submodule (foo) foo_submod | 1 Warning: Fortran 2018 obsolescent feature: COMMON block at (1) The first warning is expected, but the second one is a false positive. I ca= me across this when building with a library outside of my control, so I cannot remove the problem common block (actually this was with MPI, and it happens with all the major implementations as the common block is required for technical reasons). If the submodule is removed, the extra warning disappears. The warning also appears when building the submodule separately (in a different file and hav= ing already built the parent module). It also only appears to be this warning, and not other F2018 obsolescent feature warnings (e.g. labeled DO statements), or other warnings enabled at `-Wall` for instance.=