Clang error related to debug information after upgrading to LLVM 19.1.1 (original) (raw)

October 14, 2024, 4:27pm 1

Hi,

I’ve been developing a backend for some time now using LLVM17.0.6. I just upgraded to LLVM 19.1.1 and started getting an error in Clang. The following assertion is being hit in llvm/lib/IR/DIBuilder.cpp file:

assert(CT->getIdentifier().empty() &&
“Context of a global variable should not be a type with identifier”);

I am compiling with debug information enabled “-g” and my backend has the following override implemented:

bool allowDebugInfoForExternalRef() const override { return true; }

Here is a C++ code snippet that I got from libc that replicates the issue. I was able to replicate it for x86 by adding the “allowDebugInfoForExternalRef” override to the x86 backend

struct Sign {
static const Sign POS;

private:
constexpr explicit Sign(bool is_negative)
: is_negative(is_negative) {}

bool is_negative;
};

constexpr Sign Sign::POS = Sign(false);

constexpr Sign sign() const {
return Sign::POS;
}

This is my first time using the forum so I will appreciate some help.

StevenRR October 14, 2024, 5:22pm 2

Update: I just tested the C++ code and I’m also getting the assertion in LLVM 17.0.6. Disregard the post.