[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#181096: gcc-3.2: gcc fails to optimise if (l&2) l|=2 away



Package: gcc-3.2
Version: 1:3.2.3-0pre1
Severity: wishlist

The following function doesn't get optimised away as a noop:

int k(int l)
{
	if (l & 2)
		l |= 2;
	return l;
}

$ gcc-3.2 -O2 -S b.c
$ cat b.s
	.file	"b.c"
	.text
	.p2align 2,,3
.globl k
	.type	k,@function
k:
	pushl	%ebp
	movl	%esp, %ebp
	movl	8(%ebp), %eax
	testl	$2, %eax
	je	.L2
	orl	$2, %eax
.L2:
	leave
	ret
.Lfe1:
	.size	k,.Lfe1-k
	.ident	"GCC: (GNU) 3.2.3 20030210 (Debian prerelease)"

-- System Information
Debian Release: testing/unstable
Kernel Version: Linux gondolin 2.4.20-686-smp #1 SMP Mon Jan 13 23:06:41 EST 2003 i686 Pentium III (Coppermine) GenuineIntel GNU/Linux

Versions of the packages gcc-3.2 depends on:
ii  binutils       2.13.90.0.10-1 The GNU assembler, linker and binary utiliti
ii  cpp-3.2        3.2.1-0pre3    The GNU C preprocessor.
ii  gcc-3.2-base   3.2.1-0pre3    The GNU Compiler Collection (base package).
ii  libc6          2.2.5-14.3     GNU C Library: Shared libraries and Timezone
ii  libgcc1        3.2.1-0pre3    GCC support library.



Reply to: