History log of /src/tests/usr.bin/xlint/lint1/msg_132.c |
Revision | | Date | Author | Comments |
1.56 |
| 14-Sep-2025 |
rillig | lint: warn about signed '<<' that ends up exactly in the msb
|
1.55 |
| 14-Sep-2025 |
rillig | lint: add more type details to several messages
In most expressions, the integer promotions are performed on the operands, making the actual type different from the "visible" type of an operand. To properly explain the situation, mention the type before the integer promotions in case it differs from the resulting type.
|
1.54 |
| 08-Jul-2025 |
rillig | lint: reword message about 'extra bits set to 0'
The word 'extra' in the previous wording was too unspecific to make sense of. In the reworded message, focus on the problem instead of mentioning only the effect.
|
1.53 |
| 03-Jan-2025 |
rillig | tests/lint: move a platform-specific test
The test failed on i386, as ptrdiff_t fits in a uint32_t after conversion, thus not generating a warning.
|
1.52 |
| 02-Jan-2025 |
rillig | lint: fix possible loss of accuracy in multiplication and division
|
1.51 |
| 02-Jan-2025 |
rillig | lint: fix assertion failure in pointer subtraction
|
1.50 |
| 02-Jan-2025 |
rillig | lint: fix a few wrong warnings about possible loss of accuracy
|
1.49 |
| 02-Jan-2025 |
rillig | lint: compute integer constraints for xor and minus
These operators allow lint to correctly track the possible values in expressions that sign-extend an integer.
|
1.48 |
| 01-Jan-2025 |
rillig | lint: fix wrong warning about possible loss of accuracy
The expression "'0' + random() % 10" always fits in a signed or unsigned char.
|
1.47 |
| 01-Jan-2025 |
rillig | tests/lint: demonstrate wrong warnings for 'char = int + long'
|
1.46 |
| 12-Oct-2024 |
rillig | lint: reduce wrong warnings about loss of accuracy in signed '%'
|
1.45 |
| 12-Oct-2024 |
rillig | tests/lint: extend test for integer constraints
|
1.44 |
| 08-Oct-2024 |
rillig | lint: compute integer constraints for unsigned multiplication
This fixes the wrong warning about possible loss of accuracy in libc/c16rtomb.
|
1.43 |
| 08-Oct-2024 |
rillig | tests/lint: test integer constraint on multiplication
|
1.42 |
| 18-Aug-2024 |
rillig | lint: add value propagation for '/' combined with bit operations
Fixes __SHIFTIN/__SHIFTOUT expressions, as in PR toolchain/58617.
|
1.41 |
| 18-Aug-2024 |
rillig | tests/lint: demonstrate wrong warning about accuracy loss
Demonstrates PR toolchain/58617.
|
1.40 |
| 01-May-2024 |
rillig | branches: 1.40.2; lint: fix warning about out-of-bounds bit-field value
|
1.39 |
| 01-May-2024 |
rillig | lint: demonstrate wrong warning about out-of-range bit-field
|
1.38 |
| 25-Mar-2024 |
rillig | lint: fix warnings about loss of accuracy on bit-field operations
|
1.37 |
| 25-Mar-2024 |
rillig | tests/lint: demonstrate wrong warnings about lossy bit field operations
|
1.36 |
| 12-Mar-2024 |
rillig | tests/lint: extend test for previously wrong warning about bit-fields
|
1.35 |
| 12-Mar-2024 |
rillig | lint: fix warning about loss of conversion for unsigned bit-fields
Since decl.c 1.180 from 2021-05-02.
|
1.34 |
| 12-Mar-2024 |
rillig | tests/lint: demonstrate wrong warning when comparing a bit-field
Since decl.c 1.180 from 2021-05-02, which allowed arbitrary integer types to be used as the underlying type for bit-fields in GCC mode.
|
1.33 |
| 28-Jan-2024 |
rillig | tests/lint: sort multiple diagnostics per line chronologically
For now, the chronologic order is not enforced but has to be established manually, for example by removing all 'expect' comment lines and regenerating them with 'accept.sh -u'.
While here, clean up a few instances that came up when regenerating the 'expect' comments, such as wrong indentation or needless deviation from the 'expect+1' form.
|
1.32 |
| 06-Aug-2023 |
rillig | lint: since C99, a non-void function must return a value
|
1.31 |
| 03-Jun-2023 |
rillig | lint: provide more detailed types when operands do not match
|
1.30 |
| 09-May-2023 |
rillig | lint: track integer constraints through conditional expressions
|
1.29 |
| 09-May-2023 |
rillig | lint: preserve integer constraints on cast
|
1.28 |
| 09-May-2023 |
rillig | tests/lint: demonstrate wrong warning about loss of accuracy
|
1.27 |
| 09-May-2023 |
rillig | tests/lint: demonstrate wrong warning about losing accuracy
|
1.26 |
| 28-Mar-2023 |
rillig | lint: warn about extern declarations outside headers
https://mail-index.netbsd.org/tech-userlevel/2023/03/15/msg013727.html
|
1.25 |
| 29-Jan-2023 |
rillig | tests/lint: merge tests for '>>'
|
1.24 |
| 07-Jul-2022 |
rillig | tests/lint: document why in ic_expr, '&' does not need before_conversion
|
1.23 |
| 06-Jul-2022 |
rillig | lint: do not warn about 'may lose accuracy' in safe cases of '%'
The possible values of the expression 'a % b' for unsigned integers lie between 0 and (b - 1). For signed integers, it's more complicated, so ignore them for now.
|
1.22 |
| 06-Jul-2022 |
rillig | tests/lint: test 'may lose accuracy' for '%'
For unsigned integers, the possible range of the result can be narrowed down by looking at the right operand of the '%'. Right now, lint doesn't do this though.
|
1.21 |
| 03-Jul-2022 |
rillig | lint: include the width of bit-fields in the type name
|
1.20 |
| 02-Jul-2022 |
rillig | tests/lint: test bit shift with large integer types
build_bit_shift converts the right-hand operand to INT or UINT, even though C11 6.5.7 doesn't say anything about narrowing conversions.
Traditional C says that the operators '<<' and '>>' perform the usual arithmetic conversions. This has been dropped in C90.
What lint actually does is something completely different. In the operators table in ops.def, the operators '<<' and '>>' are not marked as performing the usual arithmetic conversions (column 'balance'). This leaves all conversions to 'build_bit_shift', which converts the right-hand side to INT or UINT. There is no obvious reason for this conversion, as the bounds checks need to be performed no matter whether the type is INT or UINT128.
|
1.19 |
| 19-Jun-2022 |
rillig | lint: add quotes around placeholders in 4 messages
|
1.18 |
| 16-Jun-2022 |
rillig | tests/lint: make expectation lines in the tests more detailed
This commit migrates msg_100 until msg_199.
|
1.17 |
| 10-Jun-2022 |
rillig | tests/lint: fix test for loss of accuracy on ILP32 platforms
The test had been wrong since msg_132.c 1.14 from 2022-05-30.
Using 'unsigned long' in a test that was intended to behave the same on ILP32 and LP64 was an accident. Use 'unsigned long long' instead, which is 64-bits wide on all platforms supported by lint.
Move the test about conversion from 'long' to 'int' to the platform-specific test files.
Noticed by martin@ on powerpc.
|
1.16 |
| 30-May-2022 |
rillig | lint: fix assertion failure in '(unsigned long)(ptr) >> 12'
Since tree.c 1.449 from 2022-05-26.
|
1.15 |
| 29-May-2022 |
rillig | lint: fix wrong errors about sizeof of a bit-field (since 2022-05-26)
|
1.14 |
| 29-May-2022 |
rillig | tests/lint: demonstrate wrong errors 'size/alignment of bit-field'
Since tree.c 1.444 from 2022-05-26, which added range and bit checks for integer expressions, not taking into account that querying for the size of a bit-field type triggers an error message.
|
1.13 |
| 26-May-2022 |
rillig | lint: do not warn about 'uint32_t = uint64_t >> 32'
If all possible values fit into the destination type, there is no possibility of losing accuracy.
Enhances PR 36668.
|
1.12 |
| 26-May-2022 |
rillig | tests/lint: demonstrate wrong warnings about loss of accuracy
|
1.11 |
| 26-May-2022 |
rillig | lint: do not warn about loss in accuracy if the actual value fits
The expression 'any & 0xff' can always be assigned to 'uint8_t' without loss of any value bits. In the same way, '(any & 0xff) << 8' can always be assigned to 'uint16_t'.
Previously, lint warned about these cases. Fix these wrong warnings by tracking the possible values of integer expressions across a single expression.
Fixes PR 36668, so that <sys/endian.h> does not need to be cluttered with useless casts anymore.
|
1.10 |
| 26-May-2022 |
rillig | tests/lint: demonstrate wrong 'may lose accuracy' warning
Reported in PR 36668, fixed in sys/sys/endian.h 1.26 from 2007-07-20, unfixed in sys/sys/endian.h 1.29 from 2014-03-18.
|
1.9 |
| 21-Apr-2022 |
rillig | tests/lint: extend test for lossy integer conversion
|
1.8 |
| 20-Apr-2022 |
rillig | tests/lint: fix test for message 132 to be platform-independent
On i386, the test failed because the warning in line 101 was not generated. This was because size_t on i386 is unsigned int (see arch/i386/targparam.h, SIZEOF_TSPEC). The result of the multiplication had type unsigned int, and message 132 does not trigger for a conversion from unsigned int to signed int because both types have the same size (see check_integer_conversion, portable_size_in_bits).
Change the involved type from size_t (which the original code used) to unsigned long long (which is uint64_t on all platforms supported by lint), so that the warning is generated on all platforms in the same way.
|
1.7 |
| 19-Apr-2022 |
rillig | tests/lint: add test case for integer non-constant expression
Seen in sqlite3.c.
|
1.6 |
| 25-Aug-2021 |
rillig | tests/lint: test conversion from long long to intptr_t on ilp32
Seen in usr.bin/make/var.c:1608.
|
1.5 |
| 06-Apr-2021 |
rillig | lint: fix wrong warning about losing accuracy when converting to _Bool
|
1.4 |
| 06-Apr-2021 |
rillig | tests/lint: demonstrate wrong warning about losing accuracy
|
1.3 |
| 28-Feb-2021 |
rillig | tests/lint: add test for narrowing conversions
Lint can warn about narrowing conversions, it just doesn't do so by default.
The option -a (which is included in the default LINTFLAGS in sys.mk) only reports narrowing conversions from 'long' or larger. To get warnings about all possible narrowing conversions, the option -a has to be given more than once.
PR bin/14531
|
1.2 |
| 21-Feb-2021 |
rillig | lint: force each test to declare the expected diagnostics
By listing the expected diagnostics directly at the code that triggers the diagnostics, it is easier to cross-check whether the diagnostics make sense.
No functional change to lint itself.
|
1.1 |
| 02-Jan-2021 |
rillig | lint: add a test for each message produced by lint1
Having a test for each message ensures that upcoming refactorings don't break the basic functionality. Adding the tests will also discover previously unknown bugs in lint.
The tests ensure that every lint message can actually be triggered, and they demonstrate how to do so. Having a separate file for each test leaves enough space for documenting historical anecdotes, rationale or edge cases, keeping them away from the source code.
The interesting details of this commit are in Makefile and t_integration.sh. All other files are just auto-generated.
When running the tests as part of ATF, they are packed together as a single test case. Conceptually, it would have been better to have each test as a separate test case, but ATF quickly becomes very slow as soon as a test program defines too many test cases, and 50 is already too many. The time complexity is O(n^2), not O(n) as one would expect. It's the same problem as in tests/usr.bin/make, which has over 300 test cases as well.
|
1.40.2.1 |
| 02-Aug-2025 |
perseant | Sync with HEAD
|