Skip to content

Commit 457cdde

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 457cdde

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/goto-programs/builtin_functions.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ 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>
2726

2827
#include <langapi/language_util.h>
2928

@@ -1378,23 +1377,17 @@ void goto_convertt::do_function_call_symbol(
13781377
// append d or f for double/float
13791378
name+=use_double?'d':'f';
13801379

1380+
DATA_INVARIANT(
1381+
ns.lookup(name).type == f_type,
1382+
"builtin declaration should match constructed type");
1383+
13811384
symbol_exprt new_function=function;
13821385
new_function.set_identifier(name);
13831386
new_function.type()=f_type;
13841387

13851388
code_function_callt function_call(lhs, new_function, new_arguments);
13861389
function_call.add_source_location()=function.source_location();
13871390

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-
13981391
copy(function_call, FUNCTION_CALL, dest);
13991392
}
14001393
else if(

0 commit comments

Comments
 (0)