File tree 3 files changed +35
-1
lines changed
regression/cbmc/Function14
3 files changed +35
-1
lines changed Original file line number Diff line number Diff line change
1
+ int nondet_foo ()
2
+ {
3
+ return 42 ;
4
+ }
5
+
6
+ int main ()
7
+ {
8
+ int x = nondet_foo ();
9
+ __CPROVER_assert (x == 42 , "nondet_foo returns a constant" );
10
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION SUCCESSFUL$
7
+ --
8
+ ^warning: ignoring
Original file line number Diff line number Diff line change @@ -651,6 +651,22 @@ void goto_convertt::do_function_call_symbol(
651
651
throw 0 ;
652
652
}
653
653
654
+ // User-provided function definitions always take precedence over built-ins.
655
+ // Front-ends do not (yet) consistently set ID_C_incomplete, thus also test
656
+ // whether the symbol actually has some non-nil value (which might be
657
+ // "compiled").
658
+ if (!symbol->type .get_bool (ID_C_incomplete) && symbol->value .is_not_nil ())
659
+ {
660
+ do_function_call_symbol (*symbol);
661
+
662
+ code_function_callt function_call (lhs, function, arguments);
663
+ function_call.add_source_location () = function.source_location ();
664
+
665
+ copy (function_call, FUNCTION_CALL, dest);
666
+
667
+ return ;
668
+ }
669
+
654
670
if (identifier==CPROVER_PREFIX " assume" ||
655
671
identifier==" __VERIFIER_assume" )
656
672
{
@@ -706,7 +722,7 @@ void goto_convertt::do_function_call_symbol(
706
722
a->source_location .set (" user-provided" , true );
707
723
}
708
724
else if (
709
- identifier == " assert" && symbol-> type . get_bool (ID_C_incomplete) &&
725
+ identifier == " assert" &&
710
726
to_code_type (symbol->type ).return_type () == signed_int_type ())
711
727
{
712
728
if (arguments.size ()!=1 )
You can’t perform that action at this time.
0 commit comments