about summary refs log tree commit diff stats
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
parente140ae63821e7d95e150d94d3ab2c24ccaa81722 (diff)
downloadmu-1fbebe73ce457733c8c1352ec807346a038f373d.tar.gz
1902
Now fix the proximal cause of the write to address 0.
-rw-r--r--031address.cc14
-rw-r--r--042name.cc2
-rw-r--r--048typecheck.cc2
3 files changed, 16 insertions, 2 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) {
diff --git a/042name.cc b/042name.cc
index ae27f5bf..7620a7e8 100644
--- a/042name.cc
+++ b/042name.cc
@@ -141,10 +141,12 @@ recipe main [
 
 //: an escape hatch to suppress name conversion that we'll use later
 :(scenario transform_names_passes_raw)
+% Hide_warnings = true;
 recipe main [
   x:number/raw <- copy 0
 ]
 -name: assign x 1
++warn: can't write to location 0
 
 :(scenario transform_names_warns_when_mixing_names_and_numeric_locations)
 % Hide_warnings = true;
diff --git a/048typecheck.cc b/048typecheck.cc
index 090e3033..5c22a436 100644
--- a/048typecheck.cc
+++ b/048typecheck.cc
@@ -80,5 +80,3 @@ recipe main [
   x:number <- copy 2
 ]
 +warn: missing type in 'x <- copy 1'
-+warn: x <- copy 1: reagent not initialized: x
-+warn: main: size mismatch in storing to x at 'x <- copy 1'