Add tests for overflows

There is an interaction between type promotion and
overflow detection. In the case of compound assignments
type promotion is broken.
This commit is contained in:
Peter Schrammel 2019-02-16 16:43:10 +00:00
parent a86978840f
commit 61768113d4
6 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,6 @@
void main()
{
signed char i, j;
i = j;
i++;
}

View File

@ -0,0 +1,9 @@
CORE
main.c
--signed-overflow-check
^EXIT=10$
^SIGNAL=0$
^\[.*\] .* arithmetic overflow on signed \+ in .*: FAILURE$
^VERIFICATION FAILED$
--
^warning: ignoring

View File

@ -0,0 +1,6 @@
void main()
{
signed char i, j;
i = j;
i += 1;
}

View File

@ -0,0 +1,15 @@
KNOWNBUG
main.c
--signed-overflow-check --conversion-check
^EXIT=10$
^SIGNAL=0$
^\[.*\] .* arithmetic overflow on signed \+ in .*: SUCCESS
^\[.*\] .* arithmetic overflow on signed type conversion in .*: FAILURE$
^VERIFICATION FAILED$
--
^warning: ignoring
--
The addition is done in signed int; hence, the overflow is only detected
on conversion.
See #4208.

View File

@ -0,0 +1,6 @@
void main()
{
signed char i, j;
i = j;
i = i + 1;
}

View File

@ -0,0 +1,13 @@
CORE
main.c
--signed-overflow-check --conversion-check
^EXIT=10$
^SIGNAL=0$
^\[.*\] .* arithmetic overflow on signed \+ in .*: SUCCESS
^\[.*\] .* arithmetic overflow on signed type conversion in .*: FAILURE$
^VERIFICATION FAILED$
--
^warning: ignoring
--
The addition is done in signed int; hence, the overflow is only detected
on conversion.