New program: divzero

Simply here to test behaviour of user mode exception
This commit is contained in:
Baptiste Wicht 2016-08-06 20:31:06 +02:00
parent ec948d5841
commit 09a88a9087
2 changed files with 30 additions and 0 deletions

14
programs/divzero/Makefile Normal file
View File

@ -0,0 +1,14 @@
.PHONY: default clean
EXEC_NAME=divzero
default: link
include ../../cpp.mk
$(eval $(call program_compile_cpp_folder,src))
$(eval $(call program_link_executable,$(EXEC_NAME)))
clean:
@ echo -e "Remove compiled files"
@ rm -rf debug

View File

@ -0,0 +1,16 @@
//=======================================================================
// Copyright Baptiste Wicht 2013-2016.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//=======================================================================
#include <system.hpp>
volatile int a = 0;
int main(int /*argc*/, char* /*argv*/[]){
a = 42 / a;
exit(a);
}