[squeak-dev] FloatMathPlugin status?

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Mon Feb 18 21:02:06 UTC 2013


2013/2/18 Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>:
> 2013/2/18 tim Rowledge <tim at rowledge.org>:
>>
>> On 18-02-2013, at 10:14 AM, Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com> wrote:
>>
>>> FloatMathPlugin uses fdlibm library.
>>> fdlibm library relies on pointer aliasing, which is Undefined Behavior
>>> according to C99 standard
>>
>> Oh, well that sounds like it might cause fun.
>>
>>> With -O2 optimization, gcc does not produce correct code with such
>>> pointer aliasing...
>>> A well known workaround is to compile fdlibm with -fno-strict-aliasing flag.
>>
>> Wonder if that has any effect on the NorCroft RISC OS compiler. I'll give it a try.
>>
>> It looked a bit odd to me that the generated plugin wants to rely on isnan() being a pretty specific routine in the fdlibm code and yet that is a pretty general macro defined in the basic C libraries. There is clearly an attempt in the .h file to work around that but surely you're asking for trouble by mixing two libraries with evidently differing ideas of what is the way to do things?
>>
>
> AFAIK, fdlibm was supposed to provide a whole libm replacement.
> What can happen when mixing functions from the two libraries is left
> to adventurous explorators.
> http://www.netlib.org/fdlibm/readme suggests you might try it though...
>
> If this does not work, I don't know how difficult it is on RiscOS to
> avoid linking to standard functions usually found in libm.
> As I understand it, the whole library seems aggregated in a big
> SharedUnixLibrary
> (http://www.riscos.info/index.php/SharedUnixLibrary).
>

Argh, wrong link, it would rather be
http://www.riscos.info/index.php/Shared_C_Library

> Nicolas
>
>> I think I'll try changing the isnan to something else so it can't clash and see what happens. If you see a big plume of smoke from the north west you'll know it didn't work...
>>
>> tim
>> --
>> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
>> Useful random insult:- One too many lights out in his Christmas tree.
>>
>>
>>


More information about the Squeak-dev mailing list