From b1179c58be0409c3f428d00d598db8c56ce4ad53 Mon Sep 17 00:00:00 2001 From: Andreas Beckmann Date: Wed, 24 Nov 2021 14:14:17 +0100 Subject: [PATCH] [PATCH 3/4] fix test_structs_as_args on i386 141/143 Test #85: regression/struct_kernel_arguments ..................................................***Failed Error regular expression found in output. Regex=[FAIL] 4.58 sec CMake Error at /build/pocl-1.4/cmake/run_test.cmake:34 (message): FAIL: Test exited with nonzero code (1): /build/pocl-1.4/obj-i686-linux-gnu/tests/regression/test_structs_as_args STDOUT: F(4: 0 != 5) F(5: -2147483648 != 6) F(6: 0 != 7) F(7: 0 != 8) STDERR: -- OK on i386, the default alignment is 4 for 64-bit types, too the OpenCL standard is only explicit about alignment requirements for OpenCL types, but not for the corresponding cl_* types in C https://github.com/KhronosGroup/OpenCL-Headers/issues/149 fixes: #801 Gbp-Pq: Name 0003-fix-test_structs_as_args-on-i386.patch --- tests/regression/test_structs_as_args.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/regression/test_structs_as_args.cpp b/tests/regression/test_structs_as_args.cpp index 36985fe..6688052 100644 --- a/tests/regression/test_structs_as_args.cpp +++ b/tests/regression/test_structs_as_args.cpp @@ -54,17 +54,26 @@ struct int_pair { cl_long b; }; +// i386 has a default alignment of 4 even for 64-bit types +#ifdef __i386__ +#define CL_LONG_ALIGNMENT __attribute__((aligned(8))) +#else +#define CL_LONG_ALIGNMENT +#endif + struct test_struct { cl_int elementA; cl_int elementB; - cl_long elementC; + cl_long elementC CL_LONG_ALIGNMENT; cl_char elementD; - cl_long elementE; + cl_long elementE CL_LONG_ALIGNMENT; cl_float elementF; cl_short elementG; - cl_long elementH; + cl_long elementH CL_LONG_ALIGNMENT; }; +#undef CL_LONG_ALIGNMENT + static char kernelSourceCode[] = "typedef struct int_single {\n" -- 2.30.2