Hi Joseph,
v8 rejects incomplete types (see range-diff below).
All tests ok (see below).
Have a lovely night!
Alex
alx@devuan:~/src/gnu/gcc/maxof$ git tag maxof8
alx@devuan:~/src/gnu/gcc/maxof$ git log --oneline gnu/master^..maxof8
01f798987a7f (HEAD -> maxof, tag: maxof8) c: Add _Maxof and _Minof
operators
56889bfec25e (gnu/trunk, gnu/master, gnu/HEAD) build: Save/restore
CXXFLAGS for zstd tests
alx@devuan:~/src/gnu/gcc/maxof$ git reset gnu/master --h
HEAD is now at 56889bfec25e build: Save/restore CXXFLAGS for zstd tests
alx@devuan:~/src/gnu/gcc/maxof$ mkdir ../maxof8
alx@devuan:~/src/gnu/gcc/maxof$ cd ../maxof8/
alx@devuan:~/src/gnu/gcc/maxof8$ set -o pipefail
alx@devuan:~/src/gnu/gcc/maxof8$ ../maxof/configure --disable-multilib
--prefix=/opt/local/gnu/gcc/maxof8 |& ts -s | tail -n1; echo $?; make -j24
bootstrap |& ts -s | tail -n1; echo $?; make -j24 check |& ts -s | tail -n1;
echo $?;
00:00:01 config.status: creating Makefile
0
00:22:20 make[1]: Leaving directory '/srv/alx/src/gnu/gcc/maxof8'
0
00:36:00 make[1]: Leaving directory '/srv/alx/src/gnu/gcc/maxof8'
0
alx@devuan:~/src/gnu/gcc/maxof8$ cd ../maxof
alx@devuan:~/src/gnu/gcc/maxof$ git merge --ff-only maxof8
Updating 56889bfec25e..01f798987a7f
Fast-forward
gcc/c-family/c-common.cc | 44 ++++++
gcc/c-family/c-common.def | 6 +
gcc/c-family/c-common.h | 4 +-
gcc/c/c-parser.cc | 67 ++++++++
gcc/c/c-tree.h | 2 +
gcc/c/c-typeck.cc | 54 +++++++
gcc/doc/extend.texi | 20 +++
gcc/testsuite/gcc.dg/maxof-bitint.c | 20 +++
gcc/testsuite/gcc.dg/maxof-bitint575.c | 39 +++++
gcc/testsuite/gcc.dg/maxof-compile.c | 158 +++++++++++++++++++
gcc/testsuite/gcc.dg/maxof-pedantic-errors.c | 5 +
gcc/testsuite/gcc.dg/maxof-pedantic.c | 5 +
12 files changed, 423 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/gcc.dg/maxof-bitint.c
create mode 100644 gcc/testsuite/gcc.dg/maxof-bitint575.c
create mode 100644 gcc/testsuite/gcc.dg/maxof-compile.c
create mode 100644 gcc/testsuite/gcc.dg/maxof-pedantic-errors.c
create mode 100644 gcc/testsuite/gcc.dg/maxof-pedantic.c
alx@devuan:~/src/gnu/gcc/maxof$ cd ../
alx@devuan:~/src/gnu/gcc$ mv maxof8/ maxof8_b4
alx@devuan:~/src/gnu/gcc$ mkdir maxof8
alx@devuan:~/src/gnu/gcc$ cd maxof8
alx@devuan:~/src/gnu/gcc/maxof8$ ../maxof/configure --disable-multilib
--prefix=/opt/local/gnu/gcc/maxof8 |& ts -s | tail -n1; echo $?; make -j24
bootstrap |& ts -s | tail -n1; echo $?; make -j24 check |& ts -s | tail -n1;
echo $?;
00:00:02 config.status: creating Makefile
0
00:22:42 make[1]: Leaving directory '/srv/alx/src/gnu/gcc/maxof8'
0
00:37:49 make[1]: Leaving directory '/srv/alx/src/gnu/gcc/maxof8'
0
alx@devuan:~/src/gnu/gcc/maxof8$ find -type f | grep '\.sum$' | while
read f; do diff -u "../maxof8_b4/$f" "$f"; done;
--- ../maxof8_b4/./x86_64-pc-linux-gnu/libitm/testsuite/libitm.sum
2025-11-25 22:51:46.483462133 +0100
+++ ./x86_64-pc-linux-gnu/libitm/testsuite/libitm.sum 2025-11-26
00:24:52.288490015 +0100
@@ -1,4 +1,4 @@
-Test run by alx on Tue Nov 25 22:51:43 2025
+Test run by alx on Wed Nov 26 00:24:49 2025
Native configuration is x86_64-pc-linux-gnu
=== libitm tests ===
---
../maxof8_b4/./x86_64-pc-linux-gnu/libatomic/testsuite/libatomic.sum2025-11-25
22:51:45.425301643 +0100
+++ ./x86_64-pc-linux-gnu/libatomic/testsuite/libatomic.sum
2025-11-26 00:24:50.838743754 +0100
@@ -1,4 +1,4 @@
-Test run by alx on Tue Nov 25 22:51:43 2025
+Test run by alx on Wed Nov 26 00:24:49 2025
Native configuration is x86_64-pc-linux-gnu
=== libatomic tests ===
--- ../maxof8_b4/./x86_64-pc-linux-gnu/libgomp/testsuite/libgomp.sum
2025-11-25 22:54:07.882454150 +0100
+++ ./x86_64-pc-linux-gnu/libgomp/testsuite/libgomp.sum 2025-11-26
00:27:38.806927517 +0100
@@ -1,4 +1,4 @@
-Test run by alx on Tue Nov 25 22:51:43 2025
+Test run by alx on Wed Nov 26 00:24:49 2025
Native configuration is x86_64-pc-linux-gnu
=== libgomp tests ===
---
../maxof8_b4/./x86_64-pc-linux-gnu/libstdc++-v3/testsuite/libstdc++.sum
2025-11-25 23:27:42.901196031 +0100
+++ ./x86_64-pc-linux-gnu/libstdc++-v3/testsuite/libstdc++.sum
2025-11-26 01:02:37.616457793 +0100
@@ -1,4 +1,4 @@
-Test run by alx on Tue Nov 25 22:51:45 2025
+Test run by alx on Wed Nov 26 00:24:50 2025
Native configuration is x86_64-pc-linux-gnu
=== libstdc++ tests ===
--- ../maxof8_b4/./gcc/testsuite/objc/objc.sum 2025-11-25
22:52:56.125250458 +0100
+++ ./gcc/testsuite/objc/objc.sum 2025-11-26 00:25:44.702857948
+0100
@@ -1,4 +1,4 @@
-Test run by alx on Tue Nov 25 22:51:44 2025
+Test run by alx on Wed Nov 26 00:24:49 2025
Native configuration is x86_64-pc-linux-gnu
=== objc tests ===
--- ../maxof8_b4/./gcc/testsuite/g++/g++.sum 2025-11-25
23:06:59.058718692 +0100
+++ ./gcc/testsuite/g++/g++.sum 2025-11-26 00:41:42.299738506 +0100
@@ -1,4 +1,4 @@
-Test run by alx on Tue Nov 25 22:51:44 2025
+Test run by alx on Wed Nov 26 00:24:49 2025
Native configuration is x86_64-pc-linux-gnu
=== g++ tests ===
--- ../maxof8_b4/./gcc/testsuite/gcc/gcc.sum 2025-11-25
23:11:49.684739466 +0100
+++ ./gcc/testsuite/gcc/gcc.sum 2025-11-26 00:57:17.181603323 +0100
@@ -1,4 +1,4 @@
-Test run by alx on Tue Nov 25 22:51:44 2025
+Test run by alx on Wed Nov 26 00:24:49 2025
Native configuration is x86_64-pc-linux-gnu
=== gcc tests ===
@@ -94161,6 +94161,46 @@
PASS: gcc.dg/max-1.c execution test
PASS: gcc.dg/max.c (test for excess errors)
PASS: gcc.dg/max.c scan-tree-dump-not optimized "MAX_EXPR"
+PASS: gcc.dg/maxof-bitint.c (test for excess errors)
+PASS: gcc.dg/maxof-bitint575.c (test for excess errors)
+PASS: gcc.dg/maxof-bitint575.c execution test
+PASS: gcc.dg/maxof-compile.c (test for errors, line 100)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 101)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 102)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 103)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 109)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 111)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 113)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 114)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 120)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 121)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 122)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 123)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 71)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 73)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 75)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 77)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 79)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 80)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 81)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 82)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 88)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 89)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 98)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 99)
+PASS: gcc.dg/maxof-compile.c (test for excess errors)
+PASS: gcc.dg/maxof-compile.c syntax error at line 110 (test for
errors, line 109)
+PASS: gcc.dg/maxof-compile.c syntax error at line 112 (test for
errors, line 111)
+PASS: gcc.dg/maxof-compile.c syntax error at line 72 (test for errors,
line 71)
+PASS: gcc.dg/maxof-compile.c syntax error at line 74 (test for errors,
line 73)
+PASS: gcc.dg/maxof-compile.c syntax error at line 76 (test for errors,
line 75)
+PASS: gcc.dg/maxof-compile.c syntax error at line 78 (test for errors,
line 77)
+PASS: gcc.dg/maxof-pedantic-errors.c (test for errors, line 4)
+PASS: gcc.dg/maxof-pedantic-errors.c (test for errors, line 5)
+PASS: gcc.dg/maxof-pedantic-errors.c (test for excess errors)
+PASS: gcc.dg/maxof-pedantic.c (test for warnings, line 4)
+PASS: gcc.dg/maxof-pedantic.c (test for warnings, line 5)
+PASS: gcc.dg/maxof-pedantic.c (test for excess errors)
PASS: gcc.dg/memchr-2.c (test for excess errors)
PASS: gcc.dg/memchr-2.c scan-tree-dump-not optimized "abort"
PASS: gcc.dg/memchr-2.c scan-tree-dump-not optimized "memcmp \\("
@@ -221261,7 +221301,7 @@
=== gcc Summary ===
-# of expected passes 215189
+# of expected passes 215229
# of unexpected failures 528
# of unexpected successes 8
# of expected failures 1484
--- ../maxof8_b4/./gcc/testsuite/gfortran/gfortran.sum 2025-11-25
22:59:38.557371477 +0100
+++ ./gcc/testsuite/gfortran/gfortran.sum 2025-11-26
00:44:26.578104750 +0100
@@ -1,4 +1,4 @@
-Test run by alx on Tue Nov 25 22:51:44 2025
+Test run by alx on Wed Nov 26 00:24:49 2025
Native configuration is x86_64-pc-linux-gnu
=== gfortran tests ===
Alejandro Colomar (1):
c: Add _Maxof and _Minof operators
gcc/c-family/c-common.cc | 44 ++++++
gcc/c-family/c-common.def | 6 +
gcc/c-family/c-common.h | 4 +-
gcc/c/c-parser.cc | 67 ++++++++
gcc/c/c-tree.h | 2 +
gcc/c/c-typeck.cc | 54 +++++++
gcc/doc/extend.texi | 20 +++
gcc/testsuite/gcc.dg/maxof-bitint.c | 20 +++
gcc/testsuite/gcc.dg/maxof-bitint575.c | 39 +++++
gcc/testsuite/gcc.dg/maxof-compile.c | 158 +++++++++++++++++++
gcc/testsuite/gcc.dg/maxof-pedantic-errors.c | 5 +
gcc/testsuite/gcc.dg/maxof-pedantic.c | 5 +
12 files changed, 423 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/gcc.dg/maxof-bitint.c
create mode 100644 gcc/testsuite/gcc.dg/maxof-bitint575.c
create mode 100644 gcc/testsuite/gcc.dg/maxof-compile.c
create mode 100644 gcc/testsuite/gcc.dg/maxof-pedantic-errors.c
create mode 100644 gcc/testsuite/gcc.dg/maxof-pedantic.c
Range-diff against v7:
1: 5f49e800bf91 ! 1: 01f798987a7f c: Add _Maxof and _Minof operators
@@ gcc/c-family/c-common.cc: c_countof_type (location_t loc, tree type)
+ error_at (loc, "invalid application of %<_Maxof%> to type %qT",
type);
+ return error_mark_node;
+ }
++ if (!COMPLETE_TYPE_P (type))
++ {
++ error_at (loc, "invalid application of %<_Maxof%> to incomplete
type %qT",
++ type);
++ return error_mark_node;
++ }
+
+ return TYPE_MAX_VALUE (type);
+}
@@ gcc/c-family/c-common.cc: c_countof_type (location_t loc, tree type)
+ error_at (loc, "invalid application of %<_Minof%> to type %qT",
type);
+ return error_mark_node;
+ }
++ if (!COMPLETE_TYPE_P (type))
++ {
++ error_at (loc, "invalid application of %<_Minof%> to incomplete
type %qT",
++ type);
++ return error_mark_node;
++ }
+
+ return TYPE_MIN_VALUE (type);
+}
@@ gcc/testsuite/gcc.dg/maxof-compile.c (new)
+}
+
+void
++incomplete (void)
++{
++ _Maxof (enum e); /* { dg-error "to incomplete type" } */
++ _Minof (enum e); /* { dg-error "to incomplete type" } */
++}
++
++void
+non_int (void)
+{
+ struct s {int x;};
--
2.51.0