Open Quuxplusone opened 5 years ago
Attached r.c
(753 bytes, text/x-csrc): test with unreachable code
> 1) argument "ptr" has type "char *"
But you're not accessing the variable via a char *, but instead, you're casting
to a long long *.
> 2) condition "cond" is always zero
This seems more concerning.
Here is a reduced example: https://wandbox.org/permlink/etMQoctaLhXPIoFl
It prints "this should be zero: -1" with Clang 8.0.0.
#include <stdio.h>
void funcA(int g)
{
int grp[3] = {-1};
int i, k = 0;
for (i = 0; i < 1; ++i) {
if (grp[g] > 0) {
*((long long*)&grp[0]) = 0;
}
grp[k++] = 0;
}
printf("this should be zero: %d\n", grp[0]);
}
int main(void) {
funcA(1);
}
r.c
(753 bytes, text/x-csrc)