This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/30137] New: Missed folding of pointer comparison
- From: "steven at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Dec 2006 18:32:12 -0000
- Subject: [Bug tree-optimization/30137] New: Missed folding of pointer comparison
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Compiler:
GNU C version 4.3.0 20061210 (experimental) (x86_64-unknown-linux-gnu)
Test case:
----------------------
struct { long base; } *s;
int foo1 (void) { return (s == &s->base); }
int foo2 (void) { return ((void *)s == (void *) &s->base); }
----------------------
.final_cleanup dump:
----------------------
;; Function foo1 (foo1)
foo1 ()
{
struct
{
long int base;
} * s.0;
<bb 2>:
s.0 = s;
return s.0 == &s.0->base;
}
;; Function foo2 (foo2)
foo2 ()
{
struct
{
long int base;
} * s.1;
<bb 2>:
s.1 = s;
return s.1 == &s.1->base;
}
----------------------
.s output:
----------------------
.globl foo1
.type foo1, @function
foo1:
.LFB2:
movl $1, %eax
ret
.LFE2:
.size foo1, .-foo1
.p2align 4,,15
.globl foo2
.type foo2, @function
foo2:
.LFB3:
movl $1, %eax
ret
.LFE3:
.size foo2, .-foo2
(etc.)
----------------------
--
Summary: Missed folding of pointer comparison
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: missed-optimization, TREE
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: steven at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30137