Today's “this language is broken” courtesy of @ch3root
https://godbolt.org/g/H8d0I2
-
-
Replying to @volatile_void @ch3root
C11 §6.5.6p9 If the result is not representable in an object of that type, the behavior is undef http://imgur.com/uodUIam
2 replies 0 retweets 0 likes -
Replying to @shafikyaghmour
Except that in this example, the result is representable.
1 reply 0 retweets 0 likes -
Replying to @volatile_void
hmmm, indeed. Maybe it is related to this: https://gcc.gnu.org/ml/gcc/2011-08/msg00221.html …
2 replies 0 retweets 1 like -
Replying to @shafikyaghmour
yes, “GCC restricts … half of the address-space” but silently translates some C programs that break this limit to nonsense.
1 reply 0 retweets 0 likes -
Replying to @volatile_void @shafikyaghmour
ordinary programs would be made safe by malloc that returns 0 for arg≥2GiB on 32-bit, but GCC ships with Glibc which doesn't
1 reply 0 retweets 0 likes -
Replying to @volatile_void @shafikyaghmour
GCC does not "ship with glibc". GNU/Linux distros ship with glibc, but GCC is used plenty of other places.
1 reply 0 retweets 0 likes -
-
Replying to @volatile_void
Oh that makes more sense. You're saying glibc is wrong/broken because GCC is the compiler they intend you to use...
1 reply 0 retweets 2 likes
...yet glibc's malloc, etc. don't meet the contracts required by GCC (no objects > SIZE_MAX/2).
-
-
Replying to @RichFelker
I don't see why it follows that it's glibc who breaks the contract. This gcc limitation is not even documented.
1 reply 0 retweets 0 likes -
Replying to @ch3root @RichFelker
For all I can see it's gcc who breaks the contract that is written in C std.
0 replies 0 retweets 0 likes
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.