Optimisations and undefined behaviour
Simon Wright
simon@pushface.org
Mon Nov 9 18:20:00 GMT 2015
On 9 Nov 2015, at 16:31, Andrew Haley <aph@redhat.com> wrote:
>
> Maybe there should be a nice small
> language which is useful for embedded developers and doesn't have
> all the interesting UB properties that C has. (Ada, maybe? Probably
> not.)
Ada certainly has fewer UB properties than C, but Ada programs can be erroneous (anything might happen) or have bounded errors; typically from some form of “unchecked conversion”, e.g. in the embedded context reading from the wrong address and therefore reading invalid (out-of-range) values, and then not validating.
Ada is hardly a small language, but you can leave out a lot of the runtime system (e.g. no task support); for example the tutorial at http://inspirel.com/articles/Ada_On_Cortex.html.
More information about the Gcc-help
mailing list