about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--031address.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/031address.cc b/031address.cc
index 040037bd..8efd5cd8 100644
--- a/031address.cc
+++ b/031address.cc
@@ -61,6 +61,13 @@ void lookup_memory(reagent& x) {
   drop_one_lookup(x);
 }
 
+:(scenario canonize_non_pointer_fails_without_crashing)
+% Hide_errors = true;
+recipe foo [
+  1:address:number <- get-address *p, x:offset
+]
+# don't crash
+
 :(after "bool types_strictly_match(reagent lhs, reagent rhs)")
   if (!canonize_type(lhs)) return false;
   if (!canonize_type(rhs)) return false;
@@ -88,6 +95,10 @@ bool canonize_type(reagent& r) {
 }
 
 void drop_address_from_type(reagent& r) {
+  if (!r.type) {
+    raise_error << "can't drop address from " << debug_string(r) << '\n' << end();
+    return;
+  }
   type_tree* tmp = r.type;
   r.type = tmp->right;
   tmp->right = NULL;