Incorrect result with __attribute__((packed))
Submitted by Kai
Assigned to Xiuli Pan
Description
Created attachment 127966 Minimal example to reproduce
Declaring a struct with attribute((packed)) causes writes to sometimes be incorrect. The attached program prints:
Node { right_edge = 0, children = {257, 65536} }
The expected result is:
Node { right_edge = 0, children = {1, 1} }
which is produced on the nVidia OpenCL driver. Removing attribute((packed)) (from the CL src only), or changing the order of writes as described in the comments also works around the issue.
Device information from utests is:
device_name "Intel(R) HD Graphics Haswell Ultrabook GT2 Mobile"
Attachment 127966, "Minimal example to reproduce":
packbug.c