Hi Christophe, > Actually I got a confirmation of what I suspected: the offending function > foo() > is part of ARM CMSIS libraries, although the users are able to recompile them, > they don't want to modify that source code. Having a compilation option to > avoid generating problematic code sequences would be OK for them.
Well if LDRD instructions are incorrectly generated in those libraries for unaligned accesses then why not report it as a CMSIS bug? Adding a complex new option like this (with high impact to code quality) to workaround what seems a simple bug is way overkill. > So from the user's perspective, the wrong code is part of a 3rd party library > which they can recompile but do not want to modify. Would we expect every user of CMSIS to find this bug, find its cause, figure out that a future GCC may have a new special option to avoid it, wait until that GCC is released and then recompile? Really, the best option is to report and modify the source until it is fixed. Cheers, Wilco