Skip to content

Commit 91ccdfb

Browse files
Merge pull request #4943 from peterschrammel/non-existing-entry-point
Error message when entry function body cannot be produced [TG-8299]
2 parents 58301ff + 18fa5da commit 91ccdfb

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CORE
2+
Main.class
3+
--context-exclude 'org.cprover.MyClass$Inner.' --function 'org.cprover.MyClass$Inner.doIt:(I)I'
4+
^EXIT=1$
5+
^SIGNAL=0$
6+
the program has no entry point
7+
--
8+
_Map_base::at
9+
unordered_map::at: key not found
10+
--
11+
Tests that a proper error message is printed.

jbmc/src/java_bytecode/java_bytecode_language.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,17 @@ bool java_bytecode_languaget::generate_support_functions(
899899
// parameter names
900900
convert_lazy_method(res.main_function.name, symbol_table_builder);
901901

902+
const symbolt &symbol =
903+
symbol_table_builder.lookup_ref(res.main_function.name);
904+
if(symbol.value.is_nil())
905+
{
906+
throw invalid_command_line_argument_exceptiont(
907+
"the program has no entry point",
908+
"function",
909+
"Check that the specified entry point is included by your "
910+
"--context-include or --context-exclude options");
911+
}
912+
902913
// generate the test harness in __CPROVER__start and a call the entry point
903914
return java_entry_point(
904915
symbol_table_builder,

0 commit comments

Comments
 (0)