public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: fshvaige@cisco.com To: gcc-gnats@gcc.gnu.org Subject: optimization/6984: wrong code generated with -O2, -O3, -Os for do-while loop on PowerPC Date: Mon, 10 Jun 2002 08:26:00 -0000 [thread overview] Message-ID: <20020610152230.22267.qmail@sources.redhat.com> (raw) >Number: 6984 >Category: optimization >Synopsis: wrong code generated with -O2, -O3, -Os for do-while loop on PowerPC >Confidential: no >Severity: critical >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Mon Jun 10 08:26:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: fshvaige@cisco.com >Release: 3.1 >Organization: >Environment: ../gcc-3.1/configure --with-gcc-version-trigger=/home/install/gcc-3.1/gcc/version.c --host=i686-pc-linux-gnu --with-newlib --enable-target-optspace --target=ppc-eabi --prefix=/home/crossGCC/ppc-eabi --with-local-prefix=/home/crossGCC/ppc-eabi --program-prefix=ppc-eabi- --enable-languages=c,c++ -v --norecursion >Description: File test1.c: void f1 (unsigned n) { do { } while (--n); } void f2 (unsigned n) { l1: if (--n) goto l1; } When compiled with: ppc-eabi-gcc -v -save-temps -c -O2 -Wall test1.c Produces wrong-large-ugly code for function f1(). The same for -O3 and -Os. For -O1 all Ok. Note: code for function f2() always Ok. >How-To-Repeat: compile test1.c: void f1 (unsigned n) { do { } while (--n); } void f2 (unsigned n) { l1: if (--n) goto l1; } with command line like: ppc-eabi-gcc -v -save-temps -c -O2 -Wall test1.c and see file test1.s: .file "test1.c" .section ".text" .align 2 .globl f1 .type f1,@function f1: cmpwi 0,3,0 bne- 0,.L7 li 3,1 .L7: mtctr 3 .L6: bdnz .L6 blr .Lfe1: .size f1,.Lfe1-f1 .align 2 .globl f2 .type f2,@function f2: mtctr 3 .L9: bdnz .L9 blr .Lfe2: .size f2,.Lfe2-f2 .ident "GCC: (GNU) 3.1" Code for f1() must be the same as for f2(). >Fix: >Release-Note: >Audit-Trail: >Unformatted:
next reply other threads:[~2002-06-10 15:26 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-06-10 8:26 fshvaige [this message] 2002-06-17 1:45 Alan Modra 2002-06-17 8:26 Alan Modra 2002-06-24 3:06 Alan Modra
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=20020610152230.22267.qmail@sources.redhat.com \ --to=fshvaige@cisco.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).