sizeof overflow -- well defined or UB? sizeof(int[(0, SIZE_MAX / sizeof(int) + 1)]) == 0
@ch3root That's a potentially valid interpretation, but unusably bad QoI issue, just like ptrdiff_t overflows.
-
-
@RichFelker size_t size = SIZE_MAX / sizeof(int) + 2; int (*p)[size]; p = malloc(sizeof *p); What should the code do? Crash in line 2? -
@ch3root Something like that. VLAs are problematic in a lot of ways. Nice that you pointed out that pointer-to-VLA is problematic too. -
@RichFelker It's surely preferable to state directly in std that objects with size > SIZE_MAX are UB (if it's indeed intended:-). -
@RichFelker But it's not there yet. UB in sizeof overflow means dynamic oversized VLAs are effectively prohibited. -
@RichFelker OTOH huge objects in stack are a problem irrespective of VLA. -
@ch3root@RichFelker -fstack-check should work properly, have no significant performance overhead and be enabled by default though. -
@ch3root@RichFelker Microsoft solved that potentially uncaught stack overflow problem a long time ago and it should be solved here too. -
@ch3root@RichFelker An amusing side issue is that Clang performs the Windows stack checking but implements -fstack-check as a no-op.
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.