From 9326aa95724a753f230483d6dd83e75951504bab Mon Sep 17 00:00:00 2001 From: dzaima Date: Fri, 28 May 2021 13:48:59 +0300 Subject: [PATCH] add missing shape equality check to fast dyadic arith --- src/builtins/arithd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/builtins/arithd.c b/src/builtins/arithd.c index 9a5a6b73..6afd3326 100644 --- a/src/builtins/arithd.c +++ b/src/builtins/arithd.c @@ -24,6 +24,7 @@ EXTRA \ if (isArr(w)|isArr(x)) { B ow=w; B ox=x; \ if (isArr(w)&isArr(x) && rnk(w)==rnk(x)) { \ + if (memcmp(a(w)->sh, a(x)->sh, rnk(w)*sizeof(usz))) thrF(#NAME ": Expected equal shape prefix (%H ≡ ≢𝕨, %H ≡ ≢𝕩)", w, x); \ usz ia = a(x)->ia; \ u8 we = TI(w).elType; \ u8 xe = TI(x).elType; \ @@ -94,6 +95,7 @@ EXTRA \ if (isArr(w)|isArr(x)) { \ if (isArr(w)&isArr(x) && rnk(w)==rnk(x)) { \ + if (memcmp(a(w)->sh, a(x)->sh, rnk(w)*sizeof(usz))) thrF(#NAME ": Expected equal shape prefix (%H ≡ ≢𝕨, %H ≡ ≢𝕩)", w, x); \ usz ia = a(x)->ia; \ u8 we = TI(w).elType; \ u8 xe = TI(x).elType; \