From 04bf5b0a8bd1773c36879f67951fa40ea72b1da4 Mon Sep 17 00:00:00 2001 From: Dianne Skoll Date: Sat, 30 Jan 2021 21:04:44 -0500 Subject: [PATCH] Add explanatory comments about overflow-checking functions --- src/expr.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/expr.h b/src/expr.h index 1c891631..716f50e9 100644 --- a/src/expr.h +++ b/src/expr.h @@ -5,7 +5,7 @@ /* Contains a few definitions used by expression evaluator. */ /* */ /* This file is part of REMIND. */ -/* Copyright (C) 1992-2020 by Dianne Skoll */ +/* Copyright (C) 1992-2021 by Dianne Skoll */ /* */ /***************************************************************/ @@ -54,6 +54,10 @@ return E_VA_STK_UNDER; \ else \ (val) = ValStack[--ValStackPtr] +/* These functions are in utils.c and are used to detect overflow + in various arithmetic operators. They have to be in separate + functions with extern linkage to defeat compiler optimizations + that would otherwise break the overflow checks. */ extern int _private_div(int a, int b); extern int _private_add_overflow(int result, int b, int old); extern int _private_sub_overflow(int result, int b, int old);