* [Bug translator/23666] New: Aggregate operations specified in foreach loop is not respected by the translator
@ 2018-09-15 22:19 agentzh at gmail dot com
2018-09-16 0:50 ` [Bug translator/23666] " agentzh at gmail dot com
0 siblings, 1 reply; 2+ messages in thread
From: agentzh at gmail dot com @ 2018-09-15 22:19 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=23666
Bug ID: 23666
Summary: Aggregate operations specified in foreach loop is not
respected by the translator
Product: systemtap
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: translator
Assignee: systemtap at sourceware dot org
Reporter: agentzh at gmail dot com
Target Milestone: ---
Consider the following example:
```
global a;
probe oneshot {
a[1] <<< 32;
a[2] <<< 78;
a[2] <<< 0;
a[2] <<< 0;
a[3] <<< 96;
a[3] <<< 0;
foreach ([i] in a @count-) {
printf("%d: %d\n", i, @sum(a[i]));
}
}
```
This example generates random output across different runs:
```
$ stap a.stp
1: 32
3: 96
2: 78
$ stap a.stp
2: 78
3: 96
1: 32
$ stap a.stp
3: 96
1: 32
2: 78
```
The MAP operations generated by the stap translator in the kernel source code
misses the COUNT_OP flag in the `_stp_pmap_add_ix()` runtim C function call:
```
{ int rc = _stp_pmap_add_ix (global(s___global_a), ((int64_t)1LL),
((int64_t)32LL), 0, 1, 0, 0, 0); if (unlikely(rc)) { c->last_error = "Array
overflow, check MAXMAPENTRIES"; goto out; }};
```
Using the implicit `-` sorting direction in the stap script example above
instead of `@count-` has the same problem.
Both the kernel and dyninst runtime modes have this issue.
Use of the `@count()` operator inside the `foreach()` loop *body* does make the
problem disappear.
The issue lies in the translator frontend where the use of aggregate operators
in the foreach sorting specification does not affect the stat_op combinations
of the `stat_op` data structure.
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug translator/23666] Aggregate operations specified in foreach loop is not respected by the translator
2018-09-15 22:19 [Bug translator/23666] New: Aggregate operations specified in foreach loop is not respected by the translator agentzh at gmail dot com
@ 2018-09-16 0:50 ` agentzh at gmail dot com
0 siblings, 0 replies; 2+ messages in thread
From: agentzh at gmail dot com @ 2018-09-16 0:50 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=23666
agentzh <agentzh at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
--- Comment #1 from agentzh <agentzh at gmail dot com> ---
Just committed a fix to master as commit 92ef5f3da.
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-09-16 0:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-15 22:19 [Bug translator/23666] New: Aggregate operations specified in foreach loop is not respected by the translator agentzh at gmail dot com
2018-09-16 0:50 ` [Bug translator/23666] " agentzh at gmail 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).