clang produces invalid debug info? (warning: invalid debug metadata version)

I run this simple command:
(echo "void f() {}" > m.c) && clang -g -c -emit-llvm m.c -o m.bc && llvm-dis m.bc
and it produces a warning:
warning: invalid debug metadata version (0) in m.bc
and resulting m.ll has no debug info.

From the source code I can see that clang might have not placed the proper version constant DEBUG_METADATA_VERSION into one of the debug record objects.

Do you care to fix this warning? Or maybe there is a bug in my testcase?



Most probably your clang version does not correspond to your llvm-dis.