This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/22199] New: Unnecessary casts for comparison
- From: "tkoenig at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Jun 2005 15:04:45 -0000
- Subject: [Bug tree-optimization/22199] New: Unnecessary casts for comparison
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
$ cat labs.c
extern long int labs (long int __x) __attribute__ ((__const__));
int main()
{
int a,b;
foo(&a, &b);
if (labs(a) > b)
return 1;
else
return 0;
}
is translated with
$ gcc -O3 -fdump-tree-optimized -S labs.c
into
<bb 0>:
foo (&a, &b);
return (int) (ABS_EXPR <(long int) a> > (long int) b);
The casts aren't necessary in this case.
--
Summary: Unnecessary casts for comparison
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P2
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tkoenig at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22199