Skip to content

Exception with function calls wrapped in ConstExpr #12

@mchalupa

Description

@mchalupa

Running angie on this code:

  1 int main(void)
  2 {
  3         int *p = malloc(sizeof *p);
  4         free(p); 
  5         free(p);
  6 
  7         return 0;
  8 }

Results in

terminate called after throwing an instance of 'NotSupportedException'
  what():  attempted to call unknown function -- either an unsupported stdlib function or missing definition

The problem is that #include <stdlib.h> is missing and calls to free are wrapped in ConstExpr due to unknown prototype, e.g.:

call i32 (i32*, ...) bitcast (i32 (...)* @free to i32 (i32*, ...)*)(i32* %7)

Adding #include<stdlib.h> fixes the problem:

$./angie -f db.ll

Error: Program tried to free an already freed memory.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions