[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[task #16114] Print warning where integer overflow happens
From: |
Siyang He |
Subject: |
[task #16114] Print warning where integer overflow happens |
Date: |
Mon, 20 Feb 2023 22:55:34 -0500 (EST) |
Follow-up Comment #5, task #16114 (project gnuastro):
I took a look at this.
Initially I tried to check errno's value against ERANGE, but never found a
match. From googling I get the sense that it's on the C function's part to set
errno (as opposed to having the OS set it automatically).
If this is true then I'd have to write overflow checks for each operator.
...so I wrote an overflow checker for addition. Right now I am calling the
checker from arithmetic_binary() within lib/arithmetic.c. Specifically,
arithmetic_binary() calls the checker before calling arithmetic_plus(). If
this is a good place to call the checker then I can go ahead and write
checkers for other operators.
As an aside, while testing my checker I found the following :
>$ astarithmetic 4 -128 int8 +
-128
I don't think I see this on the task list.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/task/?16114>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [task #16114] Print warning where integer overflow happens,
Siyang He <=