(via zakharov)
Consider the following program:
$ cat > tmp.c << EOF
> struct S {
> int x;
> int y;
> };
>
> int f(int x) {
> struct S s = {x, 42};
> s.y;
> return x;
> }
> EOF
Notice the s.y;
statement.
Now try to compile the code with GCC warnings enabled:
$ gcc -c -std=c99 -Wall -Wextra -pedantic tmp.c
tmp.c: In function 'f':
tmp.c:8:5: warning: statement with no effect
This example could be run as a Cram test: