public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug tapsets/13721] New: local variable name collision
@ 2012-02-21 21:03 dsmith at redhat dot com
  2012-02-21 22:31 ` [Bug tapsets/13721] " jistone at redhat dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: dsmith at redhat dot com @ 2012-02-21 21:03 UTC (permalink / raw)
  To: systemtap

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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-11-11 12:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-21 21:03 [Bug tapsets/13721] New: local variable name collision dsmith at redhat dot com
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

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).