public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: torek@bsdi.com To: gcc-gnats@gcc.gnu.org Subject: optimization/7690: gcc 2.95.3: argument destroyed under -O2 on IA32 Date: Thu, 22 Aug 2002 15:56:00 -0000 [thread overview] Message-ID: <20020822220202.7531.qmail@sources.redhat.com> (raw) >Number: 7690 >Category: optimization >Synopsis: gcc 2.95.3: argument destroyed under -O2 on IA32 >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Thu Aug 22 15:06:00 PDT 2002 >Closed-Date: >Last-Modified: >Originator: torek@bsdi.com >Release: gcc 2.95.3 >Organization: >Environment: BSD/OS 4.3 >Description: The stripped-down C code below generates IA32 assembly that destroys the "name" parameter before making another call, but only when using -O2. This code is simplified from a real program (squid) and no longer does anything useful on its own, so you must look at the generated assembly. I was hoping this is a known bug with a known fix that I can find somewhere so as to patch it. >How-To-Repeat: typedef unsigned long long off_t; typedef unsigned int size_t; off_t f1(char *buf, size_t sz, const char *name); void f2(int); void bug(char *buf, size_t sz, const char *name, unsigned type) { off_t off; off = f1(buf, sz, name); memcpy(buf + off, &type, sizeof(type)); f2(off <= sz); } compile with -O2, examine assembly, note this section: movl 8(%ebp),%edi movl 12(%ebp),%eax xorl %edx,%edx movl %eax,12(%ebp) movl %edx,16(%ebp) note that 16(%ebp) used to hold the parameter "name" before this last movl, which (since %edx is now 0) clobbers it. Using -O1 -fexpensive-optimizations appears to suffice to trigger the problem (but -O1 alone does not). >Fix: >Release-Note: >Audit-Trail: >Unformatted:
next reply other threads:[~2002-08-22 22:06 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-08-22 15:56 torek [this message] 2002-08-22 18:06 Chris Torek 2002-08-23 0:06 Chris Torek 2002-12-06 13:16 bangerth 2003-03-12 18:47 neroden
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=20020822220202.7531.qmail@sources.redhat.com \ --to=torek@bsdi.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).