I cannot use the math function,such as log()

Dave Korn dave.korn@artimi.com
Thu Nov 30 18:30:00 GMT 2006


On 30 November 2006 17:32, MikeW wrote:

> Dave Korn <dave.korn <at> artimi.com> writes:
>> 
>>   I think the heart of the problem might be revealed in the answer to
>> these two questions: 
>> 
>> 1)  Does the particular ARM cpu on your board have an FPU?
>> 2)  Is the version of gcc you're using configured for hardware or software
>> fp? 
>> 
>>     cheers,
>>       DaveK
> 
> Yes, but you might optimistically expect that in the event of a mismatch,
> something would complain and you would get an 'invalid operation'
> in the event of expecting FP hardware when there was none,
> and a correct (but slow) answer in the event of software FP when
> you actually had some hardware.

  You might hope so, but since we already *know* that this does not happen,
either such a mechanism does not exist, or has a bug.

  It seems entirely plausible in my experience that a small embedded board
might not be supplied with an FP emulation library, and that whatever trap
vector gets invoked when the non-existent FP instruction is executed might
just be linked to a silent return-from-exception stub.  Combine that with the
fact that under the ARM ABI the first arg-passing register is also used to
return the function result, and I think you'll see a plausible explanation for
what we have observed.

> Giving an incorrect answer without an indication seems bad.

  Stating the fairly obvious here!

> I guess you could run a test first, ASSERT(log(4.0) != 4.0)).

  I guess it would be worth ruling out the possibility that this is just a
printf bug.

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


--
For unsubscribe information see http://sourceware.org/lists.html#faq



More information about the crossgcc mailing list