From cc23efac16c0cd248c0a359e48de4103df733004 Mon Sep 17 00:00:00 2001 From: Alexei Lozovsky Date: Sun, 6 Jun 2021 10:48:23 +0900 Subject: [PATCH] Initialize variables in FFI tests These ones are used to compute averages. If they are not initialized to zero, they might contain some garbage. In fact, they almost always do on platforms other that x86_64, failing the FFI tests. If optimizations are enabled, these tests usually fail on x86_64 too. The reason this went unnoticed is contrived set of coincidences. --- tests/ffi/ffi-tests.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/ffi/ffi-tests.scm b/tests/ffi/ffi-tests.scm index acacb963..91c8dd74 100644 --- a/tests/ffi/ffi-tests.scm +++ b/tests/ffi/ffi-tests.scm @@ -303,7 +303,7 @@ double circle_area2(struct Circle circ) { struct Point* centroid(struct Point** points, int num_points) { struct Point* res; - double xsum, ysum; + double xsum=0, ysum=0; int i; for (i=0; ix; @@ -317,7 +317,7 @@ struct Point* centroid(struct Point** points, int num_points) { struct Point* centroid_null(struct Point** points) { struct Point* res; - double xsum, ysum; + double xsum=0, ysum=0; int i; for (i=0; points[i]; ++i) { xsum += points[i]->x;