Skip to content

C front-end: floating-point built-ins are in the symbol table #7175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions src/goto-programs/builtin_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Author: Daniel Kroening, [email protected]
#include <util/rational.h>
#include <util/rational_tools.h>
#include <util/simplify_expr.h>
#include <util/symbol_table_base.h>
#include <util/symbol.h>

#include <langapi/language_util.h>

Expand Down Expand Up @@ -1473,21 +1473,17 @@ void goto_convertt::do_function_call_symbol(
// append d or f for double/float
name+=use_double?'d':'f';

DATA_INVARIANT(
ns.lookup(name).type == f_type,
"builtin declaration should match constructed type");

symbol_exprt new_function=function;
new_function.set_identifier(name);
new_function.type()=f_type;

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

if(!symbol_table.has_symbol(name))
{
symbolt new_symbol{name, f_type, mode};
new_symbol.base_name=name;
new_symbol.location=function.source_location();
symbol_table.add(new_symbol);
}

copy(function_call, FUNCTION_CALL, dest);
}
else if(identifier == "alloca" || identifier == "__builtin_alloca")
Expand Down