From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D8EC63858D38; Fri, 14 Oct 2022 18:51:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D8EC63858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665773485; bh=iv6LmtJeCke06OeOd3Au2hsi547HrtaGm9C66ponwWs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=KS995KEpX/3KKW2QFdboszsFR8yKAerCrmtOOkD+EmKv5ROS7FYW4pD4p7pNeHFnS Lon6UeF7QslFBrbeEpMqRYEB4+JttXtSRhlTJtSMNeykhtJZVw2aEQTKAHvpZCuAJI vTkVzv+B89pw1zuDxxDkN3yF2HHXmBFCM++qYvUQ= From: "kargl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: =?UTF-8?B?W0J1ZyBmb3J0cmFuLzEwNzI2Nl0gUmVqZWN0IGtpbmQ9NCBjaGFy?= =?UTF-8?B?YWN0ZXJzIGZvciBCSU5EKEMpIOKAkyBpdCBpbnZhbGlkIGFuZCBnZW5lcmF0?= =?UTF-8?B?ZXMgd3JvbmcgY29kZQ==?= Date: Fri, 14 Oct 2022 18:51:22 +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: 13.0 X-Bugzilla-Keywords: accepts-invalid, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: kargl at gcc dot gnu.org 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: 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=3D107266 --- Comment #3 from kargl at gcc dot gnu.org --- (In reply to kargl from comment #2) > (In reply to Tobias Burnus from comment #1) > > Better example: > >=20 > > character(kind=3D4) function f(x) bind(C) > > character(kind=3D4), value :: x > > end > >=20 > >=20 > > Has the dump: > >=20 > > __attribute__((fn spec (". w "))) > > character(kind=3D1) f (character(kind=3D1) x) > > { > > (void) 0; > > } > >=20 > >=20 > > Note the change to kind=3D1 >=20 > So, you want gfortran to reject the function. >=20 > It gets real ugly with >=20 > function f(x) bind(C) result(a) > character(kind=3D4) a > character(kind=3D4), value :: x > a =3D x > end >=20 > leading to >=20 > __attribute__((fn spec (". w "))) > character(kind=3D1) f (character(kind=3D1) x) > { > character(kind=3D1) a; >=20 > *(character(kind=3D4) *) &a =3D *(character(kind=3D4) *) &x; > return a; > } Looks like resolve.cc:resolve_symbol() might be able to dela with this. For my function with the result variable one has (gdb) p *sym $4 =3D {name =3D 0x2041ec100 "f", module =3D 0x0, declared_at =3D { nextc =3D 0x203a38160, lb =3D 0x203a38140}, ts =3D {type =3D BT_UNKNOWN= , kind =3D 0,=20 ... in_equivalence =3D 0, function =3D 1, subroutine =3D 0, procedure =3D 0= ,=20 generic =3D 0, generic_copy =3D 0, implicit_type =3D 0, untyped =3D 0,= =20 is_bind_c =3D 1, extension =3D 0, is_class =3D 0, class_ok =3D 0, vtab = =3D 0,=20 ... value =3D 0x0, as =3D 0x0, result =3D 0x203a57600, components =3D 0x0,=20 (gdb) p *sym->result $5 =3D {name =3D 0x2041ec110 "a", module =3D 0x0, declared_at =3D { nextc =3D 0x203a381dc, lb =3D 0x203a38140}, ts =3D {type =3D BT_CHARACT= ER,=20 kind =3D 4, u =3D {derived =3D 0x203a245a0, cl =3D 0x203a245a0, pad =3D= 60966304},=20 ... dummy =3D 0, result =3D 1, assign =3D 0, threadprivate =3D 0,=20 so gfortran can check for kind=3D4 versus kind=3D1 (aka C_CHAR).=