From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 62769385439E; Thu, 12 Jan 2023 13:44:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 62769385439E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1673531082; bh=Yq57FQ0VUkNmpE7C3KxCQ69mqL5J846dlsNiw+XOqNc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=bZOmRhcDns7mMF5vq8kDOSJpxQkvWp4EyQXEbUG918BfqiLxKkCnlIoFq3iCfVj+e R/iaRVg4wRb+fg/Iat3SISVpvIkMLkKeuyf2ArYSMZyZnmoCTXUKMNJo1GPUJKpixv D73sqqYyyvFfSCLVDmOCl4HXbtWU3AyglM8OPD34= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/105549] aarch64: Wrong va_arg alignment handling with packed bitfields and alignment Date: Thu, 12 Jan 2023 13:44:41 +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: 13.0 X-Bugzilla-Keywords: ABI, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: clyon 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=3D105549 --- Comment #4 from CVS Commits --- The master branch has been updated by Christophe Lyon : https://gcc.gnu.org/g:6610daa1cfb75b72500c22ae97988ec2a48b85c6 commit r13-5124-g6610daa1cfb75b72500c22ae97988ec2a48b85c6 Author: Christophe Lyon Date: Fri Nov 25 13:35:11 2022 +0000 aarch64: Fix bit-field alignment in param passing [PR105549] While working on enabling DFP for AArch64, I noticed new failures in gcc.dg/compat/struct-layout-1.exp (t028) which were not actually caused by DFP types handling. These tests are generated during 'make check' and enabling DFP made generation different (not sure if new non-DFP tests are generated, or if existing ones are generated differently, the tests in question are huge and difficult to compare). Anyway, I reduced the problem to what I attach at the end of the new gcc.target/aarch64/aapcs64/va_arg-17.c test and rewrote it in the same scheme as other va_arg* AArch64 tests. Richard Sandiford further reduced this to a non-vararg function, added as a second testcase. This is a tough case mixing bit-fields and alignment, where aarch64_function_arg_alignment did not follow what its descriptive comment says: we want to use the natural alignment of the bit-field type only if the user didn't reduce the alignment for the bit-field itself. The patch also adds a comment and assert that would help someone who has to look at this area again. The fix would be very small, except that this introduces a new ABI break, and we have to warn about that. Since this actually fixes a problem introduced in GCC 9.1, we keep the old computation to detect when we now behave differently. This patch adds two new tests (va_arg-17.c and pr105549.c). va_arg-17.c contains the reduced offending testcase from struct-layout-1.exp for reference. We update some tests introduced by the previous patch, where parameters with bit-fields and packed attribute now emit a different warning. 2022-11-28 Christophe Lyon Richard Sandiford gcc/ PR target/105549 * config/aarch64/aarch64.cc (aarch64_function_arg_alignment): Check DECL_PACKED for bitfield. (aarch64_layout_arg): Warn when parameter passing ABI changes. (aarch64_function_arg_boundary): Do not warn here. (aarch64_gimplify_va_arg_expr): Warn when parameter passing ABI changes. gcc/testsuite/ PR target/105549 * gcc.target/aarch64/bitfield-abi-warning-align16-O2.c: Update. * gcc.target/aarch64/bitfield-abi-warning-align16-O2-extra.c: Update. * gcc.target/aarch64/bitfield-abi-warning-align32-O2.c: Update. * gcc.target/aarch64/bitfield-abi-warning-align32-O2-extra.c: Update. * gcc.target/aarch64/aapcs64/va_arg-17.c: New test. * gcc.target/aarch64/pr105549.c: New test. * g++.target/aarch64/bitfield-abi-warning-align16-O2.C: Update. * g++.target/aarch64/bitfield-abi-warning-align16-O2-extra.C: Update. * g++.target/aarch64/bitfield-abi-warning-align32-O2.C: Update. * g++.target/aarch64/bitfield-abi-warning-align32-O2-extra.C: Update.=