mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Expr: Warn on count underflow for c -= 1 and c = c - 1
I've skipped treating overflows as warnings, as ++ wrapping around at 0 doesn't currently trigger a runtime error and might be expected to be quiet and silently wrap. Closes #2486
This commit is contained in:
parent
a07b0c333f
commit
e48618e244
7 changed files with 67 additions and 2 deletions
5
testing/btest/Baseline/language.count-underflow/.stderr
Normal file
5
testing/btest/Baseline/language.count-underflow/.stderr
Normal file
|
@ -0,0 +1,5 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
expression warning in <...>/count-underflow.zeek, line 10: count underflow (--c1)
|
||||
expression warning in <...>/count-underflow.zeek, line 14: count underflow (c2 - 1)
|
||||
expression warning in <...>/count-underflow.zeek, line 18: count underflow (c3 - 1)
|
||||
expression warning in <...>/count-underflow.zeek, line 22: count underflow (1 - 2)
|
8
testing/btest/Baseline/language.count-underflow/out
Normal file
8
testing/btest/Baseline/language.count-underflow/out
Normal file
|
@ -0,0 +1,8 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
local c1 = 0; --c1; c1 == 18446744073709551615; T
|
||||
local c2 = 0; c2 -= 1; c2 == 18446744073709551615; T
|
||||
local c3 = 0; c3 = c3 - 1; c3 == 18446744073709551615; T
|
||||
1 - 2, 18446744073709551615
|
||||
local c4 = count_max; ++c4; c4 == 0; T
|
||||
local c5 = count_max; c5 += 1; c5 == 0; T
|
||||
local c6 = count_max; c6 = c6 + 1; c6 == 0; T
|
Loading…
Add table
Add a link
Reference in a new issue