Skip to content

Assertion Failure when converting function defined by macros #255

@aaronjeline

Description

@aaronjeline
#include <math_checked.h>

#define ADDX(x)\
  int add##x(int* y) {\
    return *y;\
  }

ADDX(2)



int main(void) {
  int x = 3;
  return add2(&x);
}

Fails with:

cconv-standalone: /home/aeline/checkedc-clang/clang/lib/CConv/ProgramInfo.cpp:671: FVConstraint* ProgramInfo::getFuncFVConstraint(clang::FunctionDecl*, clang::ASTContext*): Assertion `!F->hasBody()' failed.

Weirdly, if the math library is not included, this assertion failure doesn't happen. Instead, no changes are made to the file.
(Both math.h and math_checked.h cause this issue).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions