This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Question about precise definition FLOOR_MOD_EXPR


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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]