public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: "dsmith at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: systemtap@sourceware.org
Subject: [Bug tapsets/13721] New: local variable name collision
Date: Tue, 21 Feb 2012 21:03:00 -0000	[thread overview]
Message-ID: <bug-13721-6586@http.sourceware.org/bugzilla/> (raw)

http://sourceware.org/bugzilla/show_bug.cgi?id=13721

             Bug #: 13721
           Summary: local variable name collision
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: tapsets
        AssignedTo: systemtap@sourceware.org
        ReportedBy: dsmith@redhat.com
    Classification: Unclassified


Defining a global array with the name of 'addr' fails:

=======
# stap -vp4 -e 'global addr; probe begin { addr[AF_INET()] = "addr" }'
Pass 1: parsed user script and 81 library script(s) using
200892virt/22856res/2812shr kb, in 140usr/40sys/170real ms.
semantic error: inconsistent arity (1 vs 0): identifier 'addr' at
/usr/local/share/systemtap/tapset/nfs_proc.stp:72:2
        source:     addr = &@cast(cl_xprt, "rpc_xprt", "kernel:sunrpc")->addr
                    ^
semantic error: arity 1 first inferred here: identifier 'addr' at <input>:1:28
        source: global addr; probe begin { addr[AF_INET()] = "addr" }
                                           ^
semantic error: inconsistent arity (1 vs 0): identifier 'addr' at
/usr/local/share/systemtap/tapset/nfs_proc.stp:77:12
        source:     if (@cast(addr, "sockaddr_in")->sin_family != %{ /* pure */
AF_INET %}) {
                              ^
semantic error: inconsistent arity (1 vs 0): identifier 'addr' at
/usr/local/share/systemtap/tapset/nfs_proc.stp:81:15
        source:     return @cast(addr, "sockaddr_in")->sin_addr->s_addr
                                 ^
Pass 2: analyzed script: 1 probe(s), 42 function(s), 1 embed(s), 1 global(s)
using 437688virt/122488res/8384shr kb, in 1560usr/340sys/1927real ms.
Pass 2: analysis failed.  Try again with another '--vp 01' option.
=======

This is happening because the port_from_xprt() function has a local variable
named 'addr' that is somehow clashing with the global 'addr' variable which has
a different type.  Evidently this happens before the port_from_xprt() function
gets optimized away.

This can be worked around by prepending '__' to the name of the
port_from_xprt() local variable.

There are probably other local function variables in the tapset that could
clash with user variables.

(The error message could perhaps use an improvement.  The word 'arity' isn't a
common one and probably doesn't translate well.)

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

             reply	other threads:[~2012-02-21 21:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-21 21:03 dsmith at redhat dot com [this message]
2012-02-21 22:31 ` [Bug tapsets/13721] " jistone at redhat dot com
2012-02-21 22:37 ` jistone at redhat dot com
2012-02-23 15:46 ` dsmith at redhat dot com
2012-02-23 17:18 ` jistone at redhat dot com
2012-02-23 18:29 ` dsmith at redhat dot com
2012-02-29  3:02 ` jistone at redhat dot com
2015-11-11  9:44 ` mcermak at redhat dot com
2015-11-11 12:16 ` mcermak at redhat dot com

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=bug-13721-6586@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=systemtap@sourceware.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).