public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: awong@cs.washington.edu To: gcc-gnats@gcc.gnu.org Subject: optimization/8313: gcc 3.2 on -O2 and yields bad code for unsigned short argument Date: Tue, 22 Oct 2002 13:56:00 -0000 [thread overview] Message-ID: <20021022205329.19254.qmail@sources.redhat.com> (raw) >Number: 8313 >Category: optimization >Synopsis: gcc 3.2 on -O2 and yields bad code for unsigned short argument >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Tue Oct 22 13:56:00 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Albert Wong >Release: unknown-1.0 >Organization: >Environment: gentoo linux 1.4 PPC (G4 Cube) >Description: This error occurs only on optimization level 2 When passing in an argument of type unsigned short = 65535, gcc3.2 on the ppc generates the code li 3,-1 which incorrectly sign extends the value in the register to a 32-bit -1 rather than a 16-bit -1. >How-To-Repeat: gcc -O2 test.c ./a.out This will be an inifinite loop, though the code should terminate after 2 calls to "inf_loop". >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/octet-stream; name="test.c" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="test.c" I2luY2x1ZGUgPHN0ZGlvLmg+CgojZGVmaW5lIEEgMHhmZmZmCgp0eXBlZGVmIHVuc2lnbmVkIHNo b3J0IHUxNl90OwoKaW50IGluZl9sb29wKHUxNl90IHR5cGUpIHsKCglpZiggdHlwZSA9PSBBICkg ewoJCWZwcmludGYoc3RkZXJyLCAiQnJlYWsgcmVjdXJzaW9uXG4iKTsKCQlyZXR1cm4gMDsKCX0K CglmcHJpbnRmKHN0ZGVyciwgIlJlY3Vyc2lvblxuIik7CgoJcmV0dXJuIGluZl9sb29wKEEpOwp9 CgppbnQgbWFpbih2b2lkKSB7CglpbmZfbG9vcCgxKTsKCXJldHVybiAwOwp9Cgo=
reply other threads:[~2002-10-22 20:56 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20021022205329.19254.qmail@sources.redhat.com \ --to=awong@cs.washington.edu \ --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: linkBe 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).