// input.cpp
extern const int* pA;
extern const int* pB;
const int* pA = (int*)&pB;
const int* pB = (int*)&pA;
$ clang -c input.cpp -emit-llvm -o test.bc
$ llvm-dis test.bc -o=test.ll
$ llvm-cbe test.ll
$ gcc -w -c test.cbe.c
test.cbe.c:168:30: error: ‘pA’ undeclared here (not in a function)
uint32_t* pB = ((uint32_t*)(&pA));
^
Here's the relevant part of the faulty generated code:
/* Global Variable Definitions and Initialization */
uint32_t* pB = ((uint32_t*)(&pA));
uint32_t* pA = ((uint32_t*)(&pB));
Maybe we should forward declare (as extern) all global variables?