From 09a88a9087ea31a16a8b44694e88b7fa1075d21c Mon Sep 17 00:00:00 2001 From: Baptiste Wicht Date: Sat, 6 Aug 2016 20:31:06 +0200 Subject: [PATCH] New program: divzero Simply here to test behaviour of user mode exception --- programs/divzero/Makefile | 14 ++++++++++++++ programs/divzero/src/main.cpp | 16 ++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 programs/divzero/Makefile create mode 100644 programs/divzero/src/main.cpp diff --git a/programs/divzero/Makefile b/programs/divzero/Makefile new file mode 100644 index 00000000..1d65bd37 --- /dev/null +++ b/programs/divzero/Makefile @@ -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 diff --git a/programs/divzero/src/main.cpp b/programs/divzero/src/main.cpp new file mode 100644 index 00000000..8575f315 --- /dev/null +++ b/programs/divzero/src/main.cpp @@ -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 + +volatile int a = 0; + +int main(int /*argc*/, char* /*argv*/[]){ + a = 42 / a; + + exit(a); +}