dead-stores.c revision 0fdf06e5eef80ce56ce6499ba662453919b95af1
1// RUN: clang -warn-dead-stores -verify %s 2 3void x() { 4 int k, y; 5 int abc=1; 6 long idx=abc+3*5; // expected-warning {{value stored to variable is never used}} 7} 8 9void a(void *b) { 10 char *c = (char*)b; // no-warning 11 char *d = b+1; // expected-warning {{value stored to variable is never used}} 12 printf("%s", c); 13} 14 15void z() { 16 int r; 17 if ((r = f()) != 0) { // no-warning 18 int y = r; // no-warning 19 printf("the error is: %d\n", y); 20 } 21} 22