This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Unsure about a new warning in mainline
- From: Paolo Carlini <pcarlini at suse dot de>
- To: gcc at gcc dot gnu dot org
- Cc: lopezibanez at gmail dot com
- Date: Sun, 14 Jan 2007 15:30:23 +0100
- Subject: Unsure about a new warning in mainline
Hi,
i'd like to ask the help of the list in clarifying a new warning in
mainline. Let's assume x86-linux (so 32-bits, signed wchar_t, etc...)
For this snipped I get a new warning:
int main()
{
wchar_t wc = ((wchar_t)1 << 31) - 1;
return ((int)1 << 31) - 1;
}
warning.cc:3: warning: overflow in implicit constant conversion
In particular, what's the difference between line 3 and line 4? I'm
asking also because "another" compiler issues both:
warning.cc(3): warning #61: integer operation result is out of range
wchar_t wc = ((wchar_t)1 << 31) - 1;
^
warning.cc(4): warning #61: integer operation result is out of range
return ((wchar_t)1 << 31) - 1;
Thanks in advance,
Paolo.