linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dibyendu Majumdar <mobile@majumdar.org.uk>
To: Linux-Sparse <linux-sparse@vger.kernel.org>
Subject: sparse-llvm potential error in linearized output
Date: Sun, 12 Mar 2017 13:04:30 +0000	[thread overview]
Message-ID: <CACXZuxfajgS=+3MEw-ECnsmnpZqu8WXLhjrvsfjkD1X-+dNxbw@mail.gmail.com> (raw)

I have the following test:

extern int printf(const char *, ...);
static char *randomletters = "agqwewbxklpfgytuorz";
int main(void)
{
 int i;
 for (i = 0; i < 20; i++) {
  int key;
  key = randomletters[i];
  printf("Inserting %d\n", key);
 }
 return 0;
}

The linearized output is:

main:
.L0:
        <entry-point>
        phisrc.32   %phi4(i) <- $0
        br          .L4
.L4:
        phi.32      %r1(i) <- %phi4(i), %phi5(i)
        setlt.32    %r2 <- %r1(i), $20
        br          %r2, .L1, .L5
.L1:
        load.64     %r3 <- 0[randomletters]
        scast.64    %r5 <- (32) %r1(i)
        add.64      %r6 <- %r3, %r5
        load.8      %r7 <- 0[%r6]
        scast.32    %r8 <- (8) %r7
        symaddr.64  %r9 <- <anon symbol:0000020914372028>
        call.32     %r11 <- printf, %r9, %r8
        add.32      %r13 <- %r1(i), $1
        phisrc.32   %phi5(i) <- %r13
        br          .L4
.L5:
        ret.32      $0

The following instruction looks incorrect to me:

        load.64     %r3 <- 0[randomletters]


Thanks and Regards

Dibyendu

             reply	other threads:[~2017-03-12 13:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-12 13:04 Dibyendu Majumdar [this message]
     [not found] ` <CA+55aFzqZozMb0A4HMJ8UTNEV+LqHWXQsSBrPLMts_vkxsKtQA@mail.gmail.com>
     [not found]   ` <CA+55aFxuovvof9UhSAnQMuBjEr0xd8qxbDSV1cpi_ubWx386Zg@mail.gmail.com>
     [not found]     ` <CA+55aFyaW01tfG5LP+aeV-hSppzhqW7gCV7EM2OmxbJyg0cBXw@mail.gmail.com>
2017-03-12 16:52       ` sparse-llvm potential error in linearized output Dibyendu Majumdar

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='CACXZuxfajgS=+3MEw-ECnsmnpZqu8WXLhjrvsfjkD1X-+dNxbw@mail.gmail.com' \
    --to=mobile@majumdar.org.uk \
    --cc=linux-sparse@vger.kernel.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 NNTP newsgroup(s).