public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/44811]  New: non controlable bogus warning: right/left shift count is negative
@ 2010-07-04 14:54 gpiez at web dot de
  2010-07-04 15:03 ` [Bug c++/44811] " rguenth at gcc dot gnu dot org
  2010-07-05  1:14 ` [Bug c++/44811] non controllable " pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 6+ messages in thread
From: gpiez at web dot de @ 2010-07-04 14:54 UTC (permalink / raw)
  To: gcc-bugs

template<int N>
uint64_t shift(uint64_t b) {
    if (N > 0)
        return b << N;
    else
        return b >> -N;
}

int main() {
    int a = shift<-5>(0x100);
    int b = shift<5>(0x100);
    return a+b;
}

---
I am using this function template in a header, and other warnings and even
errors tend to get cluttered by the output of bogus "shift count is negative"
warnings. I understand that dead code elimination happens only in the optimizer
and probably to late to see that the negative shift count branch is never
executed, and I could live with that if the warning was controlable with some
"-W" option. Alas, it seems, it is not.
The only way to supress this warning is using "-w", which also inhibits other,
potential useful warnings, so using "-w" everywhere is not really an option.


-- 
           Summary: non controlable bogus warning: right/left shift count is
                    negative
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gpiez at web dot de


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44811


^ permalink raw reply	[flat|nested] 6+ messages in thread
[parent not found: <bug-44811-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2013-06-06 21:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-04 14:54 [Bug c++/44811] New: non controlable bogus warning: right/left shift count is negative gpiez at web dot de
2010-07-04 15:03 ` [Bug c++/44811] " rguenth at gcc dot gnu dot org
2010-07-05  1:14 ` [Bug c++/44811] non controllable " pinskia at gcc dot gnu dot org
     [not found] <bug-44811-4@http.gcc.gnu.org/bugzilla/>
2012-04-12 21:37 ` drwowe at yahoo dot com
2012-04-26 18:03 ` dpiepgrass at mentoreng dot com
2013-06-06 21:39 ` paolo.carlini at oracle dot com

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).