Question about precise definition FLOOR_MOD_EXPR
Richard Kenner
kenner@vlsi1.ultra.nyu.edu
Mon Aug 2 01:29:00 GMT 2004
What should the result of <FLOOR_MOD_EXPR 11 -5> be?
There is recent code added to fold that says that the negation can be ignored
so this should be 1.
However, if the "-5" is a variable and you let it be evaluated at runtime,
the result is -4.
I think it's a bad idea that folding produces a different result than
executing the computation at run-time.
Moreover, what *is* the result supposed to be? The Ada standard is clear
that it should be -4. From looking at the online version of the C
standard, I can't tell whether 1, -4 or choosing either at random is
a valid result. Does anybody know? How about C++? Java? Does this
come up in Fortran?
More information about the Gcc
mailing list