CONTRACTS: filter out contract symbols when resolving entry points and interrupt handlers#7063
Conversation
3865091 to
7581c18
Compare
|
Where exactly are we assuming the base name to be unambiguous? I don’t think this should be done anywhere: imagine a local variable named “main”, which is perfectly legitimate. |
Codecov Report
@@ Coverage Diff @@
## develop #7063 +/- ##
=========================================
Coverage 77.86% 77.86%
=========================================
Files 1569 1576 +7
Lines 180995 181808 +813
=========================================
+ Hits 140929 141573 +644
- Misses 40066 40235 +169
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
|
The ambiguity surfaced here where entry points are looked up by base_name : cbmc/src/ansi-c/ansi_c_entry_point.cpp Line 145 in 78efc2c The lookup finds both the function symbol and the contract symbol and bails out. In particular, this means that we cannot use a function that has a contract as an entry point for contract checking like we used to do before. What would be the problem with making it a truly unique symbol (i.e. name, base_name and pretty_name all unique) ? |
martin-cs
left a comment
There was a problem hiding this comment.
Seems legit but note @tautschnig 's concern.
We should fix cbmc/src/ansi-c/ansi_c_entry_point.cpp Line 133 in 78efc2c symbol.is_property set.
Yes, indeed this needs to be fixed, but I think it should be done as suggested above.
I don't think that that would be a problem, I just don't think it's the right fix for what actually is a problem. |
|
Hi again, before implementing your suggestion, please hear me out once again :) I found at least 8 other places where Making the base name unique would make the impact of adding |
|
It would be highly unusual to stick a prefix before a |
7581c18 to
1c79f1f
Compare
contract:: prefix as name, base name and pretty name for contract symbols.Contract symbols (diffblue#6799) have the same base name as the function symbol they are derived from. This causes both the function and its contract to be found when doing a lookup by base name, when resolving entry points for instance. We now filter out symbols that have the `is_property` set when resolving entry points and interrupt handlers in a goto model.
1c79f1f to
50dd44b
Compare
|
@tautschnig @kroening, now filtering out contracts from lookups by base name |
Contract symbols (#6799) have the same base name as the function symbol they are derived from.
This causes both the function and its contract to be found when doing a lookup by base name,
when resolving entry points for instance.
We now filter out symbols that have the
is_propertyset when resolving entry points and interrupt handlers.