GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
testsuite

Update bit-int tests to use `dg-do run` and fix edge cases.

Four C++ `_BitInt` tests are updated to run rather than just compile, fixing undefined behavior and increment/decrement operator issues.

Four recently added test cases for C++ _BitInt support were mistakenly configured with dg-do compile instead of dg-do run. This change updates them to dg-do run. The commit also addresses issues within these tests: specifically, undefined behavior for signed _BitInt(1) operations like -1 * -1 and -1 % -1, and clarifies the behavior of increment/decrement operators (++, --) for signed _BitInt(1), ensuring they correctly use -1 for operations that would otherwise be problematic.

In Details

This commit modifies four C++ test cases (bitint-96.c through bitint-99.c) related to _BitInt support. The dg-do directive was changed from compile to run, aligning with the intent to test runtime behavior. Several issues within the test cases were fixed to ensure correct runtime execution and alignment with C23/C2Y standards: 1) Signed _BitInt(1) operations like -1 * -1 and -1 % -1 invoke Undefined Behavior (UB) and are now avoided or handled carefully. 2) Pre- and post-increment/decrement operators (++, --) on signed _BitInt(1) were adjusted. Instead of E += 1 or `…

For Context
_BitInt
A C++ extension (part of C++23) that allows defining integer types with arbitrary bit widths, unlike standard fixed-width integer types (e.g., int, long long).
dg-do compile
A test directive in GCC's testsuite that instructs the test runner to only compile the test source file. It verifies that the code compiles without errors but does not execute it.
dg-do run
A test directive in GCC's testsuite that instructs the test runner to compile and then run the test executable. It verifies both compilation and runtime behavior.
Undefined Behavior (UB)
Behavior that occurs when a program executes an operation that is not specified by the C or C++ standard. The results of UB are unpredictable and can vary between compilers, optimization levels, and execution environments.
Filed Under: testsuitec++bitint