Skip to content

Commit 34dad4b

Browse files
committed
C front-end: floating-point built-ins are in the symbol table
It should never be the case that no symbol for `__CPROVER_isgreaterf`, `__CPROVER_isgreaterd` and similar floating-point built-ins is present for these are declared in cprover_builtin_headers.h. This commit removes dead code and adds an additional consistency check.
1 parent d932d6f commit 34dad4b

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/goto-programs/builtin_functions.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Author: Daniel Kroening, [email protected]
2323
#include <util/rational.h>
2424
#include <util/rational_tools.h>
2525
#include <util/simplify_expr.h>
26-
#include <util/symbol_table_base.h>
26+
#include <util/symbol.h>
2727

2828
#include <langapi/language_util.h>
2929

@@ -1378,23 +1378,17 @@ void goto_convertt::do_function_call_symbol(
13781378
// append d or f for double/float
13791379
name+=use_double?'d':'f';
13801380

1381+
DATA_INVARIANT(
1382+
ns.lookup(name).type == f_type,
1383+
"builtin declaration should match constructed type");
1384+
13811385
symbol_exprt new_function=function;
13821386
new_function.set_identifier(name);
13831387
new_function.type()=f_type;
13841388

13851389
code_function_callt function_call(lhs, new_function, new_arguments);
13861390
function_call.add_source_location()=function.source_location();
13871391

1388-
if(!symbol_table.has_symbol(name))
1389-
{
1390-
symbolt new_symbol;
1391-
new_symbol.base_name=name;
1392-
new_symbol.name=name;
1393-
new_symbol.type=f_type;
1394-
new_symbol.location=function.source_location();
1395-
symbol_table.add(new_symbol);
1396-
}
1397-
13981392
copy(function_call, FUNCTION_CALL, dest);
13991393
}
14001394
else if(

0 commit comments

Comments
 (0)