Created
October 14, 2015 12:29
-
-
Save ElastiLotem/c6b2a622b111828525d7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() { | |
typeof(-1U) x = 1; | |
printf("%lu\n", x << 32); | |
return 0; | |
} | |
/* | |
gcc --version && gcc -std=gnu11 -O0 -o testshift_noopt testshift.c && ./testshift_noopt | |
gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4 | |
Copyright (C) 2013 Free Software Foundation, Inc. | |
This is free software; see the source for copying conditions. There is NO | |
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
testshift.c: In function ‘main’: | |
testshift.c:5:5: warning: left shift count >= width of type [enabled by default] | |
printf("%lu\n", x << 32); | |
^ | |
testshift.c:5:5: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘unsigned int’ [-Wformat=] | |
1 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment