@@ -2614,8 +2614,15 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
26142614 terminateStateOnExit (state);
26152615 } else {
26162616 if (kmodule->inMainModule (*i)) {
2617+ KFunction *callerFunction = kcaller->parent ->parent ;
2618+
2619+ if (kmodule->WithPOSIXRuntime () &&
2620+ callerFunction->getName () == " __klee_posix_wrapped_main" ) {
2621+ callerFunction = state.stack .callStack ().front ().kf ;
2622+ }
2623+
26172624 state.eventsRecorder .record (
2618- new ReturnEvent (locationOf (state), kcaller-> parent -> parent ));
2625+ new ReturnEvent (locationOf (state), callerFunction ));
26192626 }
26202627
26212628 state.popFrame ();
@@ -6607,14 +6614,17 @@ void Executor::executeMemoryOperation(
66076614 // Obtain memory object
66086615 const ObjectPair baseObjectPair =
66096616 unbound->addressSpace .findObject (baseID);
6610- // Termiante with source event
6611- terminateStateOnProgramError (
6612- *unbound,
6613- new ErrorEvent (new AllocEvent (baseObjectPair.first ->allocSite ),
6614- locationOf (*unbound), StateTerminationType::Ptr,
6615- " memory error: out of bound pointer" ),
6616- getAddressInfo (*unbound, address));
6617- return ;
6617+
6618+ if (!baseObjectPair.first ->isLazyInitialized ) {
6619+ // Termiante with source event
6620+ terminateStateOnProgramError (
6621+ *unbound,
6622+ new ErrorEvent (new AllocEvent (baseObjectPair.first ->allocSite ),
6623+ locationOf (*unbound), StateTerminationType::Ptr,
6624+ " memory error: out of bound pointer" ),
6625+ getAddressInfo (*unbound, address));
6626+ return ;
6627+ }
66186628 }
66196629
66206630 terminateStateOnProgramError (
0 commit comments