diff --git a/cpp/ql/test/experimental/library-tests/rangeanalysis/bitshift/BitShiftRange.expected b/cpp/ql/test/experimental/library-tests/rangeanalysis/bitshift/BitShiftRange.expected index 0a5c85dab00d..816cc25407bd 100644 --- a/cpp/ql/test/experimental/library-tests/rangeanalysis/bitshift/BitShiftRange.expected +++ b/cpp/ql/test/experimental/library-tests/rangeanalysis/bitshift/BitShiftRange.expected @@ -1,44 +1,44 @@ -| bitshift.cpp:23:3:23:9 | ... <<= ... | 0.0 | 255.0 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | -| bitshift.cpp:25:5:25:11 | ... <<= ... | 0.0 | 240.0 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | -| bitshift.cpp:29:3:29:8 | ... << ... | 0.0 | 1020.0 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:32:3:32:9 | ... << ... | -2.147483648E9 | 2.147483647E9 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:35:3:35:9 | ... << ... | -2.147483648E9 | 2.147483647E9 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:38:3:38:22 | ... << ... | 0.0 | 32640.0 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:39:3:39:22 | ... << ... | 0.0 | 32640.0 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:40:3:40:22 | ... << ... | 0.0 | 32640.0 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:43:3:43:19 | ... << ... | -2.147483648E9 | 2.147483647E9 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:46:3:46:22 | ... << ... | 128.0 | 128.0 | file://:0:0:0:0 | int | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:49:3:49:8 | ... << ... | -2.147483648E9 | 2.147483647E9 | file://:0:0:0:0 | int | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:52:5:52:10 | ... << ... | 1.0 | 128.0 | file://:0:0:0:0 | int | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:57:3:57:8 | ... << ... | -2.147483648E9 | 2.147483647E9 | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:58:3:58:9 | ... << ... | -2.147483648E9 | 2.147483647E9 | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:59:3:59:9 | ... << ... | -2.147483648E9 | 2.147483647E9 | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:60:3:60:22 | ... << ... | -2.147483648E9 | 2.147483647E9 | file://:0:0:0:0 | signed char | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:61:3:61:19 | ... << ... | -2.147483648E9 | 2.147483647E9 | file://:0:0:0:0 | signed char | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:64:3:64:19 | ... << ... | -2.147483648E9 | 2.147483647E9 | file://:0:0:0:0 | int | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:67:3:67:8 | ... << ... | -2.147483648E9 | 2.147483647E9 | file://:0:0:0:0 | int | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:70:5:70:10 | ... << ... | 1.0 | 128.0 | file://:0:0:0:0 | int | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:75:5:75:10 | ... << ... | -2.147483648E9 | 2.147483647E9 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:76:5:76:10 | ... << ... | -2.147483648E9 | 2.147483647E9 | file://:0:0:0:0 | signed char | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:90:3:90:9 | ... >>= ... | 0.0 | 63.0 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | -| bitshift.cpp:92:5:92:11 | ... >>= ... | 0.0 | 15.0 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | -| bitshift.cpp:96:3:96:8 | ... >> ... | 0.0 | 63.0 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:99:3:99:9 | ... >> ... | 0.0 | 0.0 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:103:3:103:9 | ... >> ... | 0.0 | 0.0 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:106:3:106:22 | ... >> ... | 0.0 | 63.0 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:107:3:107:22 | ... >> ... | 0.0 | 63.0 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:108:3:108:22 | ... >> ... | 0.0 | 63.0 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:111:3:111:19 | ... >> ... | -2.147483648E9 | 2.147483647E9 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:114:3:114:24 | ... >> ... | 32.0 | 32.0 | file://:0:0:0:0 | int | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:117:3:117:10 | ... >> ... | -2.147483648E9 | 2.147483647E9 | file://:0:0:0:0 | int | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:120:5:120:12 | ... >> ... | 32.0 | 128.0 | file://:0:0:0:0 | int | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:126:3:126:8 | ... >> ... | -2.147483648E9 | 2.147483647E9 | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:127:3:127:9 | ... >> ... | -2.147483648E9 | 2.147483647E9 | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:128:3:128:9 | ... >> ... | -1.0 | 0.0 | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:129:3:129:22 | ... >> ... | -2.147483648E9 | 2.147483647E9 | file://:0:0:0:0 | signed char | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:130:3:130:19 | ... >> ... | -2.147483648E9 | 2.147483647E9 | file://:0:0:0:0 | signed char | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:133:3:133:21 | ... >> ... | -2.147483648E9 | 2.147483647E9 | file://:0:0:0:0 | int | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:136:3:136:10 | ... >> ... | -2.147483648E9 | 2.147483647E9 | file://:0:0:0:0 | int | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:139:5:139:12 | ... >> ... | 32.0 | 128.0 | file://:0:0:0:0 | int | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:144:5:144:10 | ... >> ... | -2.147483648E9 | 2.147483647E9 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | -| bitshift.cpp:145:5:145:10 | ... >> ... | -2.147483648E9 | 2.147483647E9 | file://:0:0:0:0 | signed char | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:23:3:23:9 | ... <<= ... | 0 | 255 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | +| bitshift.cpp:25:5:25:11 | ... <<= ... | 0 | 240 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | +| bitshift.cpp:29:3:29:8 | ... << ... | 0 | 1020 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:32:3:32:9 | ... << ... | -2147483648 | 2147483647 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:35:3:35:9 | ... << ... | -2147483648 | 2147483647 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:38:3:38:22 | ... << ... | 0 | 32640 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:39:3:39:22 | ... << ... | 0 | 32640 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:40:3:40:22 | ... << ... | 0 | 32640 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:43:3:43:19 | ... << ... | -2147483648 | 2147483647 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:46:3:46:22 | ... << ... | 128 | 128 | file://:0:0:0:0 | int | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:49:3:49:8 | ... << ... | -2147483648 | 2147483647 | file://:0:0:0:0 | int | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:52:5:52:10 | ... << ... | 1 | 128 | file://:0:0:0:0 | int | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:57:3:57:8 | ... << ... | -2147483648 | 2147483647 | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:58:3:58:9 | ... << ... | -2147483648 | 2147483647 | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:59:3:59:9 | ... << ... | -2147483648 | 2147483647 | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:60:3:60:22 | ... << ... | -2147483648 | 2147483647 | file://:0:0:0:0 | signed char | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:61:3:61:19 | ... << ... | -2147483648 | 2147483647 | file://:0:0:0:0 | signed char | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:64:3:64:19 | ... << ... | -2147483648 | 2147483647 | file://:0:0:0:0 | int | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:67:3:67:8 | ... << ... | -2147483648 | 2147483647 | file://:0:0:0:0 | int | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:70:5:70:10 | ... << ... | 1 | 128 | file://:0:0:0:0 | int | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:75:5:75:10 | ... << ... | -2147483648 | 2147483647 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:76:5:76:10 | ... << ... | -2147483648 | 2147483647 | file://:0:0:0:0 | signed char | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:90:3:90:9 | ... >>= ... | 0 | 63 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | +| bitshift.cpp:92:5:92:11 | ... >>= ... | 0 | 15 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | +| bitshift.cpp:96:3:96:8 | ... >> ... | 0 | 63 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:99:3:99:9 | ... >> ... | 0 | 0 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:103:3:103:9 | ... >> ... | 0 | 0 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:106:3:106:22 | ... >> ... | 0 | 63 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:107:3:107:22 | ... >> ... | 0 | 63 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:108:3:108:22 | ... >> ... | 0 | 63 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:111:3:111:19 | ... >> ... | -2147483648 | 2147483647 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:114:3:114:24 | ... >> ... | 32 | 32 | file://:0:0:0:0 | int | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:117:3:117:10 | ... >> ... | -2147483648 | 2147483647 | file://:0:0:0:0 | int | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:120:5:120:12 | ... >> ... | 32 | 128 | file://:0:0:0:0 | int | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:126:3:126:8 | ... >> ... | -2147483648 | 2147483647 | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:127:3:127:9 | ... >> ... | -2147483648 | 2147483647 | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:128:3:128:9 | ... >> ... | 0 | 0 | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:129:3:129:22 | ... >> ... | -2147483648 | 2147483647 | file://:0:0:0:0 | signed char | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:130:3:130:19 | ... >> ... | -2147483648 | 2147483647 | file://:0:0:0:0 | signed char | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:133:3:133:21 | ... >> ... | -2147483648 | 2147483647 | file://:0:0:0:0 | int | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:136:3:136:10 | ... >> ... | -2147483648 | 2147483647 | file://:0:0:0:0 | int | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:139:5:139:12 | ... >> ... | 32 | 128 | file://:0:0:0:0 | int | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:144:5:144:10 | ... >> ... | -2147483648 | 2147483647 | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | signed char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | +| bitshift.cpp:145:5:145:10 | ... >> ... | -2147483648 | 2147483647 | file://:0:0:0:0 | signed char | file://:0:0:0:0 | unsigned char | file://:0:0:0:0 | int | file://:0:0:0:0 | int | diff --git a/cpp/ql/test/experimental/library-tests/rangeanalysis/bitshift/BitShiftRange.ql b/cpp/ql/test/experimental/library-tests/rangeanalysis/bitshift/BitShiftRange.ql index 5429743abd5e..6f3e8abfb03f 100644 --- a/cpp/ql/test/experimental/library-tests/rangeanalysis/bitshift/BitShiftRange.ql +++ b/cpp/ql/test/experimental/library-tests/rangeanalysis/bitshift/BitShiftRange.ql @@ -19,6 +19,6 @@ where or o instanceof AssignBitwiseOperation ) -select o, lowerBound(o), upperBound(o), getLOp(o).getUnderlyingType(), +select o, lowerBound(o).toString(), upperBound(o).toString(), getLOp(o).getUnderlyingType(), getROp(o).getUnderlyingType(), getLOp(o).getFullyConverted().getUnderlyingType(), getROp(o).getFullyConverted().getUnderlyingType() diff --git a/cpp/ql/test/experimental/library-tests/rangeanalysis/bitwiseand/bitwiseand.expected b/cpp/ql/test/experimental/library-tests/rangeanalysis/bitwiseand/bitwiseand.expected index 22ad956469e4..f1674d460b9a 100644 --- a/cpp/ql/test/experimental/library-tests/rangeanalysis/bitwiseand/bitwiseand.expected +++ b/cpp/ql/test/experimental/library-tests/rangeanalysis/bitwiseand/bitwiseand.expected @@ -1,21 +1,21 @@ -| bitwiseand.cpp:7:3:7:8 | ... &= ... | 0.0 | 7.0 | -| bitwiseand.cpp:15:3:15:7 | ... & ... | 0.0 | 0.0 | -| bitwiseand.cpp:16:3:16:7 | ... & ... | 0.0 | 7.0 | -| bitwiseand.cpp:17:3:17:20 | ... & ... | 0.0 | 7.0 | -| bitwiseand.cpp:21:3:21:16 | ... & ... | 0.0 | 255.0 | -| bitwiseand.cpp:28:5:28:9 | ... & ... | -2.147483648E9 | 2.147483647E9 | -| bitwiseand.cpp:32:5:32:9 | ... & ... | 0.0 | 100.0 | -| bitwiseand.cpp:41:3:41:8 | ... & ... | -2.147483648E9 | 2.147483647E9 | -| bitwiseand.cpp:42:3:42:18 | ... & ... | -2.147483648E9 | 2.147483647E9 | -| bitwiseand.cpp:43:3:43:7 | ... & ... | -2.147483648E9 | 2.147483647E9 | -| bitwiseand.cpp:46:3:46:7 | ... & ... | -2.147483648E9 | 2.147483647E9 | -| bitwiseand.cpp:47:3:47:20 | ... & ... | -2.147483648E9 | 2.147483647E9 | -| bitwiseand.cpp:48:3:48:16 | ... & ... | 0.0 | 4.294967295E9 | -| bitwiseand.cpp:49:3:49:25 | ... & ... | -9.223372036854776E18 | 9.223372036854776E18 | -| bitwiseand.cpp:50:3:50:7 | ... & ... | -2.147483648E9 | 2.147483647E9 | -| bitwiseand.cpp:53:3:53:8 | ... & ... | -2.147483648E9 | 2.147483647E9 | -| bitwiseand.cpp:54:3:54:18 | ... & ... | -2.147483648E9 | 2.147483647E9 | -| bitwiseand.cpp:55:3:55:19 | ... & ... | -2.147483648E9 | 2.147483647E9 | -| bitwiseand.cpp:56:3:56:18 | ... & ... | -2.147483648E9 | 2.147483647E9 | -| bitwiseand.cpp:57:3:57:8 | ... & ... | -2.147483648E9 | 2.147483647E9 | -| bitwiseand.cpp:58:3:58:19 | ... & ... | -2.147483648E9 | 2.147483647E9 | +| bitwiseand.cpp:7:3:7:8 | ... &= ... | 0 | 7 | +| bitwiseand.cpp:15:3:15:7 | ... & ... | 0 | 0 | +| bitwiseand.cpp:16:3:16:7 | ... & ... | 0 | 7 | +| bitwiseand.cpp:17:3:17:20 | ... & ... | 0 | 7 | +| bitwiseand.cpp:21:3:21:16 | ... & ... | 0 | 255 | +| bitwiseand.cpp:28:5:28:9 | ... & ... | -2147483648 | 2147483647 | +| bitwiseand.cpp:32:5:32:9 | ... & ... | 0 | 100 | +| bitwiseand.cpp:41:3:41:8 | ... & ... | -2147483648 | 2147483647 | +| bitwiseand.cpp:42:3:42:18 | ... & ... | -2147483648 | 2147483647 | +| bitwiseand.cpp:43:3:43:7 | ... & ... | -2147483648 | 2147483647 | +| bitwiseand.cpp:46:3:46:7 | ... & ... | -2147483648 | 2147483647 | +| bitwiseand.cpp:47:3:47:20 | ... & ... | -2147483648 | 2147483647 | +| bitwiseand.cpp:48:3:48:16 | ... & ... | 0 | 4294967295 | +| bitwiseand.cpp:49:3:49:25 | ... & ... | -9223372036854775808 | 9223372036854775807 | +| bitwiseand.cpp:50:3:50:7 | ... & ... | -2147483648 | 2147483647 | +| bitwiseand.cpp:53:3:53:8 | ... & ... | -2147483648 | 2147483647 | +| bitwiseand.cpp:54:3:54:18 | ... & ... | -2147483648 | 2147483647 | +| bitwiseand.cpp:55:3:55:19 | ... & ... | -2147483648 | 2147483647 | +| bitwiseand.cpp:56:3:56:18 | ... & ... | -2147483648 | 2147483647 | +| bitwiseand.cpp:57:3:57:8 | ... & ... | -2147483648 | 2147483647 | +| bitwiseand.cpp:58:3:58:19 | ... & ... | -2147483648 | 2147483647 | diff --git a/cpp/ql/test/experimental/library-tests/rangeanalysis/bitwiseand/bitwiseand.ql b/cpp/ql/test/experimental/library-tests/rangeanalysis/bitwiseand/bitwiseand.ql index 6521e8f0f610..021f5428e19f 100644 --- a/cpp/ql/test/experimental/library-tests/rangeanalysis/bitwiseand/bitwiseand.ql +++ b/cpp/ql/test/experimental/library-tests/rangeanalysis/bitwiseand/bitwiseand.ql @@ -1,8 +1,8 @@ import experimental.semmle.code.cpp.rangeanalysis.ExtendedRangeAnalysis -from Operation expr, float lower, float upper +from Operation expr, QlBuiltins::BigInt lower, QlBuiltins::BigInt upper where (expr instanceof BitwiseAndExpr or expr instanceof AssignAndExpr) and lower = lowerBound(expr) and upper = upperBound(expr) -select expr, lower, upper +select expr, lower.toString(), upper.toString() diff --git a/cpp/ql/test/experimental/library-tests/rangeanalysis/extended/extended.expected b/cpp/ql/test/experimental/library-tests/rangeanalysis/extended/extended.expected index b43601c80886..e99f6e360fef 100644 --- a/cpp/ql/test/experimental/library-tests/rangeanalysis/extended/extended.expected +++ b/cpp/ql/test/experimental/library-tests/rangeanalysis/extended/extended.expected @@ -1,6 +1,6 @@ -| extended.cpp:4:14:4:14 | x | -2.147483648E9 | 2.147483647E9 | -| extended.cpp:4:18:4:18 | x | -2.147483648E9 | 2.147483647E9 | -| extended.cpp:5:3:5:6 | zero | 0.0 | 0.0 | -| extended.cpp:7:17:7:17 | x | -2.147483648E9 | 2.147483647E9 | -| extended.cpp:7:36:7:36 | x | -2.147483648E9 | 2.147483647E9 | -| extended.cpp:8:3:8:9 | nonzero | -2.147483648E9 | 2.147483647E9 | +| extended.cpp:4:14:4:14 | x | -2147483648 | 2147483647 | +| extended.cpp:4:18:4:18 | x | -2147483648 | 2147483647 | +| extended.cpp:5:3:5:6 | zero | 0 | 0 | +| extended.cpp:7:17:7:17 | x | -2147483648 | 2147483647 | +| extended.cpp:7:36:7:36 | x | -2147483648 | 2147483647 | +| extended.cpp:8:3:8:9 | nonzero | -2147483648 | 2147483647 | diff --git a/cpp/ql/test/experimental/library-tests/rangeanalysis/extended/extended.ql b/cpp/ql/test/experimental/library-tests/rangeanalysis/extended/extended.ql index d6344e5d0629..b60e07f9f6af 100644 --- a/cpp/ql/test/experimental/library-tests/rangeanalysis/extended/extended.ql +++ b/cpp/ql/test/experimental/library-tests/rangeanalysis/extended/extended.ql @@ -1,7 +1,7 @@ import experimental.semmle.code.cpp.rangeanalysis.ExtendedRangeAnalysis -from VariableAccess expr, float lower, float upper +from VariableAccess expr, QlBuiltins::BigInt lower, QlBuiltins::BigInt upper where lower = lowerBound(expr) and upper = upperBound(expr) -select expr, lower, upper +select expr, lower.toString(), upper.toString() diff --git a/cpp/ql/test/experimental/library-tests/rangeanalysis/extensibility/extensibility.expected b/cpp/ql/test/experimental/library-tests/rangeanalysis/extensibility/extensibility.expected index e9133e191044..6b481dbecb77 100644 --- a/cpp/ql/test/experimental/library-tests/rangeanalysis/extensibility/extensibility.expected +++ b/cpp/ql/test/experimental/library-tests/rangeanalysis/extensibility/extensibility.expected @@ -1,9 +1,9 @@ -| extensibility.c:5:7:5:7 | x | -2.147483648E9 | 2.147483647E9 | -| extensibility.c:5:19:5:19 | x | -10.0 | 2.147483647E9 | -| extensibility.c:6:38:6:38 | x | -10.0 | 10.0 | -| extensibility.c:7:12:7:17 | result | 90.0 | 110.0 | -| extensibility.c:12:16:12:16 | x | -2.147483648E9 | 2.147483647E9 | -| extensibility.c:12:35:12:35 | x | -2.147483648E9 | 2.147483647E9 | -| extensibility.c:13:10:13:15 | result | 0.0 | 0.0 | -| extensibility.c:17:3:17:23 | magic_name_at_most_10 | -2.147483648E9 | 10.0 | -| extensibility.c:18:3:18:23 | magic_name_at_most_20 | -2.147483648E9 | 20.0 | +| extensibility.c:5:7:5:7 | x | -2147483648 | 2147483647 | +| extensibility.c:5:19:5:19 | x | -10 | 2147483647 | +| extensibility.c:6:38:6:38 | x | -10 | 10 | +| extensibility.c:7:12:7:17 | result | 90 | 110 | +| extensibility.c:12:16:12:16 | x | -2147483648 | 2147483647 | +| extensibility.c:12:35:12:35 | x | -2147483648 | 2147483647 | +| extensibility.c:13:10:13:15 | result | 0 | 0 | +| extensibility.c:17:3:17:23 | magic_name_at_most_10 | -2147483648 | 10 | +| extensibility.c:18:3:18:23 | magic_name_at_most_20 | -2147483648 | 20 | diff --git a/cpp/ql/test/experimental/library-tests/rangeanalysis/extensibility/extensibility.ql b/cpp/ql/test/experimental/library-tests/rangeanalysis/extensibility/extensibility.ql index 0d110e67fa1e..92ccbfd5e878 100644 --- a/cpp/ql/test/experimental/library-tests/rangeanalysis/extensibility/extensibility.ql +++ b/cpp/ql/test/experimental/library-tests/rangeanalysis/extensibility/extensibility.ql @@ -6,8 +6,8 @@ import experimental.semmle.code.cpp.models.interfaces.SimpleRangeAnalysisDefinit class CustomAddFunctionCall extends SimpleRangeAnalysisExpr, FunctionCall { CustomAddFunctionCall() { this.getTarget().hasGlobalName("custom_add_function") } - override float getLowerBounds() { - exists(float lower0, float lower1 | + override QlBuiltins::BigInt getLowerBounds() { + exists(QlBuiltins::BigInt lower0, QlBuiltins::BigInt lower1 | lower0 = getFullyConvertedLowerBounds(this.getArgument(0)) and lower1 = getFullyConvertedLowerBounds(this.getArgument(1)) and // Note: this rounds toward 0, not -Inf as it should @@ -15,8 +15,8 @@ class CustomAddFunctionCall extends SimpleRangeAnalysisExpr, FunctionCall { ) } - override float getUpperBounds() { - exists(float upper0, float upper1 | + override QlBuiltins::BigInt getUpperBounds() { + exists(QlBuiltins::BigInt upper0, QlBuiltins::BigInt upper1 | upper0 = getFullyConvertedUpperBounds(this.getArgument(0)) and upper1 = getFullyConvertedUpperBounds(this.getArgument(1)) and // Note: this rounds toward 0, not Inf as it should @@ -33,9 +33,9 @@ class SelfSub extends SimpleRangeAnalysisExpr, SubExpr { this.getRightOperand().(VariableAccess).getTarget() } - override float getLowerBounds() { result = 0 } + override QlBuiltins::BigInt getLowerBounds() { result = 0.toBigInt() } - override float getUpperBounds() { result = 0 } + override QlBuiltins::BigInt getUpperBounds() { result = 0.toBigInt() } override predicate dependsOnChild(Expr child) { child = this.getAnOperand() } } @@ -49,11 +49,11 @@ class SelfSub extends SimpleRangeAnalysisExpr, SubExpr { */ class MagicParameterName extends SimpleRangeAnalysisDefinition { Parameter p; - float value; + QlBuiltins::BigInt value; MagicParameterName() { this.definedByParameter(p) and - value = p.getName().regexpCapture("magic_name_at_most_(\\d+)", 1).toFloat() + value = p.getName().regexpCapture("magic_name_at_most_(\\d+)", 1).toBigInt() } override predicate hasRangeInformationFor(StackVariable v) { v = p } @@ -63,19 +63,19 @@ class MagicParameterName extends SimpleRangeAnalysisDefinition { none() } - override float getLowerBounds(StackVariable var) { + override QlBuiltins::BigInt getLowerBounds(StackVariable var) { var = p and result = typeLowerBound(p.getUnspecifiedType()) } - override float getUpperBounds(StackVariable var) { + override QlBuiltins::BigInt getUpperBounds(StackVariable var) { var = p and result = value } } -from VariableAccess expr, float lower, float upper +from VariableAccess expr, QlBuiltins::BigInt lower, QlBuiltins::BigInt upper where lower = lowerBound(expr) and upper = upperBound(expr) -select expr, lower, upper +select expr, lower.toString(), upper.toString() diff --git a/cpp/ql/test/experimental/library-tests/rangeanalysis/strlenliteral/StrlenLiteralRange.expected b/cpp/ql/test/experimental/library-tests/rangeanalysis/strlenliteral/StrlenLiteralRange.expected index f714ac312ea7..6fe0ec239b62 100644 --- a/cpp/ql/test/experimental/library-tests/rangeanalysis/strlenliteral/StrlenLiteralRange.expected +++ b/cpp/ql/test/experimental/library-tests/rangeanalysis/strlenliteral/StrlenLiteralRange.expected @@ -1,2 +1,2 @@ -| test.cpp:4:3:4:8 | call to strlen | 7.0 | 7.0 | -| test.cpp:5:3:5:8 | call to strlen | 1.8446744073709552E19 | 0.0 | +| test.cpp:4:3:4:8 | call to strlen | 7 | 7 | +| test.cpp:5:3:5:8 | call to strlen | 18446744073709551615 | 0 | diff --git a/cpp/ql/test/experimental/library-tests/rangeanalysis/strlenliteral/StrlenLiteralRange.ql b/cpp/ql/test/experimental/library-tests/rangeanalysis/strlenliteral/StrlenLiteralRange.ql index c77b20786109..59016bf0d48b 100644 --- a/cpp/ql/test/experimental/library-tests/rangeanalysis/strlenliteral/StrlenLiteralRange.ql +++ b/cpp/ql/test/experimental/library-tests/rangeanalysis/strlenliteral/StrlenLiteralRange.ql @@ -3,4 +3,4 @@ import semmle.code.cpp.rangeanalysis.SimpleRangeAnalysis import experimental.semmle.code.cpp.rangeanalysis.extensions.StrlenLiteralRangeExpr from FunctionCall fc -select fc, upperBound(fc), lowerBound(fc) +select fc, upperBound(fc).toString(), lowerBound(fc).toString() diff --git a/cpp/ql/test/library-tests/rangeanalysis/SimpleRangeAnalysis/lowerBound.expected b/cpp/ql/test/library-tests/rangeanalysis/SimpleRangeAnalysis/lowerBound.expected index 112b6cb02014..482073673d8a 100644 --- a/cpp/ql/test/library-tests/rangeanalysis/SimpleRangeAnalysis/lowerBound.expected +++ b/cpp/ql/test/library-tests/rangeanalysis/SimpleRangeAnalysis/lowerBound.expected @@ -486,13 +486,13 @@ | test.c:470:3:470:4 | xy | 0 | | test.c:470:8:470:8 | x | 1000000003 | | test.c:470:12:470:12 | y | 1000000003 | -| test.c:471:10:471:11 | xy | 1000000006000000000 | +| test.c:471:10:471:11 | xy | 1000000006000000009 | | test.c:476:3:476:3 | x | 0 | | test.c:477:3:477:3 | y | 0 | | test.c:478:3:478:4 | xy | 0 | | test.c:478:8:478:8 | x | 274177 | | test.c:478:12:478:12 | y | 67280421310721 | -| test.c:479:10:479:11 | xy | 18446744073709551616 | +| test.c:479:10:479:11 | xy | 0 | | test.c:483:7:483:8 | ui | 0 | | test.c:484:43:484:44 | ui | 10 | | test.c:484:48:484:49 | ui | 10 | diff --git a/cpp/ql/test/library-tests/rangeanalysis/SimpleRangeAnalysis/ternaryLower.expected b/cpp/ql/test/library-tests/rangeanalysis/SimpleRangeAnalysis/ternaryLower.expected index f012490f1156..d46d390c0497 100644 --- a/cpp/ql/test/library-tests/rangeanalysis/SimpleRangeAnalysis/ternaryLower.expected +++ b/cpp/ql/test/library-tests/rangeanalysis/SimpleRangeAnalysis/ternaryLower.expected @@ -1,19 +1,19 @@ -| test.c:154:10:154:40 | ... ? ... : ... | -1.0 | 1.0 | -1.0 | -| test.c:357:8:357:23 | ... ? ... : ... | 0.0 | 0.0 | 10.0 | -| test.c:358:8:358:24 | ... ? ... : ... | 0.0 | 10.0 | 0.0 | -| test.c:366:10:366:15 | ... ? ... : ... | 0.0 | 0.0 | 5.0 | -| test.c:367:10:367:17 | ... ? ... : ... | 0.0 | 0.0 | 500.0 | -| test.c:368:10:368:21 | ... ? ... : ... | 1.0 | 1.0 | 500.0 | -| test.c:369:10:369:36 | ... ? ... : ... | 0.0 | 1.0 | 5.0 | -| test.c:370:10:370:38 | ... ? ... : ... | 0.0 | 1.0 | 500.0 | -| test.c:371:10:371:39 | ... ? ... : ... | 1.0 | 1.0 | 500.0 | -| test.c:379:8:379:24 | ... ? ... : ... | 101.0 | 101.0 | 110.0 | -| test.c:380:8:380:25 | ... ? ... : ... | 101.0 | 110.0 | 101.0 | -| test.c:385:10:385:21 | ... ? ... : ... | 0.0 | 0.0 | 5.0 | -| test.c:386:10:386:21 | ... ? ... : ... | 100.0 | 100.0 | 5.0 | -| test.c:387:10:387:38 | ... ? ... : ... | 0.0 | 100.0 | 5.0 | -| test.c:394:20:394:36 | ... ? ... : ... | 0.0 | 0.0 | 100.0 | -| test.c:606:5:606:14 | ... ? ... : ... | 0.0 | 1.0 | 0.0 | -| test.c:607:5:607:14 | ... ? ... : ... | 0.0 | 0.0 | 1.0 | -| test.cpp:121:3:121:12 | ... ? ... : ... | 0.0 | 1.0 | 0.0 | -| test.cpp:122:3:122:12 | ... ? ... : ... | 0.0 | 0.0 | 1.0 | +| test.c:154:10:154:40 | ... ? ... : ... | -1 | 1 | -1 | +| test.c:357:8:357:23 | ... ? ... : ... | 0 | 0 | 10 | +| test.c:358:8:358:24 | ... ? ... : ... | 0 | 10 | 0 | +| test.c:366:10:366:15 | ... ? ... : ... | 0 | 0 | 5 | +| test.c:367:10:367:17 | ... ? ... : ... | 0 | 0 | 500 | +| test.c:368:10:368:21 | ... ? ... : ... | 1 | 1 | 500 | +| test.c:369:10:369:36 | ... ? ... : ... | 0 | 1 | 5 | +| test.c:370:10:370:38 | ... ? ... : ... | 0 | 1 | 500 | +| test.c:371:10:371:39 | ... ? ... : ... | 1 | 1 | 500 | +| test.c:379:8:379:24 | ... ? ... : ... | 101 | 101 | 110 | +| test.c:380:8:380:25 | ... ? ... : ... | 101 | 110 | 101 | +| test.c:385:10:385:21 | ... ? ... : ... | 0 | 0 | 5 | +| test.c:386:10:386:21 | ... ? ... : ... | 100 | 100 | 5 | +| test.c:387:10:387:38 | ... ? ... : ... | 0 | 100 | 5 | +| test.c:394:20:394:36 | ... ? ... : ... | 0 | 0 | 100 | +| test.c:606:5:606:14 | ... ? ... : ... | 0 | 1 | 0 | +| test.c:607:5:607:14 | ... ? ... : ... | 0 | 0 | 1 | +| test.cpp:121:3:121:12 | ... ? ... : ... | 0 | 1 | 0 | +| test.cpp:122:3:122:12 | ... ? ... : ... | 0 | 0 | 1 | diff --git a/cpp/ql/test/library-tests/rangeanalysis/SimpleRangeAnalysis/ternaryLower.ql b/cpp/ql/test/library-tests/rangeanalysis/SimpleRangeAnalysis/ternaryLower.ql index f4065881bcc9..d1a7839a84f6 100644 --- a/cpp/ql/test/library-tests/rangeanalysis/SimpleRangeAnalysis/ternaryLower.ql +++ b/cpp/ql/test/library-tests/rangeanalysis/SimpleRangeAnalysis/ternaryLower.ql @@ -2,4 +2,5 @@ import cpp import semmle.code.cpp.rangeanalysis.SimpleRangeAnalysis from ConditionalExpr ce -select ce, lowerBound(ce), lowerBound(ce.getThen()), lowerBound(ce.getElse()) +select ce, lowerBound(ce).toString(), lowerBound(ce.getThen()).toString(), + lowerBound(ce.getElse()).toString() diff --git a/cpp/ql/test/library-tests/rangeanalysis/SimpleRangeAnalysis/ternaryUpper.expected b/cpp/ql/test/library-tests/rangeanalysis/SimpleRangeAnalysis/ternaryUpper.expected index 8a387c3ae464..527a4d4381d3 100644 --- a/cpp/ql/test/library-tests/rangeanalysis/SimpleRangeAnalysis/ternaryUpper.expected +++ b/cpp/ql/test/library-tests/rangeanalysis/SimpleRangeAnalysis/ternaryUpper.expected @@ -1,19 +1,19 @@ -| test.c:154:10:154:40 | ... ? ... : ... | 2.147483647E9 | 2.147483647E9 | -1.0 | -| test.c:357:8:357:23 | ... ? ... : ... | 99.0 | 99.0 | 10.0 | -| test.c:358:8:358:24 | ... ? ... : ... | 99.0 | 10.0 | 99.0 | -| test.c:366:10:366:15 | ... ? ... : ... | 299.0 | 299.0 | 5.0 | -| test.c:367:10:367:17 | ... ? ... : ... | 500.0 | 299.0 | 500.0 | -| test.c:368:10:368:21 | ... ? ... : ... | 300.0 | 300.0 | 500.0 | -| test.c:369:10:369:36 | ... ? ... : ... | 255.0 | 300.0 | 5.0 | -| test.c:370:10:370:38 | ... ? ... : ... | 500.0 | 300.0 | 500.0 | -| test.c:371:10:371:39 | ... ? ... : ... | 300.0 | 300.0 | 500.0 | -| test.c:379:8:379:24 | ... ? ... : ... | 4.294967295E9 | 4.294967295E9 | 110.0 | -| test.c:380:8:380:25 | ... ? ... : ... | 4.294967295E9 | 110.0 | 4.294967295E9 | -| test.c:385:10:385:21 | ... ? ... : ... | 4.294967295E9 | 4.294967295E9 | 5.0 | -| test.c:386:10:386:21 | ... ? ... : ... | 4.294967295E9 | 4.294967295E9 | 5.0 | -| test.c:387:10:387:38 | ... ? ... : ... | 255.0 | 4.294967295E9 | 5.0 | -| test.c:394:20:394:36 | ... ? ... : ... | 100.0 | 99.0 | 100.0 | -| test.c:606:5:606:14 | ... ? ... : ... | 32767.0 | 32767.0 | 0.0 | -| test.c:607:5:607:14 | ... ? ... : ... | 32767.0 | 0.0 | 32767.0 | -| test.cpp:121:3:121:12 | ... ? ... : ... | 32767.0 | 32767.0 | 0.0 | -| test.cpp:122:3:122:12 | ... ? ... : ... | 32767.0 | 0.0 | 32767.0 | +| test.c:154:10:154:40 | ... ? ... : ... | 2147483647 | 2147483647 | -1 | +| test.c:357:8:357:23 | ... ? ... : ... | 99 | 99 | 10 | +| test.c:358:8:358:24 | ... ? ... : ... | 99 | 10 | 99 | +| test.c:366:10:366:15 | ... ? ... : ... | 299 | 299 | 5 | +| test.c:367:10:367:17 | ... ? ... : ... | 500 | 299 | 500 | +| test.c:368:10:368:21 | ... ? ... : ... | 300 | 300 | 500 | +| test.c:369:10:369:36 | ... ? ... : ... | 255 | 300 | 5 | +| test.c:370:10:370:38 | ... ? ... : ... | 500 | 300 | 500 | +| test.c:371:10:371:39 | ... ? ... : ... | 300 | 300 | 500 | +| test.c:379:8:379:24 | ... ? ... : ... | 4294967295 | 4294967295 | 110 | +| test.c:380:8:380:25 | ... ? ... : ... | 4294967295 | 110 | 4294967295 | +| test.c:385:10:385:21 | ... ? ... : ... | 4294967295 | 4294967295 | 5 | +| test.c:386:10:386:21 | ... ? ... : ... | 4294967295 | 4294967295 | 5 | +| test.c:387:10:387:38 | ... ? ... : ... | 255 | 4294967295 | 5 | +| test.c:394:20:394:36 | ... ? ... : ... | 100 | 99 | 100 | +| test.c:606:5:606:14 | ... ? ... : ... | 32767 | 32767 | 0 | +| test.c:607:5:607:14 | ... ? ... : ... | 32767 | 0 | 32767 | +| test.cpp:121:3:121:12 | ... ? ... : ... | 32767 | 32767 | 0 | +| test.cpp:122:3:122:12 | ... ? ... : ... | 32767 | 0 | 32767 | diff --git a/cpp/ql/test/library-tests/rangeanalysis/SimpleRangeAnalysis/ternaryUpper.ql b/cpp/ql/test/library-tests/rangeanalysis/SimpleRangeAnalysis/ternaryUpper.ql index 409735829361..b4736fd5a683 100644 --- a/cpp/ql/test/library-tests/rangeanalysis/SimpleRangeAnalysis/ternaryUpper.ql +++ b/cpp/ql/test/library-tests/rangeanalysis/SimpleRangeAnalysis/ternaryUpper.ql @@ -2,4 +2,5 @@ import cpp import semmle.code.cpp.rangeanalysis.SimpleRangeAnalysis from ConditionalExpr ce -select ce, upperBound(ce), upperBound(ce.getThen()), upperBound(ce.getElse()) +select ce, upperBound(ce).toString(), upperBound(ce.getThen()).toString(), + upperBound(ce.getElse()).toString() diff --git a/cpp/ql/test/library-tests/rangeanalysis/SimpleRangeAnalysis/test.c b/cpp/ql/test/library-tests/rangeanalysis/SimpleRangeAnalysis/test.c index 8c7978ac4aa6..6a844e116cde 100644 --- a/cpp/ql/test/library-tests/rangeanalysis/SimpleRangeAnalysis/test.c +++ b/cpp/ql/test/library-tests/rangeanalysis/SimpleRangeAnalysis/test.c @@ -468,7 +468,7 @@ unsigned long mult_rounding() { unsigned long x, y, xy; x = y = 1000000003UL; // 1e9 + 3 xy = x * y; - return xy; // BUG: upper bound should be >= 1000000006000000009UL + return xy; // = 1000000006000000009UL } unsigned long mult_overflow() { diff --git a/cpp/ql/test/query-tests/Likely Bugs/Arithmetic/PointlessComparison/PointlessComparison.c b/cpp/ql/test/query-tests/Likely Bugs/Arithmetic/PointlessComparison/PointlessComparison.c index fd1bc655051d..6e4c063b8cfb 100644 --- a/cpp/ql/test/query-tests/Likely Bugs/Arithmetic/PointlessComparison/PointlessComparison.c +++ b/cpp/ql/test/query-tests/Likely Bugs/Arithmetic/PointlessComparison/PointlessComparison.c @@ -401,8 +401,8 @@ void mult_rounding() { // are no PointlessComparison false positives in these tests because alerts // are suppressed when ulp() < 1, which roughly means that the number is // larger than 2^53. - if (x * y < xy) {} // always false [NOT DETECTED] - if (x * y > xy) {} // always false [NOT DETECTED] + if (x * y < xy) {} // always false + if (x * y > xy) {} // always false } void mult_overflow() { @@ -411,7 +411,7 @@ void mult_overflow() { // to 64-bit unsigned. x = 274177UL; y = 67280421310721UL; - if (x * y == 1) {} // always true [BUG: reported as always false] + if (x * y == 1) {} // always true [NOT DETECTED] // This bug appears to be caused by // `RangeAnalysisUtils::typeUpperBound(unsigned long)` having a result of diff --git a/cpp/ql/test/query-tests/Likely Bugs/Arithmetic/PointlessComparison/PointlessComparison.cpp b/cpp/ql/test/query-tests/Likely Bugs/Arithmetic/PointlessComparison/PointlessComparison.cpp index 7b67f77ad443..b9824a27ece8 100644 --- a/cpp/ql/test/query-tests/Likely Bugs/Arithmetic/PointlessComparison/PointlessComparison.cpp +++ b/cpp/ql/test/query-tests/Likely Bugs/Arithmetic/PointlessComparison/PointlessComparison.cpp @@ -6,7 +6,7 @@ struct A { const int int_member = 0; A(int n) : int_member(n) { if(int_member <= 10) { - + } } }; @@ -34,12 +34,12 @@ int extreme_values(void) unsigned long long int y = 0xFFFFFFFFFFFF; if (x >> 1 >= 0xFFFFFFFFFFFFFFFF) {} // always false - if (x >> 1 >= 0x8000000000000000) {} // always false [NOT DETECTED] - if (x >> 1 >= 0x7FFFFFFFFFFFFFFF) {} // always true [NOT DETECTED] - if (x >> 1 >= 0xFFFFFFFFFFFFFFF) {} // always true [NOT DETECTED] - - if (y >> 1 >= 0xFFFFFFFFFFFF) {} // always false [INCORRECT MESSAGE] - if (y >> 1 >= 0x800000000000) {} // always false [INCORRECT MESSAGE] - if (y >> 1 >= 0x7FFFFFFFFFFF) {} // always true [INCORRECT MESSAGE] - if (y >> 1 >= 0xFFFFFFFFFFF) {} // always true [INCORRECT MESSAGE] + if (x >> 1 >= 0x8000000000000000) {} // always false + if (x >> 1 >= 0x7FFFFFFFFFFFFFFF) {} // always true + if (x >> 1 >= 0xFFFFFFFFFFFFFFF) {} // always true + + if (y >> 1 >= 0xFFFFFFFFFFFF) {} // always false + if (y >> 1 >= 0x800000000000) {} // always false + if (y >> 1 >= 0x7FFFFFFFFFFF) {} // always true + if (y >> 1 >= 0xFFFFFFFFFFF) {} // always true } diff --git a/cpp/ql/test/query-tests/Likely Bugs/Arithmetic/PointlessComparison/PointlessComparison.expected b/cpp/ql/test/query-tests/Likely Bugs/Arithmetic/PointlessComparison/PointlessComparison.expected index 6c273b985eeb..29c5929dfb73 100644 --- a/cpp/ql/test/query-tests/Likely Bugs/Arithmetic/PointlessComparison/PointlessComparison.expected +++ b/cpp/ql/test/query-tests/Likely Bugs/Arithmetic/PointlessComparison/PointlessComparison.expected @@ -43,11 +43,15 @@ | PointlessComparison.c:383:6:383:17 | ... >= ... | Comparison is always false because ... & ... <= 2. | | PointlessComparison.c:388:10:388:21 | ... > ... | Comparison is always false because ... * ... <= 408. | | PointlessComparison.c:391:12:391:20 | ... < ... | Comparison is always false because ... * ... >= 6. | -| PointlessComparison.c:414:7:414:16 | ... == ... | Comparison is always false because ... * ... >= 18446744073709551616. | -| PointlessComparison.cpp:36:6:36:33 | ... >= ... | Comparison is always false because ... >> ... <= 9223372036854775808. | -| PointlessComparison.cpp:41:6:41:29 | ... >= ... | Comparison is always false because ... >> ... <= 140737488355327.5. | -| PointlessComparison.cpp:42:6:42:29 | ... >= ... | Comparison is always false because ... >> ... <= 140737488355327.5. | -| PointlessComparison.cpp:43:6:43:29 | ... >= ... | Comparison is always true because ... >> ... >= 140737488355327.5. | -| PointlessComparison.cpp:44:6:44:28 | ... >= ... | Comparison is always true because ... >> ... >= 140737488355327.5. | +| PointlessComparison.c:404:7:404:16 | ... < ... | Comparison is always false because ... * ... >= 1000000006000000009 and 1000000006000000009 >= xy. | +| PointlessComparison.c:405:7:405:16 | ... > ... | Comparison is always false because ... * ... <= 1000000006000000009 and 1000000006000000009 <= xy. | +| PointlessComparison.cpp:36:6:36:33 | ... >= ... | Comparison is always false because ... >> ... <= 9223372036854775807. | +| PointlessComparison.cpp:37:6:37:33 | ... >= ... | Comparison is always false because ... >> ... <= 9223372036854775807. | +| PointlessComparison.cpp:38:6:38:33 | ... >= ... | Comparison is always true because ... >> ... >= 9223372036854775807. | +| PointlessComparison.cpp:39:6:39:32 | ... >= ... | Comparison is always true because ... >> ... >= 9223372036854775807. | +| PointlessComparison.cpp:41:6:41:29 | ... >= ... | Comparison is always false because ... >> ... <= 140737488355327. | +| PointlessComparison.cpp:42:6:42:29 | ... >= ... | Comparison is always false because ... >> ... <= 140737488355327. | +| PointlessComparison.cpp:43:6:43:29 | ... >= ... | Comparison is always true because ... >> ... >= 140737488355327. | +| PointlessComparison.cpp:44:6:44:28 | ... >= ... | Comparison is always true because ... >> ... >= 140737488355327. | | RegressionTests.cpp:57:7:57:22 | ... <= ... | Comparison is always true because * ... <= 4294967295. | | Templates.cpp:9:10:9:24 | ... <= ... | Comparison is always true because local <= 32767. |