This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/24689] New: store_ccp is missing an opportunity!?
- From: "kazu at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Nov 2005 02:26:52 -0000
- Subject: [Bug tree-optimization/24689] New: store_ccp is missing an opportunity!?
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Consider:
extern void bar (unsigned int);
int
foo (void)
{
char buf[1] = { 3 };
const char *p = buf;
const char **q = &p;
unsigned int ch;
switch (**q)
{
case 1: ch = 5; break;
default: ch = 0; break;
}
#if 1
bar (ch);
#endif
return ch;
}
This function should be optimized to "return 0;", but it isn't.
Interestingly, if you change "#if 1" to "#if 0", you are going to get
this optimized.
The testcase is derived from PR 20583.
--
Summary: store_ccp is missing an opportunity!?
Product: gcc
Version: unknown
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kazu at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24689