trailofbits / vast

VAST is an experimental compiler pipeline designed for program analysis of C and C++. It provides a tower of IRs as MLIR dialects to choose the best fit representations for a program analysis or further program abstraction.
https://trailofbits.github.io/vast/
Apache License 2.0
391 stars 23 forks source link

[Bug]: Symbol table lookup for incomplete RecordDecl might return TypeDef #608

Open Jezurko opened 4 months ago

Jezurko commented 4 months ago

Prerequisites

Description

Looking up symbol using the default_symbol_mangler::symbol() method to find a decl missing a body might return typedef op. This is troublesome, as we expect it to be an incomplete RecordDecl and we try to add the body to the typedef. Example reproducer (based on LLVM SingleSource TS: SingleSource/Regression/C/gcc-c-torture/execute/20040703-1.c)

typedef unsigned int cpp_num_part;
typedef struct cpp_num cpp_num;
struct cpp_num
{
   cpp_num_part high;
   cpp_num_part low;
   int unsignedp;
   int overflow; 
};