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]

Re: Your sizetype changes ...


    > No.  The case is (x * 40) / 20.  If x is a normal unsigned type, you
    > can't convert this to x*2 because the x*40 might have overflowed.  But
    > if it's an actual sizetype, you can.

    You mean, "if it's an actual size".

Not precisely.  What I mean is if it's a computation in sizetype, bitsizetype,
or similar.  Such computations are only made by the compiler and in a
way that overflow is undefined.  So that optimization is safe.

    In fact, it's not even always true that

    sizeof(struct foo) * 40 / 20

    is equivalent to 

    sizeof(struct foo) * 2

I didn't say it was and the code doesn't do that anymore.

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