public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: schwab@suse.de To: gcc-gnats@gcc.gnu.org Subject: optimization/7717: Invalid loop unrolling Date: Sun, 25 Aug 2002 15:56:00 -0000 [thread overview] Message-ID: <20020825210452.24280.qmail@sources.redhat.com> (raw) >Number: 7717 >Category: optimization >Synopsis: Invalid loop unrolling >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Sun Aug 25 14:06:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: schwab@suse.de >Release: 3.2 >Organization: >Environment: System: Linux sykes 2.4.18-SMP #1 SMP Thu May 16 09:03:14 UTC 2002 ia64 unknown unknown GNU/Linux Architecture: ia64 host: ia64-suse-linux-gnu build: ia64-suse-linux-gnu target: ia64-suse-linux-gnu configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --enable-languages=c,c++,f77,objc,java,ada --enable-libgcj --with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit ia64-suse-linux >Description: The loop in the attached file is miscompiled with -O2 -funroll-loops. The problem is that the loop count is miscomputed, so that the loop is executed ULONG_MAX times. >How-To-Repeat: $ gcc -O2 -funroll-loops -v takehiro.i Reading specs from /usr/lib/gcc-lib/ia64-suse-linux/3.2/specs Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --enable-languages=c,c++,f77,objc,java,ada --enable-libgcj --with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit ia64-suse-linux Thread model: posix gcc version 3.2 /usr/lib/gcc-lib/ia64-suse-linux/3.2/cc1 -fpreprocessed takehiro.i -quiet -dumpbase takehiro.i -O2 -version -funroll-loops -o /tmp/ccjOclOf.s GNU CPP version 3.2 (cpplib) (IA-64) Linux GNU C version 3.2 (ia64-suse-linux) compiled by GNU C version 3.2. /usr/lib/gcc-lib/ia64-suse-linux/3.2/../../../../ia64-suse-linux/bin/as -x -o /tmp/ccWx8eKI.o /tmp/ccjOclOf.s /usr/lib/gcc-lib/ia64-suse-linux/3.2/collect2 -dynamic-linker /lib/ld-linux-ia64.so.2 /usr/lib/gcc-lib/ia64-suse-linux/3.2/../../../crt1.o /usr/lib/gcc-lib/ia64-suse-linux/3.2/../../../crti.o /usr/lib/gcc-lib/ia64-suse-linux/3.2/crtbegin.o -L/usr/lib/gcc-lib/ia64-suse-linux/3.2 -L/usr/lib/gcc-lib/ia64-suse-linux/3.2/../../../../ia64-suse-linux/lib -L/usr/lib/gcc-lib/ia64-suse-linux/3.2/../../.. /tmp/ccWx8eKI.o -lgcc -lgcc_eh -lc -lgcc -lgcc_eh /usr/lib/gcc-lib/ia64-suse-linux/3.2/crtend.o /usr/lib/gcc-lib/ia64-suse-linux/3.2/../../../crtn.o $ ./a.out Segmentation fault >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: text/x-csrc; name="takehiro.i" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="takehiro.i" dHlwZWRlZiBsb25nIHVuc2lnbmVkIGludCBzaXplX3Q7CmV4dGVybiB2b2lkICptZW1jcHkgKHZv aWQgKl9fcmVzdHJpY3QgX19kZXN0LAogICAgICAgICAgICAgICAgICAgICBfX2NvbnN0IHZvaWQg Kl9fcmVzdHJpY3QgX19zcmMsIHNpemVfdCBfX24pIDsKaW50IHByaW50ZiAoY29uc3QgY2hhciAq LCAuLi4pOwoKdHlwZWRlZiBzdHJ1Y3QgewogICAgICAgIGludCBwYXJ0Ml8zX2xlbmd0aDsKICAg ICAgICBpbnQgYmlnX3ZhbHVlczsKICAgICAgICBpbnQgY291bnQxOwogICAgICAgIGludCBnbG9i YWxfZ2FpbjsKICAgICAgICBpbnQgc2NhbGVmYWNfY29tcHJlc3M7CiAgICAgICAgaW50IHdpbmRv d19zd2l0Y2hpbmdfZmxhZzsKICAgICAgICBpbnQgYmxvY2tfdHlwZTsKICAgICAgICBpbnQgbWl4 ZWRfYmxvY2tfZmxhZzsKICAgICAgICBpbnQgdGFibGVfc2VsZWN0WzNdOwogICAgICAgICBpbnQg c3ViYmxvY2tfZ2FpblszXTsKICAgICAgICAgaW50IHJlZ2lvbjBfY291bnQ7CiAgICAgICAgIGlu dCByZWdpb24xX2NvdW50OwogICAgICAgICBpbnQgcHJlZmxhZzsKICAgICAgICAgaW50IHNjYWxl ZmFjX3NjYWxlOwogICAgICAgICBpbnQgY291bnQxdGFibGVfc2VsZWN0OwoKICAgICAgICAgaW50 IHBhcnQyX2xlbmd0aDsKICAgICAgICAgaW50IHNmYl9sbWF4OwogICAgICAgICBpbnQgc2ZiX3Nt aW47CiAgICAgICAgIGludCBjb3VudDFiaXRzOwoKICAgICAgICAgY29uc3QgaW50ICpzZmJfcGFy dGl0aW9uX3RhYmxlOwogICAgICAgICBpbnQgc2xlbls0XTsKfSBncl9pbmZvOwpjb25zdCAgY2hh ciB0MzJsW10gID0gewogIDErMCwgIDQrMSwgIDQrMSwgIDUrMiwgIDQrMSwgIDYrMiwgIDUrMiwg IDYrMywKICA0KzEsICA1KzIsICA1KzIsICA2KzMsICA1KzIsICA2KzMsICA2KzMsICA2KzR9OwoK Y29uc3QgIGNoYXIgdDMzbFtdICA9IHsKICA0KzAsICA0KzEsICA0KzEsICA0KzIsICA0KzEsICA0 KzIsICA0KzIsICA0KzMsCiAgNCsxLCAgNCsyLCAgNCsyLCAgNCszLCAgNCsyLCAgNCszLCAgNCsz LCAgNCs0fTsKCnZvaWQgYmVzdF9odWZmbWFuX2RpdmlkZSgKICAgICAgICAgIGdyX2luZm8gKiBj b25zdCBnaSwKICAgICAgICAgIGludCAqIGNvbnN0IGl4ICkKewogICAgaW50IGksIGExLCBhMjsK ICAgIGdyX2luZm8gY29kX2luZm8yOwoKICAgIGkgPSBnaS0+Y291bnQxICsgMjsKCiAgICBtZW1j cHkoJmNvZF9pbmZvMiwgZ2ksIHNpemVvZihncl9pbmZvKSk7CiAgICBjb2RfaW5mbzIuY291bnQx ID0gaTsKICAgIGExID0gYTIgPSAwOwoKICAgIGZvciAoOyBpID4gY29kX2luZm8yLmJpZ192YWx1 ZXM7IGkgLT0gNCkgewogICAgICAgIGludCBwID0gKChpeFtpLTRdICogMiArIGl4W2ktM10pICog MiArIGl4W2ktMl0pICogMiArIGl4W2ktMV07CiAgICAgICAgYTEgKz0gdDMybFtwXTsKICAgICAg ICBhMiArPSB0MzNsW3BdOwogICAgfQogICAgY29kX2luZm8yLmJpZ192YWx1ZXMgPSBpOwoKICAg IGNvZF9pbmZvMi5jb3VudDF0YWJsZV9zZWxlY3QgPSAwOwogICAgaWYgKGExID4gYTIpIHsKICAg ICAgICBhMSA9IGEyOwogICAgICAgIGNvZF9pbmZvMi5jb3VudDF0YWJsZV9zZWxlY3QgPSAxOwog ICAgfQoKICAgIGNvZF9pbmZvMi5jb3VudDFiaXRzID0gYTE7CiAgICBjb2RfaW5mbzIucGFydDJf M19sZW5ndGggPSBhMSArIGNvZF9pbmZvMi5wYXJ0Ml9sZW5ndGg7CiAgICBtZW1jcHkoZ2ksICZj b2RfaW5mbzIsIHNpemVvZihncl9pbmZvKSk7Cn0KCmludAptYWluICgpCnsKICBncl9pbmZvIGdp ID0geyAuY291bnQxID0gNDA0LCAuYmlnX3ZhbHVlcyA9IDM5NiB9OwogIGludCBpeFs0MDZdID0g eyAwIH07CgogIGJlc3RfaHVmZm1hbl9kaXZpZGUgKCZnaSwgaXgpOwoKICByZXR1cm4gMDsKfQo=
next reply other threads:[~2002-08-25 21:06 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-08-25 15:56 schwab [this message] 2002-10-22 4:08 schwab
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=20020825210452.24280.qmail@sources.redhat.com \ --to=schwab@suse.de \ --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).