about summary refs log tree commit diff stats
path: root/031address.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-07-30 19:28:29 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-07-30 19:28:57 -0700
commit1fbebe73ce457733c8c1352ec807346a038f373d (patch)
tree07286ab283eaa6bbacbc65cb7e46e47f81da4334 /031address.cc
parente140ae63821e7d95e150d94d3ab2c24ccaa81722 (diff)
downloadmu-1fbebe73ce457733c8c1352ec807346a038f373d.tar.gz
1902
Now fix the proximal cause of the write to address 0.
Diffstat (limited to '031address.cc')
-rw-r--r--031address.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/031address.cc b/031address.cc
index d139c4cf..e79ff314 100644
--- a/031address.cc
+++ b/031address.cc
@@ -24,6 +24,20 @@ recipe main [
 
 :(before "long long int base = x.value" following "void write_memory(reagent x, vector<double> data)")
 x = canonize(x);
+if (x.value == 0) {
+  raise << "can't write to location 0\n" << end();
+  return;
+}
+
+//: writes to address 0 always loudly fail
+:(scenario store_to_0_warns)
+% Hide_warnings = true;
+recipe main [
+  1:address:number <- copy 0
+  1:address:number/lookup <- copy 34
+]
+-mem: storing 34 in location 0
++warn: can't write to location 0
 
 :(code)
 reagent canonize(reagent x) {