File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
unit/solvers/smt2_incremental Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -587,6 +587,21 @@ TEST_CASE(
587587 REQUIRE (constructed_term == expected_term);
588588 }
589589
590+ SECTION (" Subtraction of pointer from integer" )
591+ {
592+ // 2 - (*int32_t)a -- Semantically void expression, need to make sure
593+ // we throw in this case.
594+ const cbmc_invariants_should_throwt invariants_throw;
595+
596+ const auto pointer_arith_expr = minus_exprt{two_bvint, pointer_a};
597+
598+ REQUIRE_THROWS_MATCHES (
599+ test.convert (pointer_arith_expr),
600+ invariant_failedt,
601+ invariant_failure_containing (" minus expressions of pointer and integer "
602+ " expect lhs to be the pointer" ));
603+ }
604+
590605 SECTION (" Subtraction of two pointer arguments" )
591606 {
592607 // (int32_t *)a - (int32_t *)b
You can’t perform that action at this time.
0 commit comments