On Sun, Nov 10, 2024 at 11:32:54AM GMT, Alejandro Colomar wrote: > Hi! > > Your favourite operator with the most controversial name comes back with > support for [0], thanks to Martin Uecker. In movie theaters, and > probably in GCC 16. > > For those who fight in a side in the name wars, here's a reminder of a > fair survey (by JeanHeyd) which might end the war with a peace treaty: > <https://thephd.dev/the-big-array-size-survey-for-c>. > > > Changes since v17: > > - Rebase after the recent patches added by Martin, which made [0][n] > and [*][n] have distinct representation, and thus allowed making > __countof__(int [0][n]) be a constant expression. > > - Make __countof__(int [0][n]) a constant expression. Thanks, Martin! > Update the testsuite to reflect this too, of course. > > - Rename small function in the testsuite (automatic => completed). > > See the range-diff below for the exact differences since v17. > > > Martin, this worked out of the box. I'll reply to this email with the > regression-test session results; they all passed. [0] works like a > charm.
Regression tests say ok: alx@debian:~/src/gnu/gcc/len$ git tag len18 alx@debian:~/src/gnu/gcc/len$ git log --oneline gnu/master^..len18 f8336e4646a (HEAD -> len, tag: len18) c: Add __countof__ operator 82100c813c3 contrib/: Add support for Cc: and Link: tags 114abf075c1 (gnu/trunk, gnu/master) c: minor fixes related to arrays of unspecified size alx@debian:~/src/gnu/gcc/len$ git reset gnu/master --h HEAD is now at 114abf075c1 c: minor fixes related to arrays of unspecified size alx@debian:~/src/gnu/gcc/len$ mkdir ../len18 alx@debian:~/src/gnu/gcc/len$ cd ../len18 alx@debian:~/src/gnu/gcc/len18$ /bin/time ../len/configure --disable-multilib --prefix=/opt/local/gnu/gcc/countof18 |& ts -s | ovr -n 3; echo $? 00:00:04 config.status: creating Makefile 00:00:04 2.74user 1.51system 0:03.82elapsed 111%CPU (0avgtext+0avgdata 26588maxresident)k 00:00:04 91760inputs+8000outputs (275major+276906minor)pagefaults 0swaps 0 alx@debian:~/src/gnu/gcc/len18$ /bin/time make -j24 bootstrap |& ts -s | ovr -n 3; echo $? 00:20:34 make[1]: Leaving directory '/home/alx/src/gnu/gcc/len18' 00:20:34 14990.13user 437.20system 20:34.11elapsed 1250%CPU (0avgtext+0avgdata 1558756maxresident)k 00:20:34 1555888inputs+30810152outputs (19314major+119705948minor)pagefaults 0swaps 0 alx@debian:~/src/gnu/gcc/len18$ /bin/time make check |& ts -s | ovr -n 3; echo $? 06:54:58 make[1]: Leaving directory '/home/alx/src/gnu/gcc/len18' 06:54:58 21595.28user 3410.52system 6:54:57elapsed 100%CPU (0avgtext+0avgdata 2327800maxresident)k 06:54:58 728800inputs+21757040outputs (2918major+1010304995minor)pagefaults 0swaps 0 alx@debian:~/src/gnu/gcc/len18$ cd ../len alx@debian:~/src/gnu/gcc/len$ git merge --ff-only len18 Updating 114abf075c1..f8336e4646a Fast-forward contrib/gcc-changelog/git_commit.py | 5 +- gcc/c-family/c-common.cc | 26 +++++ gcc/c-family/c-common.def | 3 + gcc/c-family/c-common.h | 2 + gcc/c/c-decl.cc | 22 +++- gcc/c/c-parser.cc | 62 +++++++--- gcc/c/c-tree.h | 4 + gcc/c/c-typeck.cc | 115 ++++++++++++++++++- gcc/doc/extend.texi | 30 +++++ gcc/testsuite/gcc.dg/countof-compile.c | 125 +++++++++++++++++++++ gcc/testsuite/gcc.dg/countof-vla.c | 45 ++++++++ gcc/testsuite/gcc.dg/countof.c | 150 +++++++++++++++++++++++++ 12 files changed, 564 insertions(+), 25 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/countof-compile.c create mode 100644 gcc/testsuite/gcc.dg/countof-vla.c create mode 100644 gcc/testsuite/gcc.dg/countof.c alx@debian:~/src/gnu/gcc/len$ cd .. alx@debian:~/src/gnu/gcc$ mv len18 len18_b4 alx@debian:~/src/gnu/gcc$ mkdir len18 alx@debian:~/src/gnu/gcc$ cd len18 alx@debian:~/src/gnu/gcc/len18$ /bin/time ../len/configure --disable-multilib --prefix=/opt/local/gnu/gcc/countof18 |& ts -s | ovr -n 3; echo $? 00:00:03 config.status: creating Makefile 00:00:04 2.91user 1.55system 0:03.89elapsed 114%CPU (0avgtext+0avgdata 26556maxresident)k 00:00:04 0inputs+8000outputs (0major+280759minor)pagefaults 0swaps 0 alx@debian:~/src/gnu/gcc/len18$ /bin/time make -j24 bootstrap |& ts -s | ovr -n 3; echo $? 00:20:36 make[1]: Leaving directory '/home/alx/src/gnu/gcc/len18' 00:20:36 15194.00user 433.58system 20:35.69elapsed 1264%CPU (0avgtext+0avgdata 1565564maxresident)k 00:20:36 3688inputs+30817928outputs (168major+119818585minor)pagefaults 0swaps 0 alx@debian:~/src/gnu/gcc/len18$ /bin/time make check |& ts -s | ovr -n 3; echo $? 06:55:35 make[1]: Leaving directory '/home/alx/src/gnu/gcc/len18' 06:55:35 21613.87user 3477.00system 6:55:35elapsed 100%CPU (0avgtext+0avgdata 2327144maxresident)k 06:55:35 304inputs+21758376outputs (2758major+1012005133minor)pagefaults 0swaps 0 alx@debian:~/src/gnu/gcc/len18$ find -type f | grep '\.sum$' | while read f; do diff -u ../len18_b4/$f $f; done --- ../len18_b4/./gcc/testsuite/gcc/gcc.sum 2024-11-09 14:30:51.671373959 +0100 +++ ./gcc/testsuite/gcc/gcc.sum 2024-11-09 22:23:17.996906200 +0100 @@ -1,4 +1,4 @@ -Test run by alx on Sat Nov 9 12:44:52 2024 +Test run by alx on Sat Nov 9 20:35:13 2024 Native configuration is x86_64-pc-linux-gnu === gcc tests === @@ -78457,6 +78457,29 @@ PASS: gcc.dg/conv-2.c (test for excess errors) PASS: gcc.dg/conv-3.c (test for excess errors) PASS: gcc.dg/conv-3.c execution test +PASS: gcc.dg/countof-compile.c (test for errors, line 24) +PASS: gcc.dg/countof-compile.c (test for errors, line 28) +PASS: gcc.dg/countof-compile.c (test for errors, line 39) +PASS: gcc.dg/countof-compile.c (test for errors, line 47) +PASS: gcc.dg/countof-compile.c (test for errors, line 62) +PASS: gcc.dg/countof-compile.c (test for errors, line 65) +PASS: gcc.dg/countof-compile.c (test for errors, line 68) +PASS: gcc.dg/countof-compile.c (test for errors, line 80) +PASS: gcc.dg/countof-compile.c (test for errors, line 81) +PASS: gcc.dg/countof-compile.c (test for errors, line 82) +PASS: gcc.dg/countof-compile.c (test for errors, line 83) +PASS: gcc.dg/countof-compile.c (test for errors, line 84) +PASS: gcc.dg/countof-compile.c (test for errors, line 85) +PASS: gcc.dg/countof-compile.c (test for errors, line 86) +PASS: gcc.dg/countof-compile.c (test for errors, line 87) +PASS: gcc.dg/countof-compile.c (test for errors, line 88) +PASS: gcc.dg/countof-compile.c (test for warnings, line 92) +PASS: gcc.dg/countof-compile.c (test for errors, line 112) +PASS: gcc.dg/countof-compile.c (test for errors, line 121) +PASS: gcc.dg/countof-compile.c (test for excess errors) +PASS: gcc.dg/countof-vla.c (test for excess errors) +PASS: gcc.dg/countof.c (test for excess errors) +PASS: gcc.dg/countof.c execution test PASS: gcc.dg/cr-decimal-dig-1.c (test for excess errors) PASS: gcc.dg/cr-decimal-dig-2.c (test for excess errors) PASS: gcc.dg/cr-decimal-dig-3.c (test for excess errors) @@ -209690,7 +209713,7 @@ === gcc Summary === -# of expected passes 204581 +# of expected passes 204604 # of unexpected failures 35 # of unexpected successes 2 # of expected failures 1462 --- ../len18_b4/./gcc/testsuite/gfortran/gfortran.sum 2024-11-09 16:10:40.810086221 +0100 +++ ./gcc/testsuite/gfortran/gfortran.sum 2024-11-10 00:02:42.892974019 +0100 @@ -1,4 +1,4 @@ -Test run by alx on Sat Nov 9 15:35:18 2024 +Test run by alx on Sat Nov 9 23:27:28 2024 Native configuration is x86_64-pc-linux-gnu === gfortran tests === --- ../len18_b4/./gcc/testsuite/objc/objc.sum 2024-11-09 16:11:47.262652513 +0100 +++ ./gcc/testsuite/objc/objc.sum 2024-11-10 00:03:49.645533215 +0100 @@ -1,4 +1,4 @@ -Test run by alx on Sat Nov 9 16:10:41 2024 +Test run by alx on Sun Nov 10 00:02:43 2024 Native configuration is x86_64-pc-linux-gnu === objc tests === --- ../len18_b4/./gcc/testsuite/g++/g++.sum 2024-11-09 15:35:17.635848988 +0100 +++ ./gcc/testsuite/g++/g++.sum 2024-11-09 23:27:28.295344138 +0100 @@ -1,4 +1,4 @@ -Test run by alx on Sat Nov 9 14:30:52 2024 +Test run by alx on Sat Nov 9 22:23:18 2024 Native configuration is x86_64-pc-linux-gnu === g++ tests === --- ../len18_b4/./x86_64-pc-linux-gnu/libitm/testsuite/libitm.sum 2024-11-09 19:39:41.748431581 +0100 +++ ./x86_64-pc-linux-gnu/libitm/testsuite/libitm.sum 2024-11-10 03:30:41.385976347 +0100 @@ -1,4 +1,4 @@ -Test run by alx on Sat Nov 9 19:39:39 2024 +Test run by alx on Sun Nov 10 03:30:39 2024 Native configuration is x86_64-pc-linux-gnu === libitm tests === --- ../len18_b4/./x86_64-pc-linux-gnu/libgomp/testsuite/libgomp.sum 2024-11-09 19:39:39.228410199 +0100 +++ ./x86_64-pc-linux-gnu/libgomp/testsuite/libgomp.sum 2024-11-10 03:30:38.841955150 +0100 @@ -1,4 +1,4 @@ -Test run by alx on Sat Nov 9 19:25:22 2024 +Test run by alx on Sun Nov 10 03:16:28 2024 Native configuration is x86_64-pc-linux-gnu === libgomp tests === --- ../len18_b4/./x86_64-pc-linux-gnu/libatomic/testsuite/libatomic.sum 2024-11-09 19:39:44.084451402 +0100 +++ ./x86_64-pc-linux-gnu/libatomic/testsuite/libatomic.sum 2024-11-10 03:30:43.569994545 +0100 @@ -1,4 +1,4 @@ -Test run by alx on Sat Nov 9 19:39:42 2024 +Test run by alx on Sun Nov 10 03:30:41 2024 Native configuration is x86_64-pc-linux-gnu === libatomic tests === --- ../len18_b4/./x86_64-pc-linux-gnu/libstdc++-v3/testsuite/libstdc++.sum 2024-11-09 19:24:59.576997714 +0100 +++ ./x86_64-pc-linux-gnu/libstdc++-v3/testsuite/libstdc++.sum 2024-11-10 03:16:05.646750347 +0100 @@ -1,4 +1,4 @@ -Test run by alx on Sat Nov 9 16:12:16 2024 +Test run by alx on Sun Nov 10 00:04:18 2024 Native configuration is x86_64-pc-linux-gnu === libstdc++ tests === -- <https://www.alejandro-colomar.es/>
signature.asc
Description: PGP signature