public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: geist@foobox.com To: gcc-gnats@gcc.gnu.org Subject: middle-end/9063: invalid compile-time evaluation of tertiary expression Date: Fri, 27 Dec 2002 00:46:00 -0000 [thread overview] Message-ID: <20021227084117.8797.qmail@sources.redhat.com> (raw) >Number: 9063 >Category: middle-end >Synopsis: invalid compile-time evaluation of tertiary expression >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Fri Dec 27 00:46:01 PST 2002 >Closed-Date: >Last-Modified: >Originator: Travis Geiselbrecht >Release: gcc version 3.2.2 20021212 (Debian prerelease) >Organization: >Environment: Debian Linux 3.0 testing. x86 pc >Description: The following minimal program will reproduce if compiled with any levels of optimization. Problem: the expression (100000 + 1 ? 99 : 0) takes on a value of '99', instead of the expected 100099. A simple addition of parenthesis to produce (100000 + (1 ? 99 : 0)) produces the proper result. Not incredibly serious, but I bumped into it and took a while to figure out. Reproduced on 2.95.4, 3.0.4, and this 3.2.2 pre-release version in debian. Originally seen on 3.0.4 i386. >How-To-Repeat: # 1 "bug.c" # 1 "<built-in>" # 1 "<command line>" # 1 "bug.c" int main() { printf("value of expression %d should be %d\n", (100000 + 1 ? 99 : 0), (100000 + (1 ? 99 : 0))); return 0; } >Fix: Add parentheses around the tertiary operator. >Release-Note: >Audit-Trail: >Unformatted:
next reply other threads:[~2002-12-27 8:46 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-12-27 0:46 geist [this message] 2002-12-27 3:04 aj
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=20021227084117.8797.qmail@sources.redhat.com \ --to=geist@foobox.com \ --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).