28 lines · c
1// RUN: %clang_cc1 -std=c89 -emit-llvm -o - %s2 3/* For posterity, the issue here begins initial "char []" decl for4 * s. This is a tentative definition and so a global was being5 * emitted, however the mapping in GlobalDeclMap referred to a bitcast6 * of this global.7 *8 * The problem was that later when the correct definition for s is9 * emitted we were doing a RAUW on the old global which was destroying10 * the bitcast in the GlobalDeclMap (since it cannot be replaced11 * properly), leaving a dangling pointer.12 *13 * The purpose of bar is just to trigger a use of the old decl14 * sometime after the dangling pointer has been introduced.15 */16 17char s[];18 19static void bar(void *db) {20 eek(s);21}22 23char s[5] = "hi";24 25void foo(void) {26 bar(0);27}28