[riot-notifications] [RIOT-OS/RIOT] msba2: floating point tests fail (#11861)

Marian Buschsieweke notifications at github.com
Fri Jul 19 17:45:50 CEST 2019


I can reproduce the issue on my system. The unit tests fails as `sscanf()` does not return the correct number of items parsed. Even `printf("pi is approx. %f\n", 3.14159);` will not work on the MSB-A2. The reason is that newlib seems to not include floating point support in stdio by default for ARM7 MCUs. (Floating point support can be configured at compile time of newlib.)

I'm not sure how we should handle this. A user of the MSB-A2 who really *wants* to use stdio with floating point support could set up the toolchain that way.  But there will be users of the MSB-A2 who will actually prefer to not have float support in stdio to preserve ROM.

The best we could do (if we really *want* float support in stdio) would be to update the riotbuild docker to use a newlib version that provides this.

I'm personally not a fan of stdio at all. I consider it a poor API design that has proved a [source](https://www.openwall.com/lists/musl/2019/03/14/1) [of](https://nvd.nist.gov/vuln/detail/CVE-2018-1000101) [security](https://www.freebsd.org/security/advisories/FreeBSD-SA-14:27.stdio.asc) [relevant](https://www.cvedetails.com/cve/CVE-2012-3406/) [bugs](https://bugzilla.redhat.com/show_bug.cgi?id=1548934), a [common attack vector](https://en.wikipedia.org/wiki/Uncontrolled_format_string), and bloat for ages. If that would get finally removed from the C standard my scream of joy would likely be audible in all of the the northern hemisphere.

Some people seem to share that view, e.g. in MISRA C stdio is [forbidden in production code](https://rules.sonarsource.com/c/RSPEC-988) :-)

And RIOT already has an alternative: E.g. [`fmt_float()`](http://api.riot-os.org/group__sys__fmt.html#ga9578cea845911b8599501348ad8e0eec) allows to only link in float support if an application uses it.

So how about a wont-fix on this one?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/issues/11861#issuecomment-513278635
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190719/306bfb24/attachment.htm>


More information about the notifications mailing list