public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Matthias Klose <doko@net.local>
To: gcc-gnats@gcc.gnu.org, debian-gcc@lists.debian.org
Subject: optimization/9814: gcc fails to optimise if (l&2) l|=2 away
Date: Sun, 23 Feb 2003 07:46:00 -0000	[thread overview]
Message-ID: <E18mqpN-00087i-00@tango.net.local> (raw)


>Number:         9814
>Category:       optimization
>Synopsis:       gcc fails to optimise if (l&2) l|=2 away
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 23 07:46:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     herbert@gondor.apana.org.au
>Release:        3.2.2 (Debian) (Debian unstable)
>Organization:
The Debian Project
>Environment:
System: Debian GNU/Linux (unstable)
Architecture: i686

	
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
ii  gcc-3.2        3.2.3-0pre1    The GNU C compiler
ii  g++-3.2        3.2.3-0pre1    The GNU C++ compiler
ii  libstdc++5     3.2.3-0pre1    The GNU Standard C++ Library v3
ii  libstdc++5-dev 3.2.3-0pre1    The GNU Standard C++ Library v3 (development
ii  binutils       2.13.90.0.18-1 The GNU assembler, linker and binary utiliti
ii  libc6          2.3.1-13       GNU C Library: Shared libraries and Timezone
host: i386-linux
>Description:
[ Reported to the Debian BTS as report #181096.
  Please CC 181096@bugs.debian.org on replies.
  Log of report can be found at http://bugs.debian.org/181096 ]
	

Checked with current 3.2 and 3.3 branches (20030221)

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)"

>How-To-Repeat:
	
>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2003-02-23  7:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-23  7:46 Matthias Klose [this message]
2003-03-22 18:45 bangerth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E18mqpN-00087i-00@tango.net.local \
    --to=doko@net.local \
    --cc=181096@bugs.debian.org \
    --cc=debian-gcc@lists.debian.org \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).