Added '-fno-delete-null-pointer-checks' to GCC compilation options

From Adam Green, regarding using -fno-delete-null-pointer-checks:

"I would argue that on Cortex-M processors, it is more dangerous to not
have it.  The compiler can actually generate incorrect code because it is
making an incorrect assumption (that reads from a NULL pointer will throw
an exception.)   The GCC for ARM developers should actually never enable
the delete-null-pointer-checks optimization for Cortex-M processors.
There is a comment in the GCC manual that indicates, "Some targets,
especially embedded ones, disable this option [delete-null-pointer-checks]
at all levels."  Not having this flag is pretty risky on the current
versions of GCC_ARM.  Just to clarify, this flag doesn't enable an
optimization...it disables an unsafe optimization."
pull/37/merge
Bogdan Marinescu 2013-08-16 12:26:50 +03:00
parent 73b1687b83
commit a7628510f5
1 changed files with 1 additions and 1 deletions

View File

@ -50,7 +50,7 @@ class GCC(mbedToolchain):
common_flags = ["-c", "-O2", "-Wall",
"-fmessage-length=0", "-fno-exceptions", "-fno-builtin",
"-ffunction-sections", "-fdata-sections",
"-MMD"
"-MMD", "-fno-delete-null-pointer-checks",
] + self.cpu
if "save-asm" in self.options: