This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/7536: C++ front end does not warn of promotion of negativeints to unsigneds
- From: Wolfgang Bangerth <bangerth at ticam dot utexas dot edu>
- To: nobody at gcc dot gnu dot org
- Cc: gcc-prs at gcc dot gnu dot org,
- Date: 22 Nov 2002 02:16:03 -0000
- Subject: Re: c++/7536: C++ front end does not warn of promotion of negativeints to unsigneds
- Reply-to: Wolfgang Bangerth <bangerth at ticam dot utexas dot edu>
The following reply was made to PR c++/7536; it has been noted by GNATS.
From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: Gabriel Dos Reis <gdr@integrable-solutions.net>
Cc: bangerth@dealii.org, <gcc-bugs@gcc.gnu.org>, <jss@ast.cam.ac.uk>,
<gcc-gnats@gcc.gnu.org>
Subject: Re: c++/7536: C++ front end does not warn of promotion of negative
ints to unsigneds
Date: Thu, 21 Nov 2002 20:09:52 -0600 (CST)
> | Weird. I don't know what the standard says, though.
>
> -10 is well-defined as unsigned integer :-)
:-) Sure. But does the standard say that in the return expression of
double dostuff(int i)
{
const unsigned cx = 10;
return i-cx;
}
"i" is converted to unsigned, or "cx" to signed? Depending on that the
result is unexpected or not.
In any case, the compiler max/should warn here.
Regards
W.
-------------------------------------------------------------------------
Wolfgang Bangerth email: bangerth@ticam.utexas.edu
www: http://www.ticam.utexas.edu/~bangerth