This is the mail archive of the gcc-patches@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: [PATCH] Re: Checking out PR4483 (constant overflow on PPC, problems compiling Linux kernel)


    In one situation, we have an expression (0x80000000UL - u).  "u" get 
    substituted with 42 though inlining.  This ends up with an RTL of:
   (plus:SI (CONST_INT 0xffffffff80000000) (CONST_INT 0xffffffffffffffd6))

Of course, the subtraction doesn't overflow, it's the fact that we convert
it into an addition that makes it overflow, but that's neither here nor
there ...

    whose first and second operands are passed in to plus_constant (this
    is the situation in recog.c).  Since plus_constant has no mode to work
    with, it does the calculation in DImode, which produces (CONST_INT
    0xffffffff7fffffd6), which will no longer fit into a 32-bit value.

I'd argue that it should then call trunc_int_for_mode.

    In the second situation (in simplify-rtx.c), we get an RTL of:
      (minus:SI (REG:SI xxx) (CONST_INT 0xffffffff80000000))
    The transformation converts the minus to a plus and does a negation of 
    the constant.  But
    if you negate this constant, it overflows a 32-bit integer.

Likewise.


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