File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -706,6 +706,23 @@ void goto_convertt::do_alloca(
706706 const source_locationt &source_location = function.source_location ();
707707 const auto alloca_type = to_code_type (function.type ());
708708
709+ if (alloca_type.return_type () != pointer_type (void_type ()))
710+ {
711+ error ().source_location = source_location;
712+ error () << " 'alloca' function called, but 'alloca' has not been declared "
713+ << " with expected 'void *' return type." << eom;
714+ throw 0 ;
715+ }
716+ if (
717+ alloca_type.parameters ().size () != 1 ||
718+ alloca_type.parameters ()[0 ].type () != size_type ())
719+ {
720+ error ().source_location = source_location;
721+ error () << " 'alloca' function called, but 'alloca' has not been declared "
722+ << " with expected single 'size_t' parameter." << eom;
723+ throw 0 ;
724+ }
725+
709726 exprt new_lhs = lhs;
710727
711728 // make sure we have a left-hand side to track the allocation even when the
You can’t perform that action at this time.
0 commit comments