Skip to content

Commit 3d9c87b

Browse files
committed
C/C++ front end fixes
1 parent 5c836a4 commit 3d9c87b

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

src/ansi-c/c_typecheck_expr.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,11 @@ void c_typecheck_baset::typecheck_expr_main(exprt &expr)
459459
expr.id()==ID_gcc_asm_clobbered_register)
460460
{
461461
}
462+
else if(expr.id()==ID_lshr || expr.id()==ID_ashr ||
463+
expr.id()==ID_assign_lshr || expr.id()==ID_assign_ashr)
464+
{
465+
// already type checked
466+
}
462467
else
463468
{
464469
err_location(expr);

src/ansi-c/gcc_builtin_headers_generic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void __sync_lock_release();
8686
// other
8787
int __builtin_choose_expr(_Bool, ...);
8888
int __builtin_classify_type();
89-
int __builtin_constant_p();
89+
int __builtin_constant_p(int);
9090
void __builtin_trap(void);
9191
void __builtin_unreachable(void);
9292

src/cpp/cpp_typecheck_code.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ void cpp_typecheckt::typecheck_code(codet &code)
4545
statement==ID_msc_if_not_exists)
4646
{
4747
}
48+
else if(statement==ID_decl_block)
49+
{
50+
// type checked already
51+
}
4852
else
4953
c_typecheck_baset::typecheck_code(code);
5054
}

src/cpp/cpp_typecheck_type.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Author: Daniel Kroening, kroening@cs.cmu.edu
77
\*******************************************************************/
88

99
#include <util/source_location.h>
10+
#include <util/simplify_expr.h>
1011

1112
#include <ansi-c/c_qualifiers.h>
1213

@@ -126,7 +127,10 @@ void cpp_typecheckt::typecheck_type(typet &type)
126127
exprt &size_expr=to_array_type(type).size();
127128

128129
if(size_expr.is_not_nil())
130+
{
129131
typecheck_expr(size_expr);
132+
simplify(size_expr, *this);
133+
}
130134

131135
typecheck_type(type.subtype());
132136

0 commit comments

Comments
 (0)