CTSRD-CHERI / clang

DO NOT USE. Use llvm-project instead
Other
9 stars 8 forks source link

Assertion in bool llvm::GEPOperator::accumulateConstantOffset(const llvm::DataLayout &, llvm::APInt &) #175

Closed arichardson closed 6 years ago

arichardson commented 6 years ago

Assertion `Offset.getBitWidth() == DL.getPointerBaseSizeInBits(getPointerAddressSpace()) && "The offset must have exactly as many bits as our pointer."' failed.

Happens when compiling qquaternion.cpp and qvector4d.cpp in QtBase Reducing those gives the following two test cases:

qquaternion.cpp:

// RUN: %cheri_purecap_cc1 -emit-obj -target-cpu mips4 -Os -std=c++1z -fdeprecated-macro -fvisibility hidden -fvisibility-inlines-hidden -pthread -fcolor-diagnostics -vectorize-loops -vectorize-slp -o -  %s
class a {
public:
  a(float);
  float b, c, e, d;
};
a operator*(a &h, float) { return h.d; }
inline a operator-(a) {}
float f;
void g(a h) {
  a i(h);
  -i = i * f;
}

qvector4d.cpp

// RUN: %cheri_purecap_cc1 -emit-obj -target-cpu mips4 -Os -std=c++1z -fdeprecated-macro -fvisibility hidden -fvisibility-inlines-hidden -pthread -fcolor-diagnostics -vectorize-loops -vectorize-slp -o -  %s
bool a(double);
class b {
  constexpr b(float, float, float, float);
  b c() const;
  float f, g, d, e;
};
constexpr b::b(float, float, float, float) : f(), g(), d(), e() {}
b b::c() const {
  if (a(1.0f))
    return *this;
  return b(float(), float(), float(), float());
}
arichardson commented 6 years ago

@kgudka This has been fixed hasn't it?

khilangudka commented 6 years ago

Yes, this was fixed in CTSRD-CHERI/llvm@5210c527c2ebd3406995237fea1c14a94495d920.