expressions: Fix crash on type mismatch corner case.
authorBen Pfaff <blp@cs.stanford.edu>
Thu, 2 May 2024 19:59:12 +0000 (12:59 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Thu, 2 May 2024 19:59:25 +0000 (12:59 -0700)
Thanks to Zhou Geng for reporting this bug as poc37 in the report here:
https://lists.gnu.org/archive/html/bug-gnu-pspp/2024-03/msg00015.html

src/language/expressions/parse.c
tests/language/expressions/parse.at

index 7f618b23f4fce1981ff73ad4fd084b19e6ef05c9..8a5e095c9107a6d1216d8e3eb1f792be03665557 100644 (file)
@@ -549,6 +549,9 @@ type_coercion__ (struct expression *e, struct expr_node *node, size_t arg_idx,
         }
       break;
 
+    case OP_num_vec_elem:
+      break;
+
     default:
       NOT_REACHED ();
     }
index 4f66b8533968553953e2c9bf3b9b05f1481d045a..d151b2484920071fe78221868822319661af2eef 100644 (file)
@@ -479,6 +479,7 @@ DEBUG EVALUATE /foobar(x).
 DEBUG EVALUATE /CONCAT.1('a' b).
 DEBUG EVALUATE /NCDF.CHISQ(1, 2, 3).
 DEBUG EVALUATE (a=1)(b=2) VECTOR/v('abc').
+DEBUG EVALUATE /VALUE(55).
 ])
 
 for opt in OPT NOOPT; do
@@ -537,6 +538,15 @@ evaluate.sps:9.36-9.40: note: DEBUG EVALUATE: This vector index has type
       |                                    ^~~~~
 
 v('abc') => error
+
+evaluate.sps:10.17-10.25: error: DEBUG EVALUATE: Function invocation
+VALUE(number) does not match any known function.  Candidates are:
+VALUE(num_variable)
+VALUE(number).
+   10 | DEBUG EVALUATE /VALUE(55).
+      |                 ^~~~~~~~~
+
+VALUE(55) => error
 ])
 done
 AT_CLEANUP