This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/53462] New: template method constant folding division-by-zero warning within dead code
- From: "rikaigcc at rikai dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 23 May 2012 17:47:51 +0000
- Subject: [Bug c++/53462] New: template method constant folding division-by-zero warning within dead code
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53462
Bug #: 53462
Summary: template method constant folding division-by-zero
warning within dead code
Classification: Unclassified
Product: gcc
Version: 4.4.6
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: rikaigcc@rikai.com
This code:
#include <stdio.h>
template <int I> struct foo {
static void bar() {
if (I && 10/I > 2) {
printf("Hello world\n");
}
}
};
int main(int, char**) {
foo<0>::bar();
return(0);
}
yields:
/tmp/t.cc: In static member function âstatic void foo<I>::bar() [with int I =
0]â:
/tmp/t.cc:10: instantiated from here
/tmp/t.cc:4: warning: division by zero
(but the division by zero is protected).