Module Name: src Committed By: rillig Date: Tue May 4 05:32:52 UTC 2021
Modified Files: src/tests/usr.bin/xlint/lint1: gcc_bit_field_types.c Log Message: tests/lint: demonstrate assertion failure "len == size_in_bits(INT)" Seen on sparc64 in hdtoa.c:341 since sparc64 is one of the platforms that has 128-bit long double and defines struct ieee_ext.ext_frach:48 based on uint64_t, which is a GCC extension. Plain C99 only allows _Bool, signed int and unsigned int as base type for bit-fields. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/gcc_bit_field_types.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/usr.bin/xlint/lint1/gcc_bit_field_types.c diff -u src/tests/usr.bin/xlint/lint1/gcc_bit_field_types.c:1.3 src/tests/usr.bin/xlint/lint1/gcc_bit_field_types.c:1.4 --- src/tests/usr.bin/xlint/lint1/gcc_bit_field_types.c:1.3 Sun May 2 22:07:49 2021 +++ src/tests/usr.bin/xlint/lint1/gcc_bit_field_types.c Tue May 4 05:32:52 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: gcc_bit_field_types.c,v 1.3 2021/05/02 22:07:49 rillig Exp $ */ +/* $NetBSD: gcc_bit_field_types.c,v 1.4 2021/05/04 05:32:52 rillig Exp $ */ # 3 "gcc_bit_field_types.c" /* @@ -19,3 +19,19 @@ struct example { unsigned long long unsigned_long_long_flag: 1; double double_flag: 1; /* expect: illegal bit-field type 'double' */ }; + +struct large_bit_field { + unsigned long long member: 48; +}; + +unsigned long long +promote_large_bit_field(struct large_bit_field lbf) +{ + /* + * Before tree.c 1.281 from 2021-05-04: + * lint: assertion "len == size_in_bits(INT)" failed + * in promote at tree.c:1698 + */ + /* TODO: remove the cast since it hides an assertion failure */ + return (unsigned long long)lbf.member & 0xf; +}