Hi,

On Sun, 24 Dec 2017, Vincent Lefevre wrote:

I think we could make an exception for 0.0/0.0 and always fold this into NaN
(normally division by zero is indeed not allowable in constant expressions
in c99).

AFAIK, the standard just implies that 0.0/0.0 is not specified as a
constant expression. But the standard also says: "An implementation
may accept other forms of constant expressions."

Moreover, if Annex F is supported, then FP division by zero is
well-defined. F7.4.2 gives examples with 0.0/0.0 in initializers,
such as:

 static float x = 0.0/0.0; // does not raise an exception

Nowadays, supporting Annex F is more or less a must.

Right you are. There are differences in rules for accepting integer constant expressions and "mere" constant expressions used e.g. for static initializers. They can (and with annex F have to) be accepted and FP exceptions be ignored at translation time. (Not so for non-static initializers where the exceptions need to be raised at runtime).

Fixed in mob.


Ciao,
Michael.

_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to