345-pointer-ternary.c (549B)
1 /* A null-pointer conditional must retain the pointer arm's full native 2 * width even when the integer arm appears first. On LP64, truncating the 3 * merge to the integer arm's 32-bit type corrupts ordinary stack pointers. 4 */ 5 6 static char *pick(int use_null, char *p) 7 { 8 return use_null ? 0 : p; 9 } 10 11 int main(int argc, char **argv) 12 { 13 char *p = argv[0]; 14 char *q = pick(0, p); 15 16 if (q != p) return 1; 17 if (*q != *p) return 2; 18 if (pick(1, p) != 0) return 3; 19 if (sizeof(1 ? 0 : p) != sizeof(p)) return 4; 20 return argc < 1; 21 }