| Issue |
74001
|
| Summary |
memset doesn't initialize the padding bytes of float3
|
| Labels |
clang:codegen
|
| Assignees |
|
| Reporter |
ahatanak
|
$ cat test.c
```
#include <string.h>
typedef __attribute__((__ext_vector_type__(3))) float float3;
float3 make_float3(float x, float y, float z) {
float3 r;
memset(&r, 0, sizeof(float3));
r.x = x;
r.y = y;
r.z = z;
return r;
}
```
The size of float3 is 16-bytes and the padding bytes should be set to zero, but they aren't.
$ clang -S -o - test.c -Os -emit-llvm
```
define <3 x float> @make_float3(float noundef %0, float noundef %1, float noundef %2) local_unnamed_addr #0 {
%4 = insertelement <3 x float> undef, float %0, i64 0
%5 = insertelement <3 x float> %4, float %1, i64 1
%6 = insertelement <3 x float> %5, float %2, i64 2
ret <3 x float> %6
}
```
This makes it impossible to compare buffers of float3 objects byte-wise.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs