From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 15E6F3858CDA; Thu, 30 Mar 2023 19:21:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 15E6F3858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680204082; bh=kNuVO0liUuoOssdCu5cUt4vaVthVCykmbXWaBgeq/To=; h=From:To:Subject:Date:In-Reply-To:References:From; b=XRdBP08bYkb2fa3LwTs2LLI1Nqx1kkMzuci6rF4e28T1FMzmj4j5Jql8CXUn3yusN awJjj+ztke9pKe+dFqnOmhOUqTDdLZQxJFWTFlxej6hMGc9zfU5noLHnbLma23vlEW jbX3k9RhPWlDv4Wew1NMxL3kLZfQHQfoHqHEB+PU= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/109322] -fc-prototypes does not correctly translate INTEGER(KIND=C_SIZE_T), and other sizes Date: Thu, 30 Mar 2023 19:21:21 +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: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: WAITING X-Bugzilla-Resolution: X-Bugzilla-Priority: P5 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109322 --- Comment #10 from Andrew Pinski --- (In reply to Steve Kargl from comment #9) >=20 > If one instruments, write_decl() in dump-parse-tree.cc to > dump the table of bind(c) types, one can see why you get > what you get. >=20 > % cat a.f90 > module foo > use, intrinsic :: iso_c_binding > implicit none > public :: bar > type, bind(c) :: bar > integer(c_int64_t) a > end type > end module >=20 > % gfcx -fc-prototypes -fsyntax-only a.f90 | grep "value=3D8 IN" > 2 value=3D8 INTEGER c_long > 3 value=3D8 INTEGER c_long_long > 4 value=3D8 INTEGER c_intmax_t > 5 value=3D8 INTEGER c_intptr_t > 6 value=3D8 INTEGER c_ptrdiff_t > 7 value=3D8 INTEGER c_size_t > 12 value=3D8 INTEGER c_int64_t > 17 value=3D8 INTEGER c_int_least64_t > 22 value=3D8 INTEGER c_int_fast64_t >=20 > typedef struct bar { > long a; > } bar; >=20 > The for-loop in write_decl() breaks on the first match to > to both value=3D8 and INTEGER. It never reaches the 12th > table entry for c_int64_t. For ILP32 (32bit x86) and LLP64IL32 (64bit Windows/mingw) targets, it will = use c_long_long which is outputted wrong. Anyways I fixed the bug with respect = of c_long_long being outputted incorrectly as long_long rather than "long long" too. (r13-6940-ga7df3bea9cf1e4 and backported to GCC 12: r12-9370-g429b75db39aa89 ).=