Hi, Jakub Jelinek wrote: > On Fri, Dec 07, 2018 at 02:52:48PM +0000, Wilco Dijkstra wrote: >> - struct __attribute__((aligned (32))) S { int a[4]; } s; >> >> - bar (&s); >> > > Any reason to remove the above?
The test case doesn't need an aligned object to fail, so why did you add it? >> + /* Compute expected next alloca offset - some targets don't align properly >> + and allocate too much. */ >> + p = q + (q - p); > > This is UB, pointer difference is only defined within the same object. > So, you can only do such subtraction in some integral type rather than as > pointer subtraction. __builtin_setjmp is already undefined behaviour, and the stack corruption is even more undefined - trying to avoid harmless theoretical undefined behaviour wouldn't be helpful. > And I'm not sure you have a guarantee that every zero sized alloca is at the > same offset from the previous one. The above pointer adjustment handles the case where alloca overallocates. It passes on x86-64 which always adds 8 unnecessary bytes. Wilco