clangir icon indicating copy to clipboard operation
clangir copied to clipboard

Module verification error of switch statements

Open wenpen opened this issue 10 months ago • 3 comments

struct St{
  ~St(){}
};

int f(int a) {
  switch(a) {
    case 1:{
      St a;
      return 1;
    }
  }
  return 0;
}
fatal error: error in backend: CIR codegen: module verification error before running CIR passes

wenpen avatar May 06 '24 07:05 wenpen

I know it's a verification error about SwitchOp, do we have some methods to print more information (e.g. the illegal cir body)?

wenpen avatar May 06 '24 07:05 wenpen

do we have some methods to print more information (e.g. the illegal cir body)?

Try -Xclang -clangir-disable-verifier -Xclang -clangir-disable-passes

Lancern avatar May 06 '24 10:05 Lancern

Interesting, it usually says at least something about what failed to verify. Anyways, use the suggestions from Lancern to isolate the CIR output that can help you understand the bad IR

bcardosolopes avatar May 06 '24 17:05 bcardosolopes