News for hackers. Stuff that matters.
Re:A bug story: data alignment in C on x86 (2016) by dmitrygr on Tuesday September 04, 2018 @03:08PM (#17911875)
Why the surprise? x86 ABI says that a uint32 shall be 32-bit aligned. The fact that CPU can cope with others does not mean ABI allows it. Compiler complies with ABI and assumes your uint32* is 32-bit aligned.
Re:A bug story: data alignment in C on x86 (2016) by crististm on Wednesday September 05, 2018 @12:03AM (#17914951)
I assume because ABI is just a convention for application interoperability. Hardware interface was the problem here.

You can ignore ABI if you are standalone. But you can't ignore the CPU.

Re:A bug story: data alignment in C on x86 (2016) by dmitrygr on Wednesday September 05, 2018 @01:40PM (#17920247)
Compiler sees "function" and understands "ABI says that pointer is 32-bit aligned, I can count on that because whoever calls it will also be ABI compatible and make it so"
Re:A bug story: data alignment in C on x86 (2016) by crististm on Wednesday September 05, 2018 @02:21PM (#17920613)
You confirmed my interoperability claim with your answer - whoever calls.

Consider just the main function. You are free to ignore the ABI there but you still need to obey the cpu spec.

Re:A bug story: data alignment in C on x86 (2016) by dmitrygr on Wednesday September 05, 2018 @03:59PM (#17921385)
Not really. If main ignores abi for example by not saving callee saved regs, you'll crash. Ignoring abi is never safe unless your entire project is written in asm