Skip to content

Instantly share code, notes, and snippets.

@ewxrjk
Last active August 29, 2015 14:20
Show Gist options
  • Save ewxrjk/c3f80a16d61c35678301 to your computer and use it in GitHub Desktop.
Save ewxrjk/c3f80a16d61c35678301 to your computer and use it in GitHub Desktop.
clang -fsanitize=address breaks initial stream orientation
richard@deodand:~/junk$ cat t.c
#include <stdio.h>
#include <wchar.h>
int main(void) {
FILE *fp = fopen("/dev/null", "r");
return printf("initial orientation: %d\n", fwide(fp, 0));
}
richard@deodand:~/junk$ clang-3.6 -fsanitize=address -o t t.c
richard@deodand:~/junk$ ./t
initial orientation: -1
richard@deodand:~/junk$ clang-3.6 -o t t.c
richard@deodand:~/junk$ ./t
initial orientation: 0
richard@deodand:~/junk$ gcc -o t t.c
richard@deodand:~/junk$ ./t
initial orientation: 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment