------- Comment #3 from joseph at codesourcery dot com  2006-05-19 16:35 -------
Subject: Re:   New: float to int conversion doesn't raise
 invalid exception

On Fri, 19 May 2006, janis at gcc dot gnu dot org wrote:

> GCC claims to follow C99 Annex F when converting a floating value to an 
> integer

It doesn't (in that it doesn't define __STDC_IEC_559__).  But it should 
aim to do so (provided the user doesn't specify options such as 
-fno-trapping-math in this case).

> A possibly-related issue is that this macro is defined in a header file
> provided by glibc, not by GCC.

That's a bug in the combination of glibc and GCC, requiring cooperation 
between them to fix.  The macro must be defined from the start of the 
translation unit without any headers needing to be included; the same also 
applies to __STDC_ISO_10646__ which is definitely a property of the 
library.  My suggested solution is still as at 
<http://gcc.gnu.org/ml/gcc/2004-05/msg01019.html>: an implicitly included 
header <stdc-predef.h> that is provided by the library, makes such 
definitions, *does not include other glibc headers such as features.h* 
(because the source file may define feature test macros later before it 
first explicitly includes a system header), and whose absence is silently 
ignored by the compiler (in order to support older glibc without the 
header).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27682

Reply via email to