Peter Bex <[email protected]> writes: > Hello all, > > I ran another test with the sanitizer, this time using the undefined > behaviour checks (-fsanitize=undefined). This found a few problems: > > - We are using left shifts on signed types. According to the C spec > this behaviour is undefined (which is completely retarded, IMHO). > The even more retarded fix is to simply cast to unsigned and back to > signed whereever this is done. The attached patch does this for > master and chicken-5.
I have pushed this as newer compilers will get more aggressive than they already are and try bending the language laws towards their needs. I hope code will at least fail in a more predictable mode then. > - We are dividing floating-point numbers by zero, which is apparently > undefined. However, we do this to obtain NaN and Inf values. > As far as I can determine, there is no really portable way to do > this. See also for example this Stack Overflow thread: > http://stackoverflow.com/questions/1923837/how-to-use-nan-and-inf-in-c > It looks like INFINITY is defined in C99, and NAN *may* be. Let's keep that as it is, it looks like it is too much effort for the gain atm. Thank you, Christian -- May you be peaceful, may you live in safety, may you be free from suffering, and may you live with ease. _______________________________________________ Chicken-hackers mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-hackers
