Skip to content

assertion failure: inlinable function call in a function with debug info must have a !dbg location #58770

@yuanfang-chen

Description

@yuanfang-chen

This code when compiled with clang -g -O1 -fsanitize=kernel-address -c x.c

void m();
void *memcpy(void *a, void *b, unsigned long c) {return 0;}
typedef struct {
  int a;
  int c;
} d;
typedef struct {
  d f;
  int g;
} h;
typedef struct {
  d f;
  h g;
} i;
void j() { memcpy(0, 0, 0); }
struct i *e;
int k(i l) {
  i b;
  b.g = l.g;
  e = &b;
  m();
  return 0;
}
i o;
int n() {
  k(o);
  return 0;
}

produces

inlinable function call in a function with debug info must have a !dbg location
  %18 = call ptr @memcpy(ptr %4, ptr @o, i64 20)
inlinable function call in a function with debug info must have a !dbg location
  %18 = call ptr @memcpy(ptr %4, ptr @o, i64 20)
fatal error: error in backend: Broken module found, compilation aborted!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.

I traced it down to HandleByValArgumentInit where newly-inserted memcpy has no debug loc. I think we may attribute the memcpy to some debug loc. But the general problem is that the compiler could synthesize intrinsic calls without debug loc. Maybe we should suppress the assertion for intrinsic calls?

@adrian-prantl

Metadata

Metadata

Assignees

No one assigned

    Labels

    llvm:optimizationsquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions