summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--elaborate.cxx3
-rw-r--r--staptree.cxx7
3 files changed, 8 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index e3e67b33..d6fd5c80 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,8 +3,6 @@
PR 6538
* elaborate.cxx (semantic_pass_opt2): Warn about read-only locals and
globals.
- * staptree.cxx (varuse_collecting_visitor::visit_symbol): Recognize
- initialized global as written-to.
(visit_foreach_loop): Belatedly recognize index symbols as lvalues.
2008-05-20 Tim Moore <timoore@redhat.com>
diff --git a/elaborate.cxx b/elaborate.cxx
index f8bfabdb..26786c00 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -1683,7 +1683,8 @@ void semantic_pass_opt2 (systemtap_session& s, bool& relaxed_p)
}
else
{
- if (vut.written.find (l) == vut.written.end())
+ if (vut.written.find (l) == vut.written.end() &&
+ ! l->init) // no initializer
if (! s.suppress_warnings)
clog << "WARNING: read-only global variable " << *l->tok << endl;
i++;
diff --git a/staptree.cxx b/staptree.cxx
index b5cbd5c9..347d799f 100644
--- a/staptree.cxx
+++ b/staptree.cxx
@@ -1713,9 +1713,14 @@ varuse_collecting_visitor::visit_symbol (symbol *e)
if (e->referent == 0)
throw semantic_error ("symbol without referent", e->tok);
- // handle initialized globals
+ // We could handle initialized globals by marking them as "written".
+ // However, this current visitor may be called for a function or
+ // probe body, from the point of view of which this global is
+ // already initialized, so not written.
+ /*
if (e->referent->init)
written.insert (e->referent);
+ */
if (current_lvalue == e || current_lrvalue == e)
{