public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mikpe at it dot uu dot se" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/44328] switch/case optimization produces an invalid jump table index
Date: Sun, 30 May 2010 14:50:00 -0000	[thread overview]
Message-ID: <20100530145025.20689.qmail@sourceware.org> (raw)
In-Reply-To: <bug-44328-19252@http.gcc.gnu.org/bugzilla/>



------- Comment #2 from mikpe at it dot uu dot se  2010-05-30 14:50 -------
I can confirm this wrong-code when gcc 4.4/4.5 targets arm-unknown-eabi.
However, a 4.4/4.5 running natively on arm-unknown-linux-gnueabi does not
exhibit this behaviour.  There there's no 'comparison always true' warning, and
the generated code contains conditional instructions where the arm-unknown-eabi
gcc emitted unconditional instructions.

This is what 4.5-20100527 generates for me on arm-unknown-linux-gnueabi:

        sub     r1, r1, #1
        cmp     r1, #2
        ldrls   r3, .L4
        movhi   r1, #1
        ldrls   r1, [r3, r1, asl #2]
        b       open
.L5:
        .align  2
.L4:
        .word   .LANCHOR0
        .size   _Z9open_filePKc8OpenMode, .-_Z9open_filePKc8OpenMode
        .section        .rodata
        .align  2
.LANCHOR0 = . + 0
        .type   CSWTCH.2, %object
        .size   CSWTCH.2, 12
CSWTCH.2:
        .word   74
        .word   3
        .word   75

My guess is that the subtract+compare is done in a too narrow mode, resulting
in the warning and subsequent omission of the conditionals.

Also, it's not a jump table but a lookup table.


-- 

mikpe at it dot uu dot se changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikpe at it dot uu dot se


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44328


  parent reply	other threads:[~2010-05-30 14:50 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-30  0:00 [Bug c++/44328] New: " eblot dot ml at gmail dot com
2010-05-30 10:36 ` [Bug c++/44328] " eblot dot ml at gmail dot com
2010-05-30 14:50 ` mikpe at it dot uu dot se [this message]
2010-05-30 17:36 ` eblot dot ml at gmail dot com
2010-06-04 23:41 ` [Bug c++/44328] switch/case optimization produces an invalid lookup " eblot dot ml at gmail dot com
2010-06-15 15:09 ` jamborm at gcc dot gnu dot org
2010-06-17  9:21 ` eblot dot ml at gmail dot com
2010-06-17  9:37   ` Andrew Pinski
2010-06-17  9:34 ` eblot dot ml at gmail dot com
2010-06-17  9:37 ` pinskia at gmail dot com
2010-06-17 14:02 ` jamborm at gcc dot gnu dot org
2010-06-17 15:01 ` jamborm at gcc dot gnu dot org
2010-06-17 16:34 ` eblot dot ml at gmail dot com
2010-06-17 16:37 ` jamborm at gcc dot gnu dot org
2010-06-17 16:41 ` eblot dot ml at gmail dot com
2010-06-20 13:53 ` eblot dot ml at gmail dot com
2010-06-20 16:51 ` jamborm at gcc dot gnu dot org
2010-06-20 16:57 ` eblot dot ml at gmail dot com
2010-06-20 17:03 ` eblot dot ml at gmail dot com
2010-06-20 18:26 ` mikpe at it dot uu dot se
2010-06-21  8:29 ` jamborm at gcc dot gnu dot org
2010-06-21 10:45 ` mikpe at it dot uu dot se
2010-06-21 11:18 ` mikpe at it dot uu dot se
2010-07-05 13:43 ` [Bug tree-optimization/44328] " ramana at gcc dot gnu dot org
2010-07-24 22:24 ` jifl-bugzilla at jifvik dot org
2010-08-02 12:24 ` ian dot bolton at arm dot com
2010-08-02 13:33 ` ian dot bolton at arm dot com
2010-08-03 17:09 ` ian dot bolton at arm dot com
2010-09-01 11:10 ` jamborm at gcc dot gnu dot org
2010-09-01 11:23 ` jamborm at gcc dot gnu dot org
2010-09-01 11:24 ` jamborm at gcc dot gnu dot org
2010-09-01 11:25 ` ibolton at gcc dot gnu dot org
2010-09-01 11:33 ` jamborm at gcc dot gnu dot org
2010-09-01 11:47 ` jifl-bugzilla at jifvik dot org
2010-09-01 11:50 ` jakub at gcc dot gnu dot org
2010-09-02 13:10 ` ibolton at gcc dot gnu dot org
2010-09-07  9:28 ` ibolton at gcc dot gnu dot org
2010-09-09 15:37 ` ibolton at gcc dot gnu dot org
2010-09-09 15:38 ` rguenth at gcc dot gnu dot org

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=20100530145025.20689.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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: link
Be 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).