This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Checking out PR4483 (constant overflow on PPC, problems compiling Linux kernel)


On Nov 28, 2001, Corey Minyard <minyard@acm.org> wrote:

> In the situation, an INSN references two other registers that are
> constants (one is 0xffffffff80000000, the other is 42) and subtracts
> the second from the first (MINUS code).  In validate_replace_rtx_1
> (recog.c), it replaces the registers with constants, then adds
> them. This results in a constant 0xffffffff7fffffd6, which is
> obviously now too negative to fit into an SI register.  The original
> constant was positive (0x80000000UL in the source).  Since constants
> don't have modes, the addition code doesn't handle this (and it
> doesn't look like it cares, anyway).

Constants have modes implied from the contexts in which they're used,
and this is the mode that should be used to sign-extend them after any
operation.  CONST_INT should be changed to have a mode one of these
days.  In any case, it's the addition that should take the
responsibility of making the result a valid constant for the expected
mode.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]