3 ms·
That doesn’t check whether that memset call writes 0xFF bytes in the padding. The compiler could also determine that &a.x)[1] is undefined behavior in C (readi
by Someone 8y ago
That doesn’t check whether that memset call writes 0xFF bytes in the padding.
The compiler could also determine that &a.x)[1] is undefined behavior in C (reading past the end of an object), and take advantage of that.
The way to check that is by disassembling the code, and even that doesn’t say what a C compiler should do, only what these particular compilers do.
- deleted 8y ago[deleted]
- mehrdadn 8y agoI feel like you're missing the point (the gcc -O0 was there for a reason) but I updated it. Is this better?