Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / 2008-07-30-redef-of-bitcasted-decl.c
blob70f3aaf6abfc7237ce447574f703ba20dadce8a0
1 // RUN: %clang_cc1 -std=c89 -emit-llvm -o - %s
3 /* For posterity, the issue here begins initial "char []" decl for
4 * s. This is a tentative definition and so a global was being
5 * emitted, however the mapping in GlobalDeclMap referred to a bitcast
6 * of this global.
8 * The problem was that later when the correct definition for s is
9 * emitted we were doing a RAUW on the old global which was destroying
10 * the bitcast in the GlobalDeclMap (since it cannot be replaced
11 * properly), leaving a dangling pointer.
13 * The purpose of bar is just to trigger a use of the old decl
14 * sometime after the dangling pointer has been introduced.
17 char s[];
19 static void bar(void *db) {
20 eek(s);
23 char s[5] = "hi";
25 int foo(void) {
26 bar(0);