This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: 64-bit powerpc compare with constant problem
- To: dje at watson dot ibm dot com
- Subject: Re: 64-bit powerpc compare with constant problem
- From: Geoff Keating <geoffk at cygnus dot com>
- Date: Sun, 13 Feb 2000 13:45:51 -0800
- CC: ben at eecg dot toronto dot edu, gcc-bugs at gcc dot gnu dot org
- References: <200002130623.BAA27614@mal-ach.watson.ibm.com>
> cc: ben@eecg.toronto.edu, gcc-bugs@gcc.gnu.org
> Date: Sun, 13 Feb 2000 01:23:19 -0500
> From: David Edelsohn <dje@watson.ibm.com>
>
> You did not really address the question. There are constants from
> the program (either supplied by the programmer or generated by the
> compiler to represent values in the program) and there are constants used
> by the backend of the compiler. GCC does not distinguish the two in all
> cases. GCC both knows the width of a word on the host while
> simultaneously extending that host word to the width of the target when it
> thinks that the host value can represent the target value. I am not
> commenting on whether the optimization is good or bad, but it is a
> decision that makes the current problem rather cumbersome to solve.
It's not an "optimization", it's a bug, caused by people not thinking
about cross-compilation issues when writing code. Each such bug, when
found, should be fixed, by using the appropriate routines correctly
(like trunc_int_for_mode, plus_constant, and so on).
There are a number of places in the compiler---for instance, in
rs6000_emit_prologue---where the host's types are used to manipulate
target data, like stack offsets, but where this is safe because it is
known that the host's types will be suitable (because we don't support
stack frames larger than a HOST_WIDE_INT, you have to make
HOST_WIDE_INT larger if you need them). However, when handling
arbitrary constants, this does not work, and thus the problem you are
seeing.
I will look at the bugs reported, and will see if I can't find a solution.
--
- Geoffrey Keating <geoffk@cygnus.com>