From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30139 invoked by alias); 30 Nov 2001 00:33:51 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 30112 invoked from network); 30 Nov 2001 00:33:50 -0000 Received: from unknown (HELO nile.gnat.com) (205.232.38.5) by hostedprojects.ges.redhat.com with SMTP; 30 Nov 2001 00:33:50 -0000 Received: from DARWIN.GNAT.COM (DARWIN.GNAT.COM [205.232.38.44]) by nile.gnat.com (Postfix) with ESMTP id F02FFF286A for ; Thu, 29 Nov 2001 19:33:06 -0500 (EST) Date: Thu, 22 Nov 2001 03:40:00 -0000 Mime-Version: 1.0 (Apple Message framework v475) Content-Type: text/plain; charset=US-ASCII; format=flowed Subject: ICE outputting unaligned fp constant on powerpc-apple-darwin5.1 From: Geert bosch To: gcc@gcc.gnu.org Content-Transfer-Encoding: 7bit Message-Id: X-Mailer: Apple Mail (2.475) X-SW-Source: 2001-11/txt/msg01094.txt.bz2 Compiler bootstraps fine, but fails with the following test case: > struct s { > char c; > double d; > }; > > struct s t [] = { { 0, 0.0 } }; It hits an ICE in assemble_real, at varasm.c:2169: > if (align < GET_MODE_ALIGNMENT (mode)) > abort (); According to comments in darwin.h, Darwin word-aligns FP doubles but doubleword-aligns 64-bit ints and increases natural record alignment to doubleword if the first field is an FP double while the FP fields remain word aligned. GET_MODE_ALIGNMENT is defined as below in rtl.c, and will cause the mode alignment for doubles to be 64 bits, which is wrong. I wonder how this is supposed to work and how this should be fixed. Should I write a new get_darwin_mode_alignment that returns 32 for double and calls get_mode_alignment otherwise, or am I completely wrong here? -Geert > /* Return the alignment of MODE. This will be bounded by 1 and > BIGGEST_ALIGNMENT. */ > > unsigned int > get_mode_alignment (mode) > enum machine_mode mode; > { > unsigned int alignment = GET_MODE_UNIT_SIZE (mode); > /* Extract the LSB of the size. */ ^^^ shouldn't this be MSB (most significant bit)? > alignment = alignment & -alignment; > alignment *= BITS_PER_UNIT; > > alignment = MIN (BIGGEST_ALIGNMENT, MAX (1, alignment)); > return alignment; > } From mboxrd@z Thu Jan 1 00:00:00 1970 From: Geert bosch To: gcc@gcc.gnu.org Subject: ICE outputting unaligned fp constant on powerpc-apple-darwin5.1 Date: Thu, 29 Nov 2001 16:33:00 -0000 Message-ID: X-SW-Source: 2001-11/msg01595.html Message-ID: <20011129163300.ofZqneoDrkpsB6sQ0lKZSIb2gLP5pjclQPZ1b__2xhs@z> Compiler bootstraps fine, but fails with the following test case: > struct s { > char c; > double d; > }; > > struct s t [] = { { 0, 0.0 } }; It hits an ICE in assemble_real, at varasm.c:2169: > if (align < GET_MODE_ALIGNMENT (mode)) > abort (); According to comments in darwin.h, Darwin word-aligns FP doubles but doubleword-aligns 64-bit ints and increases natural record alignment to doubleword if the first field is an FP double while the FP fields remain word aligned. GET_MODE_ALIGNMENT is defined as below in rtl.c, and will cause the mode alignment for doubles to be 64 bits, which is wrong. I wonder how this is supposed to work and how this should be fixed. Should I write a new get_darwin_mode_alignment that returns 32 for double and calls get_mode_alignment otherwise, or am I completely wrong here? -Geert > /* Return the alignment of MODE. This will be bounded by 1 and > BIGGEST_ALIGNMENT. */ > > unsigned int > get_mode_alignment (mode) > enum machine_mode mode; > { > unsigned int alignment = GET_MODE_UNIT_SIZE (mode); > /* Extract the LSB of the size. */ ^^^ shouldn't this be MSB (most significant bit)? > alignment = alignment & -alignment; > alignment *= BITS_PER_UNIT; > > alignment = MIN (BIGGEST_ALIGNMENT, MAX (1, alignment)); > return alignment; > }