]> git.ipfire.org Git - thirdparty/gcc.git/commit
c: Add tests for some C2Y removals of undefined behavior
authorJoseph Myers <josmyers@redhat.com>
Wed, 10 Sep 2025 20:48:05 +0000 (20:48 +0000)
committerJoseph Myers <josmyers@redhat.com>
Wed, 10 Sep 2025 20:48:05 +0000 (20:48 +0000)
commit3723edc87ce47bb43577842e1faf9b6dcc3b8410
tree31476dec608ec6bcf92a7b8497d25f4c32be2735
parent912159d2b5429c3126756b56723dd4f32dd56bdd
c: Add tests for some C2Y removals of undefined behavior

C2Y removes various instances of undefined behavior, typically making
them either constraint violations or implementation-defined.

In many but not all such cases, GCC's existing behavior is compatible
with the C2Y changes.  For an initial batch of such cases, add
explicit tests for how GCC behaves in C2Y mode; more such cases will
need tests added in future patches, and there are also some such
changes that will need changes to how GCC behaves, not just new tests.
(Some of the individual examples in these tests may have been
constraint violations even before C2Y.)

Tested for x86_64-pc-linux-gnu.

* gcc.dg/c2y-function-qual-1.c, gcc.dg/c2y-incomplete-1.c,
gcc.dg/c2y-inline-1.c, gcc.dg/c2y-pointer-1.c,
gcc.dg/c2y-register-array-1.c, gcc.dg/c2y-storage-class-1.c,
gcc.dg/c2y-struct-empty-1.c: New tests.
gcc/testsuite/gcc.dg/c2y-function-qual-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c2y-incomplete-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c2y-inline-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c2y-pointer-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c2y-register-array-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c2y-storage-class-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c2y-struct-empty-1.c [new file with mode: 0644]