public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: glen@imodulo.com To: gcc-gnats@gcc.gnu.org Subject: optimization/8632: [3.3 regression] uninitialized argument passed to leaf function w/o side-effects Date: Mon, 25 Nov 2002 08:48:00 -0000 [thread overview] Message-ID: <20021119031827.17684.qmail@sources.redhat.com> (raw) >Number: 8632 >Category: optimization >Synopsis: [3.3 regression] uninitialized argument passed to leaf function w/o side-effects >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Mon Nov 18 19:26:01 PST 2002 >Closed-Date: >Last-Modified: >Originator: Glen Nakamura >Release: gcc version 3.3 20021118 (experimental) >Organization: >Environment: i686-pc-linux-gnu >Description: GCC generates the following code for function main: main: pushl %ebp movl %esp, %ebp pushl %edi pushl %esi xorl %esi, %esi pushl %ebx subl $12, %esp andl $-16, %esp .p2align 4,,15 .L8: movl %esi, 4(%esp) movl a, %eax movl %eax, (%esp) call foo testl %eax, %eax je .L14 decl %eax leal 1(%esi), %ebx je .L15 .L11: movl %ebx, %esi jmp .L8 .p2align 4,,7 .L15: movl %ebx, 4(%esp) movl %edi, (%esp) <<< %edi is uninitialized call foo ... The problem goes away if foo calls another function, or if foo writes to a global variable. The testcase also works if we compile with any of the following: gcc -O0 -mcpu=i686 testcase.c gcc -O1 -mcpu=i686 testcase.c gcc -O2 -mcpu=i586 testcase.c >How-To-Repeat: gcc -O2 -mcpu=i686 testcase.c ./a.out >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/octet-stream; name="testcase.c" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="testcase.c" ZXh0ZXJuIHZvaWQgYWJvcnQgKCk7CgpzdGF0aWMgaW50IGEgPSAxMjM0NTsKCnN0YXRpYyBpbnQK Zm9vIChpbnQgYiwgaW50IGlkeCkKewogIGlmIChiICE9IGEpCiAgICByZXR1cm4gLTE7CiAgZWxz ZSBpZiAoaWR4IDwgMikKICAgIHJldHVybiAxOwogIGVsc2UKICAgIHJldHVybiAwOwp9CgppbnQK bWFpbiAoKQp7CiAgaW50IGlkeCA9IDA7CgogIHdoaWxlIChmb28gKGEsIGlkeCkpCiAgICB7CiAg ICAgIGlmIChmb28gKGEsIGlkeCkgPT0gMQoJICAmJiBmb28gKGEsIGlkeCArIDEpID09IC0xKQoJ ewoJICBhYm9ydCAoKTsKCX0KICAgICAgKytpZHg7CiAgICB9CiAgcmV0dXJuIDA7Cn0K
next reply other threads:[~2002-11-19 3:26 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-11-25 8:48 glen [this message] 2002-12-02 18:06 Glen Nakamura 2003-02-18 14:07 ebotcazou
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=20021119031827.17684.qmail@sources.redhat.com \ --to=glen@imodulo.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).