From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6D1633858001; Thu, 25 Mar 2021 17:49:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6D1633858001 From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/31279] Uninitialized warning for call-by-reference arguments with known intent(in) Date: Thu, 25 Mar 2021 17:49:23 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 4.3.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: enhancement X-Bugzilla-Who: msebor at gcc dot gnu.org X-Bugzilla-Status: NEW 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: component Message-ID: In-Reply-To: References: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Mar 2021 17:49:23 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D31279 Martin Sebor changed: What |Removed |Added ---------------------------------------------------------------------------- Component|middle-end |fortran --- Comment #7 from Martin Sebor --- GCC added the attributes mentioned in comment #4 under the name access -- s= ee below. Getting the middle end to issue a warning for the cases described in comment #0 should be a matter of the Fortran front end making use of the attribute. $ cat x.c && gcc -S -Wall x.c __attribute__ ((access (read_only, 1))) void f (int*); void g (void) { int x; f (&x); } x.c: In function =E2=80=98g=E2=80=99: x.c:6:3: warning: =E2=80=98x=E2=80=99 is used uninitialized [-Wuninitialize= d] 6 | f (&x); | ^~~~~~ x.c:1:46: note: in a call to =E2=80=98f=E2=80=99 declared with attribute = =E2=80=98access (read_only, 1)=E2=80=99 here 1 | __attribute__ ((access (read_only, 1))) void f (int*); | ^ x.c:5:7: note: =E2=80=98x=E2=80=99 declared here 5 | int x; | ^=