Thanks for the warning. The attached patch will make it fail the tests if
pkg-config fails.
I also extended the inline C program to print the result array vs. the expected
array in case it returns non-zero, as I see it did fail on aarch64. Not that it
helps much but at least it is explicit.
--- highway-1.2.0/debian/tests/compile-and-execute 1970-01-01 01:00:00.000000000 +0100
+++ highway-1.2.0/debian/tests/compile-and-execute 2024-07-16 13:00:51.000000000 +0200
@@ -0,0 +1,39 @@
+#!/bin/sh
+set -ex
+trap 'rm o' 0
+cflags=$(pkg-config --cflags --libs libhwy)
+# Why do we get stack smashing on GCC but not on Clang with the stack protector?
+c++ -Wall -fno-stack-protector $cflags -x c++ - -o o <<EOF
+#include <hwy/highway.h>
+#include <stdio.h>
+namespace hn = hwy::HWY_NAMESPACE;
+using T = int;
+void MulAddLoop(const T* HWY_RESTRICT mul_array,
+ const T* HWY_RESTRICT add_array,
+ const size_t size, T* HWY_RESTRICT x_array) {
+ const hn::ScalableTag<T> d;
+ for (size_t i = 0; i < size; i += hn::Lanes(d)) {
+ const auto mul = hn::Load(d, mul_array + i);
+ const auto add = hn::Load(d, add_array + i);
+ auto x = hn::Load(d, x_array + i);
+ x = hn::MulAdd(mul, x, add);
+ hn::Store(x, d, x_array + i);
+ }
+}
+int main(){
+ const T a[]={1,2,3,4,5},b[]={6,7,9,0,0},expect[]={5,5,6,-4,-5};
+ T c[]={-1,-1,-1,-1,-1};
+ size_t size=sizeof(c)/sizeof(c[0]);
+ MulAddLoop(a,b,size,c);
+ for(size_t i=0;i<size;i++){
+ if (c[i]!=expect[i]){
+ for(size_t j=0;j<size;j++){
+ printf("%zuth element is %d, expected %d.\n",j,c[j],expect[j]);
+ }
+ return 52;
+ }
+ }
+ return 0;
+}
+EOF
+./o
--- highway-1.2.0/debian/tests/control 1970-01-01 01:00:00.000000000 +0100
+++ highway-1.2.0/debian/tests/control 2024-07-16 13:00:51.000000000 +0200
@@ -0,0 +1,3 @@
+Tests: compile-and-execute
+Depends: libhwy-dev, g++, pkgconf
+Restrictions: allow-stderr