From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17713 invoked by alias); 13 Feb 2013 12:20:00 -0000 Received: (qmail 17678 invoked by uid 48); 13 Feb 2013 12:19:40 -0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/56305] passing array of character with len>1 to c_loc Date: Wed, 13 Feb 2013 12:20:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: X-Bugzilla-Severity: minor X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: CC Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2013-02/txt/msg01318.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D56305 Tobias Burnus changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |burnus at gcc dot gnu.org --- Comment #1 from Tobias Burnus 2013-02-13 12= :19:39 UTC --- > The following code compiles, but shouldnt it be rejected? It seems to be invalid Fortran 2003 but valid Fortran 2008 (w/ and w/o TS29113). The gfortran's diagnostic handling for C_LOC still needs some cha= nges for -std=3Df2003, -std=3Df2008, -std=3Df2008ts (rejecting too much, some di= agnostic missing for -std=3Df2003). Fortran 2003 has ("15.1.2.5 C LOC (X)"): "Argument. X shall either (1) have interoperable type and type parameters and be [...] (2) be a nonpolymorphic scalar, have no length type parameters, and be [..= .]" A type parameter of len=3D2 is not valid and also "c" is not a scalar =E2= =80=93 Thus, it seems to be invalid.=20 However, it seems to be valid with Fortran 2008 ("15.2.3.6 C LOC (X)"); note the change "type parameter" to "kind type parameter" "Argument. X shall have either the POINTER or TARGET attribute. It shall no= t be a coindexed object. It shall either be a variable with interoperable type a= nd kind type parameters, or be a scalar, nonpolymorphic variable with no length type parameters. If it is allocatable, it shall be allocated. If it is a pointer, it shall be associated. If it is an array, it shall be contiguous = and have nonzero size. It shall not be a zero-length string." TS 29113 changes the latter as follows: "{In 15.2.3.6 C_LOC(X), paragraph 3} Delete 'scalar,'."