public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/35295] New: 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target
@ 2008-02-22 14:19 benny at ammitzboell-consult dot dk
2008-02-22 14:39 ` [Bug c/35295] " rguenth at gcc dot gnu dot org
` (13 more replies)
0 siblings, 14 replies; 15+ messages in thread
From: benny at ammitzboell-consult dot dk @ 2008-02-22 14:19 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/35295] 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target
2008-02-22 14:19 [Bug c/35295] New: 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target benny at ammitzboell-consult dot dk
@ 2008-02-22 14:39 ` rguenth at gcc dot gnu dot org
2008-02-22 17:59 ` [Bug middle-end/35295] " pinskia at gcc dot gnu dot org
` (12 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-02-22 14:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from rguenth at gcc dot gnu dot org 2008-02-22 14:38 -------
Do you have a testcase? The constants should be printed according to their
mode, which is target dependent. The host representation should not matter
apart for the biggest supported mode.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35295
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/35295] 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target
2008-02-22 14:19 [Bug c/35295] New: 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target benny at ammitzboell-consult dot dk
2008-02-22 14:39 ` [Bug c/35295] " rguenth at gcc dot gnu dot org
@ 2008-02-22 17:59 ` pinskia at gcc dot gnu dot org
2008-02-25 14:10 ` benny at ammitzboell-consult dot dk
` (11 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-02-22 17:59 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2008-02-22 17:58 -------
As when you say bigger do you mean the assembly is different sizes? Or do you
mean the actually text/data sections are bigger in the object file?
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|c |middle-end
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35295
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/35295] 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target
2008-02-22 14:19 [Bug c/35295] New: 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target benny at ammitzboell-consult dot dk
2008-02-22 14:39 ` [Bug c/35295] " rguenth at gcc dot gnu dot org
2008-02-22 17:59 ` [Bug middle-end/35295] " pinskia at gcc dot gnu dot org
@ 2008-02-25 14:10 ` benny at ammitzboell-consult dot dk
2008-02-25 14:14 ` benny at ammitzboell-consult dot dk
` (10 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: benny at ammitzboell-consult dot dk @ 2008-02-25 14:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from benny at ammitzboell-consult dot dk 2008-02-25 14:09 -------
Created an attachment (id=15224)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15224&action=view)
Test program
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35295
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/35295] 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target
2008-02-22 14:19 [Bug c/35295] New: 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target benny at ammitzboell-consult dot dk
` (2 preceding siblings ...)
2008-02-25 14:10 ` benny at ammitzboell-consult dot dk
@ 2008-02-25 14:14 ` benny at ammitzboell-consult dot dk
2008-02-25 14:15 ` benny at ammitzboell-consult dot dk
` (9 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: benny at ammitzboell-consult dot dk @ 2008-02-25 14:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from benny at ammitzboell-consult dot dk 2008-02-25 14:13 -------
Created an attachment (id=15225)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15225&action=view)
Output from arm-gcc -c -dr main.c (32-bit host)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35295
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/35295] 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target
2008-02-22 14:19 [Bug c/35295] New: 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target benny at ammitzboell-consult dot dk
` (3 preceding siblings ...)
2008-02-25 14:14 ` benny at ammitzboell-consult dot dk
@ 2008-02-25 14:15 ` benny at ammitzboell-consult dot dk
2008-02-25 14:22 ` benny at ammitzboell-consult dot dk
` (8 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: benny at ammitzboell-consult dot dk @ 2008-02-25 14:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from benny at ammitzboell-consult dot dk 2008-02-25 14:14 -------
Created an attachment (id=15226)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15226&action=view)
Output from arm-gcc -c -dM main.c (32-bit host)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35295
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/35295] 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target
2008-02-22 14:19 [Bug c/35295] New: 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target benny at ammitzboell-consult dot dk
` (4 preceding siblings ...)
2008-02-25 14:15 ` benny at ammitzboell-consult dot dk
@ 2008-02-25 14:22 ` benny at ammitzboell-consult dot dk
2008-02-25 14:23 ` benny at ammitzboell-consult dot dk
` (7 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: benny at ammitzboell-consult dot dk @ 2008-02-25 14:22 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from benny at ammitzboell-consult dot dk 2008-02-25 14:21 -------
Created an attachment (id=15227)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15227&action=view)
Output from arm-gcc -c -dr main.c (64-bit host)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35295
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/35295] 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target
2008-02-22 14:19 [Bug c/35295] New: 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target benny at ammitzboell-consult dot dk
` (5 preceding siblings ...)
2008-02-25 14:22 ` benny at ammitzboell-consult dot dk
@ 2008-02-25 14:23 ` benny at ammitzboell-consult dot dk
2008-02-25 14:27 ` benny at ammitzboell-consult dot dk
` (6 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: benny at ammitzboell-consult dot dk @ 2008-02-25 14:23 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from benny at ammitzboell-consult dot dk 2008-02-25 14:22 -------
Created an attachment (id=15228)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15228&action=view)
Output from arm-gcc -c -dM main.c (64-bit host)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35295
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/35295] 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target
2008-02-22 14:19 [Bug c/35295] New: 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target benny at ammitzboell-consult dot dk
` (6 preceding siblings ...)
2008-02-25 14:23 ` benny at ammitzboell-consult dot dk
@ 2008-02-25 14:27 ` benny at ammitzboell-consult dot dk
2008-02-25 14:32 ` benny at ammitzboell-consult dot dk
` (5 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: benny at ammitzboell-consult dot dk @ 2008-02-25 14:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from benny at ammitzboell-consult dot dk 2008-02-25 14:27 -------
Added test program and RTL output from 32-bit host and 64-bit host. Note the
difference in the const_int lines:
bla@bla-desktop:~/src/kuss$ diff /home/bla/Desktop/main.c.01.rtl
/home/bla/Desktop/main.c.01.rtl_64
7c7
< (const_int -4 [0xfffffffc])) [0 a+0 S4 A32])
---
> (const_int -4 [0xfffffffffffffffc])) [0 a+0 S4 A32])
15c15
< (note 6 5 7 0xf7eeb190 NOTE_INSN_BLOCK_BEG)
---
> (note 6 5 7 0x2ac25dcd19b0 NOTE_INSN_BLOCK_BEG)
29c29
< (const_int -4 [0xfffffffc])) [0 a+0 S4 A32])) -1 (nil)
---
> (const_int -4 [0xfffffffffffffffc])) [0 a+0 S4 A32])) -1 (nil)
39c39
< (expr_list:REG_EH_REGION (const_int -1 [0xffffffff])
---
> (expr_list:REG_EH_REGION (const_int -1 [0xffffffffffffffff])
49c49
< (const_int -4 [0xfffffffc])) [0 a+0 S4 A32]))
---
> (const_int -4 [0xfffffffffffffffc])) [0 a+0 S4 A32]))
54c54
< (const_int -4 [0xfffffffc])) [0 a+0 S4 A32])) -1 (nil)
---
> (const_int -4 [0xfffffffffffffffc])) [0 a+0 S4 A32])) -1 (nil)
107c107
< (note 32 31 33 0xf7eeb190 NOTE_INSN_BLOCK_END)
---
> (note 32 31 33 0x2ac25dcd19b0 NOTE_INSN_BLOCK_END)
125d124
<
Output from 64-bit host arm-gcc -v:
Reading specs from /arm-gcc-3/bin/../lib/gcc/arm-uclinux-elf/3.4.6/specs
Configured with: /arm-gcc3-source/build_arm-uclinux/gcc-3.4.6/configure
--enable-languages=c --disable-libmudflap --disable-nls
--enable-long-long --target=arm-uclinux-elf --prefix=/arm-gcc-3/ :
(reconfigured) /arm-gcc3-source/build_arm-uclinux/gcc-3.4.6/configure
--target=arm-uclinux-elf --prefix=/arm-gcc-3/ --enable-languages=c,c++
--enable-multilib --enable-target-optspace --with-gnu-ld --disable-nls
--disable-__cxa_atexit --enable-threads=posix --disable-clocale
--enable-long-long --disable-libstdcxx-pch --disable-checking
Thread model: posix
gcc version 3.4.6
Output from 32-bit host arm-gcc -v:
Reading specs from /arm-gcc-3/bin/../lib/gcc/arm-uclinux-elf/3.4.6/specs
Configured with: /arm-gcc3-source/build_arm-uclinux/gcc-3.4.6/configure
--enable-languages=c --disable-libmudflap --disable-nls
--enable-long-long --target=arm-uclinux-elf --host=i686-pc-linux-gnu
--prefix=/arm-gcc-3/ : (reconfigured)
/arm-gcc3-source/build_arm-uclinux/gcc-3.4.6/configure
--target=arm-uclinux-elf --prefix=/arm-gcc-3/ --enable-languages=c,c++
--enable-multilib --enable-target-optspace --with-gnu-ld --disable-nls
--disable-__cxa_atexit --enable-threads=posix --disable-clocale
--enable-long-long --disable-libstdcxx-pch --disable-checking
--host=i686-pc-linux-gnu
Thread model: posix
gcc version 3.4.6
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35295
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/35295] 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target
2008-02-22 14:19 [Bug c/35295] New: 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target benny at ammitzboell-consult dot dk
` (7 preceding siblings ...)
2008-02-25 14:27 ` benny at ammitzboell-consult dot dk
@ 2008-02-25 14:32 ` benny at ammitzboell-consult dot dk
2008-02-25 15:44 ` [Bug target/35295] " rguenth at gcc dot gnu dot org
` (4 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: benny at ammitzboell-consult dot dk @ 2008-02-25 14:32 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from benny at ammitzboell-consult dot dk 2008-02-25 14:31 -------
(In reply to comment #2)
> As when you say bigger do you mean the assembly is different sizes? Or do you
> mean the actually text/data sections are bigger in the object file?
>
The assembly is bigger on the 64-bit host. Because the 64-bit constants get
treated as such and generates more assembler.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35295
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug target/35295] 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target
2008-02-22 14:19 [Bug c/35295] New: 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target benny at ammitzboell-consult dot dk
` (8 preceding siblings ...)
2008-02-25 14:32 ` benny at ammitzboell-consult dot dk
@ 2008-02-25 15:44 ` rguenth at gcc dot gnu dot org
2008-02-25 16:03 ` benny at ammitzboell-consult dot dk
` (3 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-02-25 15:44 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from rguenth at gcc dot gnu dot org 2008-02-25 15:43 -------
At first this looks like a target issue. Can you check if a still maintained
GCC version is still affected? That would be 4.2.3 for example.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|middle-end |target
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35295
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug target/35295] 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target
2008-02-22 14:19 [Bug c/35295] New: 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target benny at ammitzboell-consult dot dk
` (9 preceding siblings ...)
2008-02-25 15:44 ` [Bug target/35295] " rguenth at gcc dot gnu dot org
@ 2008-02-25 16:03 ` benny at ammitzboell-consult dot dk
2008-02-28 8:19 ` benny at ammitzboell-consult dot dk
` (2 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: benny at ammitzboell-consult dot dk @ 2008-02-25 16:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from benny at ammitzboell-consult dot dk 2008-02-25 16:02 -------
(In reply to comment #10)
> At first this looks like a target issue. Can you check if a still maintained
> GCC version is still affected? That would be 4.2.3 for example.
>
Since print-rtl.c in 4.2.3 still contains code like this:
fprintf (outfile, HOST_WIDE_INT_PRINT_DEC, XWINT (in_rtx, i));
if (! flag_simple)
fprintf (outfile, " [" HOST_WIDE_INT_PRINT_HEX "]",
XWINT (in_rtx, i));
- I am assuming that the (RTL) behavior is the same as in my examples. But are
you saying that a later (target) stage should be able to see that this is just
a 32-bit const?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35295
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug target/35295] 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target
2008-02-22 14:19 [Bug c/35295] New: 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target benny at ammitzboell-consult dot dk
` (10 preceding siblings ...)
2008-02-25 16:03 ` benny at ammitzboell-consult dot dk
@ 2008-02-28 8:19 ` benny at ammitzboell-consult dot dk
2008-05-20 7:33 ` benny at ammitzboell-consult dot dk
2008-05-20 7:34 ` benny at ammitzboell-consult dot dk
13 siblings, 0 replies; 15+ messages in thread
From: benny at ammitzboell-consult dot dk @ 2008-02-28 8:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from benny at ammitzboell-consult dot dk 2008-02-28 08:18 -------
We have now tried the 4.2.3 version of gcc and it generates the same assembler
code (objdump -d) for the example here on both the 32-bit and the 64-bit host.
The RTL is still different though, so it seems you're right about it being a
target issue. We're trying to build a full toolchain with gcc 4.2.1 to verify
that result in a full-blown test on all of our code.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35295
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug target/35295] 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target
2008-02-22 14:19 [Bug c/35295] New: 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target benny at ammitzboell-consult dot dk
` (11 preceding siblings ...)
2008-02-28 8:19 ` benny at ammitzboell-consult dot dk
@ 2008-05-20 7:33 ` benny at ammitzboell-consult dot dk
2008-05-20 7:34 ` benny at ammitzboell-consult dot dk
13 siblings, 0 replies; 15+ messages in thread
From: benny at ammitzboell-consult dot dk @ 2008-05-20 7:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #13 from benny at ammitzboell-consult dot dk 2008-05-20 07:32 -------
Ok, we have verified that this bug is not present when using a 4.2.3 arm
toolchain.
--
benny at ammitzboell-consult dot dk changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35295
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug target/35295] 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target
2008-02-22 14:19 [Bug c/35295] New: 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target benny at ammitzboell-consult dot dk
` (12 preceding siblings ...)
2008-05-20 7:33 ` benny at ammitzboell-consult dot dk
@ 2008-05-20 7:34 ` benny at ammitzboell-consult dot dk
13 siblings, 0 replies; 15+ messages in thread
From: benny at ammitzboell-consult dot dk @ 2008-05-20 7:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #14 from benny at ammitzboell-consult dot dk 2008-05-20 07:33 -------
Verified on gcc 4.2.3
--
benny at ammitzboell-consult dot dk changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |VERIFIED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35295
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2008-05-20 7:34 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-22 14:19 [Bug c/35295] New: 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target benny at ammitzboell-consult dot dk
2008-02-22 14:39 ` [Bug c/35295] " rguenth at gcc dot gnu dot org
2008-02-22 17:59 ` [Bug middle-end/35295] " pinskia at gcc dot gnu dot org
2008-02-25 14:10 ` benny at ammitzboell-consult dot dk
2008-02-25 14:14 ` benny at ammitzboell-consult dot dk
2008-02-25 14:15 ` benny at ammitzboell-consult dot dk
2008-02-25 14:22 ` benny at ammitzboell-consult dot dk
2008-02-25 14:23 ` benny at ammitzboell-consult dot dk
2008-02-25 14:27 ` benny at ammitzboell-consult dot dk
2008-02-25 14:32 ` benny at ammitzboell-consult dot dk
2008-02-25 15:44 ` [Bug target/35295] " rguenth at gcc dot gnu dot org
2008-02-25 16:03 ` benny at ammitzboell-consult dot dk
2008-02-28 8:19 ` benny at ammitzboell-consult dot dk
2008-05-20 7:33 ` benny at ammitzboell-consult dot dk
2008-05-20 7:34 ` benny at ammitzboell-consult dot dk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).