Debug info not generated correctly for function static variables · Issue #19612 · llvm/llvm-project (original) (raw)

Bugzilla Link 19238
Version 3.4
OS Linux
Reporter LLVM Bugzilla Contributor
CC @chbessonova,@dwblaikie,@echristo,@pogo59

Extended Description

#include<stdio.h>
int main() {
static int X = 10;
{
static bool X = false;
printf("...");
}
printf("...");
}

If you compile the code above with clang 3.4 and break at the printf() statements (gdb or lldb) then p X will always show X to be 10. The same code compiled with GCC shows X to be false in the first case and 10 in the second as expected.