From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 743F0385800E; Wed, 30 Mar 2022 13:53:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 743F0385800E From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/102024] [12 Regression] zero width bitfields and ABIs Date: Wed, 30 Mar 2022 13:53:27 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: ABI X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 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 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: Wed, 30 Mar 2022 13:53:27 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102024 --- Comment #28 from Jakub Jelinek --- (In reply to Xi Ruoyao from comment #27) > (In reply to Jakub Jelinek from comment #23) >=20 > > struct A { double a; int : 0; double b; }; >=20 > For MIPS I've done some experiment with this and the result (with N64 ABI) > is: >=20 > With GCC trunk, G++ trunk, and GCC 11.2: argument passed via FPR $f12 and > GPR $5, > returned via GPR $2 and $3 Ah, indeed. The for (; field; field =3D DECL_CHAIN (field)) if (TREE_CODE (field) =3D=3D FIELD_DECL && int_bit_position (field) >=3D bitpos) break; loop will simply stop on the first field with bitpos equal or greater than bitpos, so the zero sized bit-fields (and generally any other zero sized fi= elds like struct S {} s; in GNU C) will be treated as being part of the next slo= t. So in struct B { int : 0; double a, b; }; it will go into GPR and FPR, while struct C { double a; int : 0; double b; }; into FPR and GPR, and struct D { double a, b; int : 0; } into FPR & FPR. > With G++ 11.2: argument passed via FPR $f12 and $f13, returned via FPR $f0 > and $f2 >=20 > So I guess we need -Wpsabi for both mips_function_arg and > mips_fpr_return_fields. Is there somebody who can clarify the MIPS ABI intent? Also, what does LLVM do?=