Skip to content

Commit c9ca904

Browse files
segfault workaround
1 parent 61fbc2d commit c9ca904

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tests/Examples/plaintext/dot_product_f_debug/dot_product_8f_debug_test.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ float dot_product__decrypt__result0(float *allocated, float *aligned,
4343
int64_t offset, int64_t size,
4444
int64_t stride);
4545

46+
// Needs to be allocated in .bss
47+
// Maybe for alignment?
48+
// Otherwise segfault inside memrefCopy
49+
_Alignas(uint64_t) float arg0[8];
50+
_Alignas(uint64_t) float arg1[8];
51+
4652
// debug handler
4753
void __heir_debug_tensor_8xf32_(
4854
/* arg 0*/
@@ -72,8 +78,11 @@ int main(int argc, char **argv) {
7278
output = stderr;
7379
}
7480

75-
float arg0[8] = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8};
76-
float arg1[8] = {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9};
81+
// Initialize the arrays
82+
for (int i = 0; i < 8; i++) {
83+
arg0[i] = 0.1 * (i + 1); // 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8
84+
arg1[i] = 0.1 * (i + 2); // 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9
85+
}
7786
float expected = 2.5;
7887

7988
// "encrypt" each arg, which in plaintext means apply client-side encoding

0 commit comments

Comments
 (0)