statycc / pymwp

A static analyzer of variable value growth for C programs.
https://statycc.github.io/pymwp/
GNU General Public License v3.0
4 stars 1 forks source link

true and false and keyword variables #150

Closed nkrusch closed 9 hours ago

nkrusch commented 10 hours ago

Keywords true and false get detected as variables. Their AST nodes are ID(name='true') and ID(name='false'). They appear like variables because they are of type ID[^1].

[^1]: Normally we would see something like ID(name='X1') for occurrence of variable X1.

The fix for this is to (1) make a list of reserved C keywords names and (2) ID nodes that have reserved names should be ignored when identifying variables.

Edit: apparently, they are not keywords but macros 🙄 so, maybe that is why true and false get parsed this way.