* [Bug translator/17860] New: foreach loop fails -p4 if array slice is an expression
@ 2015-01-19 16:18 jlebon at redhat dot com
2015-01-19 16:21 ` [Bug translator/17860] " jlebon at redhat dot com
2015-01-23 14:26 ` jlebon at redhat dot com
0 siblings, 2 replies; 3+ messages in thread
From: jlebon at redhat dot com @ 2015-01-19 16:18 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=17860
Bug ID: 17860
Summary: foreach loop fails -p4 if array slice is an expression
Product: systemtap
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: translator
Assignee: systemtap at sourceware dot org
Reporter: jlebon at redhat dot com
The following script runs successfully:
global arr
probe oneshot {
i = 1
arr[1] = 2
foreach (var in arr[i] limit 1) {
println("iterating")
}
}
But if we change the subscript of arr to arr[i++] in the foreach statement, we
get the following p4 failures:
/tmp/stappEHxIa/stap_b1cc5d80db2fc511db3feaaaf7d971a3_1314_src.c: In function
‘probe_2463’:
/tmp/stappEHxIa/stap_b1cc5d80db2fc511db3feaaaf7d971a3_1314_src.c:205:6: error:
‘struct probe_2463_locals’ has no member named ‘__tmp8’
l->__tmp8 = 0LL;
^
/tmp/stappEHxIa/stap_b1cc5d80db2fc511db3feaaaf7d971a3_1314_src.c:221:12: error:
‘struct probe_2463_locals’ has no member named ‘__tmp8’
if (l->__tmp8++ >= l->__tmp7) goto break_0;
^
make[1]: *** [/tmp/stappEHxIa/stap_b1cc5d80db2fc511db3feaaaf7d971a3_1314_src.o]
Error 1
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug translator/17860] foreach loop fails -p4 if array slice is an expression
2015-01-19 16:18 [Bug translator/17860] New: foreach loop fails -p4 if array slice is an expression jlebon at redhat dot com
@ 2015-01-19 16:21 ` jlebon at redhat dot com
2015-01-23 14:26 ` jlebon at redhat dot com
1 sibling, 0 replies; 3+ messages in thread
From: jlebon at redhat dot com @ 2015-01-19 16:21 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=17860
--- Comment #1 from Jonathan Lebon <jlebon at redhat dot com> ---
The reason this fails is that the logic in c_tmpcounter::visit_foreach_loop()
is not exactly matched with c_unparser::visit_foreach_loop(). The order in
which tmpvars are declared is not the same as the order in which they are used
up during unparsing.
This doesn't cause an issue in the working case above since tmpcounter declares
and unparser uses 4 tmpvars in consecutive order. However, when i++ is used,
tmpcounter introduces two new vars for the post_crement, one of which it ends
up not declaring. When c_unparser then tries to use this same numbered tmpvar
we get the failures above.
Currently testing a patch for this.
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug translator/17860] foreach loop fails -p4 if array slice is an expression
2015-01-19 16:18 [Bug translator/17860] New: foreach loop fails -p4 if array slice is an expression jlebon at redhat dot com
2015-01-19 16:21 ` [Bug translator/17860] " jlebon at redhat dot com
@ 2015-01-23 14:26 ` jlebon at redhat dot com
1 sibling, 0 replies; 3+ messages in thread
From: jlebon at redhat dot com @ 2015-01-23 14:26 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=17860
Jonathan Lebon <jlebon at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #2 from Jonathan Lebon <jlebon at redhat dot com> ---
Fixed in commit 39495c1.
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-23 14:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-19 16:18 [Bug translator/17860] New: foreach loop fails -p4 if array slice is an expression jlebon at redhat dot com
2015-01-19 16:21 ` [Bug translator/17860] " jlebon at redhat dot com
2015-01-23 14:26 ` jlebon 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).