This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[Bug translator/9919] New: array overflow error points to wrong statement
- From: "mjw at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: systemtap at sources dot redhat dot com
- Date: 3 Mar 2009 21:44:01 -0000
- Subject: [Bug translator/9919] New: array overflow error points to wrong statement
- Reply-to: sourceware-bugzilla at sourceware dot org
An associative array that overflows gives an error which points to the wrong
last statement. Example script:
global count;
global overflow[3];
probe timer.ms(10)
{
overflow[count++] = gettimeofday_ns();
}
probe timer.s(3)
{
exit();
}
probe end
{
foreach (o in overflow)
printf("%d: %d\n", o, overflow[o]);
}
$ stap overflow.stp
ERROR: Array overflow, check size limit (3) near identifier 'gettimeofday_ns' at
/usr/share/systemtap/tapset/timestamp.stp:30:10
WARNING: Number of errors: 1, skipped probes: 0
This comes from not updating last_stmt in translate.cxx (visit_arrayindex).
There is an uncommented update already there. Enabling it like so:
diff --git a/translate.cxx b/translate.cxx
index 655937d..ed7556d 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -3892,7 +3892,7 @@ c_unparser_assignment::visit_arrayindex (arrayindex *e)
else
{
mapvar mvar = parent->getmap (array->referent, e->tok);
- // o->newline() << "c->last_stmt = " << lex_cast_qstring(*e->tok) << "
+ o->newline() << "c->last_stmt = " << lex_cast_qstring(*e->tok) << ";";
if (op != "=") // don't bother fetch slot if we will just overwrite it
parent->c_assign (lvar, mvar.get(idx), e->tok);
c_assignop (res, lvar, rvar, e->tok);
Produces the expected output:
$ /usr/local/systemtap/bin/stap overflow.stp
ERROR: Array overflow, check size limit (3) near identifier 'overflow' at
overflow.stp:6:3
WARNING: Number of errors: 1, skipped probes: 0
But apparently it was commented out on purpose:
commit 99613db760e3eec1465d85728b35380f8367f9bc
Author: fche <fche>
Date: Thu Oct 4 03:21:00 2007 +0000
2007-10-03 Frank Ch. Eigler <fche@elastic.org>
PR 5102
* translate.cxx (visit_statement): Add new parameter regarding whether
c->last_stmt needs to be updated. Update callers, mostly passing
"false".
(visit_EXPRESSIONTYPE): Generally omit setting c->last_stmt, unless
the construct can set c->last_error.
Needs investigation.
--
Summary: array overflow error points to wrong statement
Product: systemtap
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: translator
AssignedTo: systemtap at sources dot redhat dot com
ReportedBy: mjw at redhat dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=9919
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.