Linux SPARSE checker discussions
 help / color / mirror / Atom feed
From: Dave Jones <davej@redhat.com>
To: Christopher Li <sparse@chrisli.org>
Cc: linux-sparse@vger.kernel.org
Subject: Re: bad asm goto ?
Date: Mon, 25 Oct 2010 18:39:57 -0400	[thread overview]
Message-ID: <20101025223957.GA5561@redhat.com> (raw)
In-Reply-To: <AANLkTikVt5BJ+2W3P+wYUR3DLzhTatXhAW45wdc0eoOe@mail.gmail.com>

On Mon, Oct 25, 2010 at 03:10:29PM -0700, Christopher Li wrote:
 > On Mon, Oct 25, 2010 at 2:31 PM, Dave Jones <davej@redhat.com> wrote:
 > > I just ran sparse on a kernel tree for the first time in ages, and got
 > > hundreds of warnings, many of which related to the tracepoint macros
 > > in the kernel, which use the new asm goto feature.
 > >
 > > Looking at the git log of sparse, I see there was some support added
 > > for asm goto, but it seems to choke every time, printing ..
 > >
 > > include/trace/events/kmem.h:45:1: error: bad asm output
 > > include/trace/events/kmem.h:45:1: error: incompatible types in comparison expression (different address spaces)
 > >
 > >
 > > (this is with a sparse built from git head from a few minutes ago)
 > 
 > Do you have a smaller test case to reproduce the error?

I tried unwinding some of the nested macros, and came up with ..

# define __ASM_FORM(x)  " " #x " "
# define JUMP_LABEL_INITIAL_NOP ".byte 0xe9 \n\t .long 0\n\t"
# define __ASM_SEL(a,b) __ASM_FORM(b)
#define _ASM_PTR        __ASM_SEL(.long, .quad)

# define JUMP_LABEL(key, label)                                 \
        do {                                                    \
                asm goto("1:"                                   \
                        JUMP_LABEL_INITIAL_NOP                  \
                        ".pushsection __jump_table,  \"a\" \n\t"\
                        _ASM_PTR "1b, %l[" #label "], %c0 \n\t" \
                        ".popsection \n\t"                      \
                        : :  "i" (key) :  : label);             \
        } while (0)

int main(int argc, char *argv[])
{
        JUMP_LABEL("1", do_trace );
        return 1;
do_trace:
        return 0;
}

gcc seems to not choke on it, but sparse still does, so I think I managed
to untangle things correctly..

	Dave

  reply	other threads:[~2010-10-25 22:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-25 21:31 bad asm goto ? Dave Jones
2010-10-25 22:10 ` Christopher Li
2010-10-25 22:39   ` Dave Jones [this message]
2010-10-25 23:44     ` Christopher Li
2010-10-26  3:10       ` Christopher Li
2010-10-28  2:45         ` Harvey Harrison
2010-10-28  6:12           ` Christopher Li
2010-10-28  6:33             ` Harvey Harrison
2010-10-28  7:06               ` Christopher Li
2011-08-22  4:01         ` Harvey Harrison
2011-08-23 21:55           ` Christopher Li

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=20101025223957.GA5561@redhat.com \
    --to=davej@redhat.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=sparse@chrisli.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