![](https://seccdn.libravatar.org/avatar/fd11770e2c72c423dd3e236b1ec2e094.jpg?s=120&d=mm&r=g)
Am 24.02.21 um 10:39 schrieb Stefan Seyfried:
*((size_t *)&a->data[a->last])=a->lastsz;
Can you provide the types of the relevant members of *a? Especially "data" would be interesting. I have tried struct { size_t last, lastsz; int* data; } a; which would make it a strict aliasing violation in my reading of the standard ([1], 6.5p7, here we have a 64-bit system with 32-bit int), but I can't get the warning to trigger for any version of GCC in the compiler explorer (godbolt.org), even with -O2 (in case it's a middle end warning). Though I remember that -Wstrict-aliasing used to be too strict in the past and was relaxed significantly, but I can't give you any details about that. The kind of aliasing we see here is (assuming the types are indeed as above) is technically illegal but no relevant compiler uses that for optimization since it's entirely local and the aliasing is transparent. Best regards, Aaron [1] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf