From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12516 invoked by alias); 22 Feb 2008 14:19:54 -0000 Received: (qmail 12244 invoked by uid 48); 22 Feb 2008 14:19:10 -0000 Date: Fri, 22 Feb 2008 14:19:00 -0000 Subject: [Bug c/35295] New: 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "benny at ammitzboell-consult dot dk" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-02/txt/msg02332.txt.bz2 We are cross-compiling to a 32-bit ARM target from both 32-bit and 64-bit PCs. The gcc cross-compiler toolchain (3.4.6) generates valid code in both cases, but the generated code is larger when a 64-bit host is used. We have tracked this down to the following: 1) The RTL is using 64-bit (on the 64-bit host) to represent constants that is calculated as part of the code-generation. Perhaps because print-rtl.c is using HOST_WIDE_INT_xxx in some places. Surely any kind of constant number even in high level RTL should be using the *target* int size and not the host? 2) The 64-bit constants are treated as such and thus generates more assembler instructions to deal with the 64-bit number on the 32-bit target. We have fixed the toolchain with a workaround where "-m32" is used to compile the entire toolchain as 32-bit, but I think the correct solution would be to ensure that constants used in the RTL are represented using the target format in stead of the host. As far as I can see from the code (print-rtl.c) the problem is still there in gcc 4.2.3. -- Summary: 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target Product: gcc Version: 3.4.6 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: benny at ammitzboell-consult dot dk GCC build triplet: i686-pc-linux-gnu / x86_64-unknown-linux-gnu GCC host triplet: i686-pc-linux-gnu / x86_64-unknown-linux-gnu GCC target triplet: arm-uclinux-elf http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35295