From 5a5d802324e5ccc00176bbc926c4b93fde2fd60f Mon Sep 17 00:00:00 2001 From: bdemsky Date: Wed, 15 Apr 2009 21:27:10 +0000 Subject: [PATCH] clearer error message --- Robust/src/Analysis/Locality/LocalityAnalysis.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Robust/src/Analysis/Locality/LocalityAnalysis.java b/Robust/src/Analysis/Locality/LocalityAnalysis.java index 7c9d5fd1..8aff332c 100644 --- a/Robust/src/Analysis/Locality/LocalityAnalysis.java +++ b/Robust/src/Analysis/Locality/LocalityAnalysis.java @@ -402,6 +402,8 @@ public class LocalityAnalysis { default: throw new Error("In finding fn.kind()= " + fn.kind()); } + + Hashtable oldtable=temptable.get(fn); if (oldtable==null||!oldtable.equals(currtable)) { @@ -576,7 +578,7 @@ public class LocalityAnalysis { void processSetElementNodeSTM(LocalityBinding lb, FlatSetElementNode fsen, Hashtable currtable) { Integer srctype=currtable.get(fsen.getSrc()); Integer dsttype=currtable.get(fsen.getDst()); - + if (dsttype.equals(SCRATCH)) { if (!(srctype.equals(SCRATCH)||srctype.equals(STMEITHER))) throw new Error("Writing possible normal reference to scratch object in context:\n"+lb.getExplanation()+fsen); @@ -630,7 +632,11 @@ public class LocalityAnalysis { void processElementNodeSTM(LocalityBinding lb, FlatElementNode fen, Hashtable currtable) { Integer type=currtable.get(fen.getSrc()); TempDescriptor dst=fen.getDst(); - if (type.equals(SCRATCH)) { + + if (type==null) { + System.out.println(fen +" in "+lb+" may access undefined variable"); + System.exit(-1); + } else if (type.equals(SCRATCH)) { currtable.put(dst,SCRATCH); } else if (type.equals(NORMAL)) { if(fen.getSrc().getType().dereference().isPrimitive()&& -- 2.34.1