This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[Bug tapsets/13721] New: local variable name collision
- From: "dsmith at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: systemtap at sourceware dot org
- Date: Tue, 21 Feb 2012 21:02:11 +0000
- Subject: [Bug tapsets/13721] New: local variable name collision
- Auto-submitted: auto-generated
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.