summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Rustan Leino <unknown>2014-06-19 18:24:00 -0700
committerGravatar Rustan Leino <unknown>2014-06-19 18:24:00 -0700
commit4cf8c3c2a02dd29f98ec0e7a2fb31ed71a1a2939 (patch)
tree03e3a279a3ac66162e3a57b661561ab2a2411137
parent2327d8ff58332c09d82de17b8cdd119d6cef56b4 (diff)
Fixed crash in resolver
-rw-r--r--Source/Core/AbsyCmd.cs2
-rw-r--r--Test/test0/LineResolve.bpl5
-rw-r--r--Test/test0/LineResolve.bpl.expect3
3 files changed, 8 insertions, 2 deletions
diff --git a/Source/Core/AbsyCmd.cs b/Source/Core/AbsyCmd.cs
index 72dc7c86..1922f977 100644
--- a/Source/Core/AbsyCmd.cs
+++ b/Source/Core/AbsyCmd.cs
@@ -1224,7 +1224,7 @@ namespace Microsoft.Boogie {
for (int i = 0; i < Lhss.Count; i++)
{
var lhs = Lhss[i].AsExpr as IdentifierExpr;
- if (lhs != null && QKeyValue.FindBoolAttribute(lhs.Decl.Attributes, "assumption"))
+ if (lhs != null && lhs.Decl != null && QKeyValue.FindBoolAttribute(lhs.Decl.Attributes, "assumption"))
{
var rhs = Rhss[i] as NAryExpr;
if (rhs == null
diff --git a/Test/test0/LineResolve.bpl b/Test/test0/LineResolve.bpl
index da1a5bfa..39bf9983 100644
--- a/Test/test0/LineResolve.bpl
+++ b/Test/test0/LineResolve.bpl
@@ -38,3 +38,8 @@ l+ // error: A B C . txt(12,0)
0;
}
+
+#line 100 LineResolve.bpl
+procedure ResolutionTest() {
+ x := 0; // error: undeclared identifier (once upon a time, this used to crash Boogie)
+}
diff --git a/Test/test0/LineResolve.bpl.expect b/Test/test0/LineResolve.bpl.expect
index 6ca45551..1e5b4eb7 100644
--- a/Test/test0/LineResolve.bpl.expect
+++ b/Test/test0/LineResolve.bpl.expect
@@ -10,4 +10,5 @@ Abc.txt(13,0): Error: undeclared identifier: i
Abc.txt(99,0): Error: undeclared identifier: j
c:\Users\leino\Documents\Programs\MyClass.ssc(104,0): Error: undeclared identifier: k
A B C . txt(12,0): Error: undeclared identifier: l
-12 name resolution errors detected in LineResolve.bpl
+LineResolve.bpl(101,2): Error: undeclared identifier: x
+13 name resolution errors detected in LineResolve.bpl