From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6EB2A385C41C; Fri, 23 Jul 2021 17:20:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6EB2A385C41C From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/56337] __attribute__((aligned(N))) breaks for N=1<<28 Date: Fri, 23 Jul 2021 17:20:47 +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: 4.8.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: minor X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED 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: bug_status component 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: Fri, 23 Jul 2021 17:20:47 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D56337 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Component|middle-end |target --- Comment #4 from Andrew Pinski --- The problem is in the x86_64 backend. It uses int align when it should have been unsigned align. I have a patch: diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h index 51376fcc454..d8dac87c61b 100644 --- a/gcc/config/i386/i386-protos.h +++ b/gcc/config/i386/i386-protos.h @@ -325,9 +325,9 @@ struct ix86_address extern int ix86_decompose_address (rtx, struct ix86_address *); extern int memory_address_length (rtx, bool); extern void x86_output_aligned_bss (FILE *, tree, const char *, - unsigned HOST_WIDE_INT, int); + unsigned HOST_WIDE_INT, unsigned); extern void x86_elf_aligned_decl_common (FILE *, tree, const char *, - unsigned HOST_WIDE_INT, int); + unsigned HOST_WIDE_INT, unsigned); #ifdef RTX_CODE extern void ix86_fp_comparison_codes (enum rtx_code code, enum rtx_code *, diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index ff96134fb37..ad5717b3c57 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -837,7 +837,7 @@ x86_64_elf_unique_section (tree decl, int reloc) void x86_elf_aligned_decl_common (FILE *file, tree decl, const char *name, unsigned HOST_WIDE_INT size, - int align) + unsigned align) { if ((ix86_cmodel =3D=3D CM_MEDIUM || ix86_cmodel =3D=3D CM_MEDIUM_PIC) && size > (unsigned int)ix86_section_threshold) @@ -858,7 +858,7 @@ x86_elf_aligned_decl_common (FILE *file, tree decl, void x86_output_aligned_bss (FILE *file, tree decl, const char *name, - unsigned HOST_WIDE_INT size, int align) + unsigned HOST_WIDE_INT size, unsigned align) { if ((ix86_cmodel =3D=3D CM_MEDIUM || ix86_cmodel =3D=3D CM_MEDIUM_PIC) && size > (unsigned int)ix86_section_threshold)=