Consider:
extern unsigned char size_lookup[257];
int
foo (unsigned int t)
{
return (size_lookup [(int) t] == size_lookup[t]);
}
int
bar (unsigned int t)
{
int a = t;
return a == t;
}
Both functions should return 1, and in fact that's what the RTL optimizers
notice, but the tree optimizers don't.
This is somewhat related to PR 19790.
--
Summary: Missed optimizations due to signedness in the way
Product: gcc
Version: unknown
Status: UNCONFIRMED
Keywords: missed-optimization, TREE
Severity: enhancement
Priority: P2
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kazu at cs dot umass dot edu
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19792