This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
unsigned / double propagation weirdness?
- From: Richard Guenther <rguenth at tat dot physik dot uni-tuebingen dot de>
- To: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Mon, 23 Feb 2004 15:42:51 +0100
- Subject: unsigned / double propagation weirdness?
Hi, I'm getting confusing (but consistent along a lot of different
compilers) results out of this testcase:
int main(int argc, char **argv)
{
double dm = 1.0;
unsigned int i = 1;
if (-i*dm != -((double)i)*dm)
abort();
return 0;
}
From the standard I cannot understand why this should abort. Are there
some weird type propagation rules for unsigned vs. real types? At least
gcc, Intel icc and IRIX cc seem to "agree" this should abort. Also
cprop with -O2 from gcc does so.
Weird. Maybe gcc should warn about mixed unsigned/real arithmetic with
-Wall?
Richard.