public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/8419: Erroneous warning: left shift count >= width of type
@ 2002-11-06 14:07 bangerth
0 siblings, 0 replies; 2+ messages in thread
From: bangerth @ 2002-11-06 14:07 UTC (permalink / raw)
To: carlo, gcc-bugs, gcc-prs, nobody
Synopsis: Erroneous warning: left shift count >= width of type
State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Wed Nov 6 14:07:22 2002
State-Changed-Why:
This is basically a duplicate of 4210.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8419
^ permalink raw reply [flat|nested] 2+ messages in thread
* c++/8419: Erroneous warning: left shift count >= width of type
@ 2002-10-31 20:46 carlo
0 siblings, 0 replies; 2+ messages in thread
From: carlo @ 2002-10-31 20:46 UTC (permalink / raw)
To: gcc-gnats
>Number: 8419
>Category: c++
>Synopsis: Erroneous warning: left shift count >= width of type
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Oct 31 20:46:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: carlo@alinoe.com
>Release: gcc-3.2
>Organization:
>Environment:
i686-gnu-linux
>Description:
Compiler gives a warning about a shift width
for code that is never executed. This is highly
annoying because there is no work around and I
always use -Werror.
I reported this as C++ front-end, because I think
that this can only be a problem when the shift is
a template parameter 'constant'; otherwise you can
avoid the warning by simply not including the code
that is never executed.
>How-To-Repeat:
Compile the following:
void f()
{
static int const s = 32;
unsigned int a = 0x12345678;
if (s >= 32)
a = 0;
else // Now s is garanteed less than 32!
a <<= s;
}
Or, more practical, compile this:
template<unsigned int shift>
unsigned int f(unsigned int a)
{
if (shift >= 32)
a = 0;
else // Now s is garanteed less than 32!
a <<= shift;
}
void g()
{
f<32>(0x12345678);
}
> g++-3.2 -v -c troep.cc
Reading specs from /usr/local/gcc-3.2/lib/gcc-lib/i686-pc-linux-gnu/3.2/specs
Configured with: /usr/src/gcc/gcc-3.2/configure --prefix=/usr/local/gcc-3.2 --enable-shared --with-gnu-as --with-gnu-ld --enable-languages=c++ --enable-debug --enable-threads
Thread model: posix
gcc version 3.2
/usr/local/gcc-3.2/lib/gcc-lib/i686-pc-linux-gnu/3.2/cc1plus -v -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=0 -D__GXX_ABI_VERSION=102 -D__ELF__ -Dunix -D__gnu_linux__ -Dlinux -D__ELF__ -D__unix__ -D__gnu_linux__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ troep.cc -D__GNUG__=3 -D__DEPRECATED -D__EXCEPTIONS -quiet -dumpbase troep.cc -version -o /tmp/ccqu1OxB.s
GNU CPP version 3.2 (cpplib) (i386 Linux/ELF)
GNU C++ version 3.2 (i686-pc-linux-gnu)
compiled by GNU C version 3.2.
ignoring nonexistent directory "/usr/local/gcc-3.2/i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/gcc-3.2/include/c++/3.2
/usr/local/gcc-3.2/include/c++/3.2/i686-pc-linux-gnu
/usr/local/gcc-3.2/include/c++/3.2/backward
/usr/local/include
/usr/local/gcc-3.2/include
/usr/local/gcc-3.2/lib/gcc-lib/i686-pc-linux-gnu/3.2/include
/usr/include
End of search list.
troep.cc: In function `unsigned int f(unsigned int) [with unsigned int shift =
32]':
troep.cc:12: instantiated from here
troep.cc:7: warning: left shift count >= width of type
as -V -Qy -o troep.o /tmp/ccqu1OxB.s
GNU assembler version 2.12.90.0.15 (i386-redhat-linux) using BFD version 2.12.90.0.15 20020717
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-11-06 22:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-06 14:07 c++/8419: Erroneous warning: left shift count >= width of type bangerth
-- strict thread matches above, loose matches on Subject: below --
2002-10-31 20:46 carlo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).