public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "gpiez at web dot de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/44811] New: non controlable bogus warning: right/left shift count is negative Date: Sun, 04 Jul 2010 14:54:00 -0000 [thread overview] Message-ID: <bug-44811-11646@http.gcc.gnu.org/bugzilla/> (raw) 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
next reply other threads:[~2010-07-04 14:54 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-07-04 14:54 gpiez at web dot de [this message] 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-44811-11646@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).