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:
parent
a86978840f
commit
61768113d4
|
@ -0,0 +1,6 @@
|
|||
void main()
|
||||
{
|
||||
signed char i, j;
|
||||
i = j;
|
||||
i++;
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
CORE
|
||||
main.c
|
||||
--signed-overflow-check
|
||||
^EXIT=10$
|
||||
^SIGNAL=0$
|
||||
^\[.*\] .* arithmetic overflow on signed \+ in .*: FAILURE$
|
||||
^VERIFICATION FAILED$
|
||||
--
|
||||
^warning: ignoring
|
|
@ -0,0 +1,6 @@
|
|||
void main()
|
||||
{
|
||||
signed char i, j;
|
||||
i = j;
|
||||
i += 1;
|
||||
}
|
|
@ -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.
|
|
@ -0,0 +1,6 @@
|
|||
void main()
|
||||
{
|
||||
signed char i, j;
|
||||
i = j;
|
||||
i = i + 1;
|
||||
}
|
|
@ -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.
|
Loading…
Reference in New Issue