Skip to content

Instantly share code, notes, and snippets.

@adamf
Created February 23, 2014 17:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamf/9174495 to your computer and use it in GitHub Desktop.
Save adamf/9174495 to your computer and use it in GitHub Desktop.
awf-macbookair1:t awf$ cat foo.c
#include <stdio.h>
int main() {
if(1)
goto foo;
goto foo;
printf("here\n");
foo:
return 1;
}
awf-macbookair1:t awf$ clang -Wall -Werror foo.c
awf-macbookair1:t awf$ ls a.out
a.out
awf-macbookair1:t awf$ rm a.out
awf-macbookair1:t awf$ clang -Weverything -Werror foo.c
foo.c:9:4: error: will never be executed [-Werror,-Wunreachable-code]
printf("here\n");
^~~~~~
foo.c:7:6: error: will never be executed [-Werror,-Wunreachable-code]
goto foo;
^~~~~~~~
2 errors generated.
awf-macbookair1:t awf$ ls a.out
ls: a.out: No such file or directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment