This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/21643] New: GCC fails to merge ranges in comparison.
- From: "dwmw2 at infradead dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 May 2005 12:32:26 -0000
- Subject: [Bug rtl-optimization/21643] New: GCC fails to merge ranges in comparison.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
I'd expect the result of compiling these two functions to be identical, but it
isn't:
int fish1(unsigned char c)
{
if (c =='"' || c == 0x20 || c < 0x20)
return 1;
}
int fish2(unsigned char c)
{
if (c == '"' || c <= 0x20)
return 1;
}
If I remove the 'c == '"' ||' from each, I do get the expected results.
$ gcc -O2 -S asd.c -o /dev/stdout
.file "asd.c"
.section ".text"
.align 2
.p2align 4,,15
.globl fish1
.type fish1, @function
fish1:
mr 0,3
li 3,1
cmpwi 7,0,34
cmpwi 6,0,32
beqlr 7
cmplwi 7,0,31
beqlr 6
blelr 7
blr
.size fish1,.-fish1
.align 2
.p2align 4,,15
.globl fish2
.type fish2, @function
fish2:
mr 0,3
li 3,1
cmpwi 7,0,34
cmplwi 6,0,32
beqlr 7
blelr 6
blr
.size fish2,.-fish2
.ident "GCC: (GNU) 4.0.0 20050512 (Red Hat 4.0.0-5)"
.section .note.GNU-stack,"",@progbits
--
Summary: GCC fails to merge ranges in comparison.
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dwmw2 at infradead dot org
CC: gcc-bugs at gcc dot gnu dot org,jakub at redhat dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21643