134-decl-define-in-ifdef.c (801B)
1 /* Regression: decl boundary inside an open #ifdef block. 2 * 3 * Two top-level forms inside `#ifdef CCSCM ... #endif` — a decl 4 * followed by a #define — historically exposed compiler heap-lifetime 5 * bugs. The #ifdef pushes onto pps-cond-stack; an old declaration-boundary 6 * lifetime scheme failed to retain that stack, so the next #define's 7 * %pp-active? walk segfaulted. 8 * 9 * The fixture also stands in for the seven `<stdarg.h>`-using 10 * fixtures (015, 067, 076, 079, 097, 116, 131): all of them gate 11 * stdarg.h on `#ifndef CCSCM` and define va_list / va_start in the 12 * else branch — exactly the same dangling-cond-stack shape. 13 * 14 * Result: 0. */ 15 16 #ifdef CCSCM 17 typedef char *T; 18 #define M(x) (x) 19 #else 20 typedef char T; 21 #define M(x) (x) 22 #endif 23 24 int main(void) { T a; a = 0; return M(0); }