On Tue, Dec 17, 2013 at 06:50:24PM +0100, Jakub Jelinek wrote:
> Isn't this undefined behavior in C? I mean, shouldn't you
> shift up (unsigned __int128) 1 and only cast to (__int128) at the end?
Oh my, how could I.
Yeah, (__int128) 1 << 127 is UB. Fixed below, ok now?
2013-12-17 Marek Polace
On Tue, Dec 17, 2013 at 07:16:18PM +0100, Marek Polacek wrote:
> On Tue, Dec 17, 2013 at 06:50:24PM +0100, Jakub Jelinek wrote:
> > Isn't this undefined behavior in C? I mean, shouldn't you
> > shift up (unsigned __int128) 1 and only cast to (__int128) at the end?
>
> Oh my, how could I.
>
> Yea
On Tue, Dec 17, 2013 at 06:17:01PM +0100, Marek Polacek wrote:
> Regtested on x86_64-linux with -m32/-m64.
>
> Ok?
>
> 2013-12-17 Marek Polacek
>
> testsuite/
> * c-c++-common/ubsan/overflow-int128.c: New test.
>
> --- gcc/testsuite/c-c++-common/ubsan/overflow-int128.c.mp 2013-12-1
Regtested on x86_64-linux with -m32/-m64.
Ok?
2013-12-17 Marek Polacek
testsuite/
* c-c++-common/ubsan/overflow-int128.c: New test.
--- gcc/testsuite/c-c++-common/ubsan/overflow-int128.c.mp 2013-12-17
16:54:28.123468111 +0100
+++ gcc/testsuite/c-c++-common/ubsan/overflow-int12