Skip to content

Commit 02b9802

Browse files
committed
Avoid signed/unsigned casts and conversion in goto_inline
1 parent 5e5e264 commit 02b9802

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/goto-programs/goto_inline_class.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Author: Daniel Kroening, [email protected]
1616
#endif
1717

1818
#include <cassert>
19+
#include <limits>
1920

2021
#include <util/base_type.h>
2122
#include <util/cprover_prefix.h>
@@ -700,7 +701,7 @@ bool goto_inlinet::check_inline_map(
700701
if(call_list.empty())
701702
return true;
702703

703-
int ln=-1;
704+
unsigned ln = std::numeric_limits<unsigned>::max();
704705

705706
for(const auto &call : call_list)
706707
{
@@ -713,8 +714,12 @@ bool goto_inlinet::check_inline_map(
713714
#endif
714715

715716
// location numbers increasing
716-
if(static_cast<int>(target->location_number)<=ln)
717+
if(
718+
ln < std::numeric_limits<unsigned>::max() &&
719+
target->location_number <= ln)
720+
{
717721
return false;
722+
}
718723

719724
if(!target->is_function_call())
720725
return false;

0 commit comments

Comments
 (0)