4 ms·
That's pretty common in a lot of low end microcontrollers --- I've met one (the MSP430) where the low bit of the address bus will be wired to zero when doing a
by david-given 11y ago
That's pretty common in a lot of low end microcontrollers --- I've met one (the MSP430) where the low bit of the address bus will be wired to zero when doing a 16-bit read. It's a bit rage-inducing when trying to track down a bug caused by it, but totally unsurprising.
I am surprised that recent ARMs have hardware support for unaligned accesses. What sane person expects these to work?
- 0x0 11y agoFunny that this comment and the sibling one seem to be contradictive, "who expects this to work" vs "if it doesn't work get with the times". I bet there is a ton of originally x86-targeted software and libraries that never paid much attention to alignment. It's pretty scary to consider what could happen with stuff like that is ported over to ARM if garbage data is returned for unaligned access - what if stuff (structs etc) is misaligned only sometimes (depending on allocator, array lengths, etc). Could it be the "next heartbleed"? :P
- TillE 11y agoSince most people don't write assembly code anymore, it usually makes sense for the hardware to be simple and fast. That means the compiler is a little more difficult to write, but code in C should be unaffected.
- 0x0 11y agoThere's lots of ways to hit aligment problems in C, at least if you do a little typecasting here and there. Coincidentally, alignment issues was the topic of yesterday's Old New Thing blog post: http://blogs.msdn.com/b/oldnewthing/archive/2015/08/20/10636350.aspx http://blogs.msdn.com/b/oldnewthing/archive/2015/08/20/10636... (and references an example of bad C code alignment in http://blogs.msdn.com/b/oldnewthing/archive/2004/08/25/220195.aspx http://blogs.msdn.com/b/oldnewthing/archive/2004/08/25/22019... )