With clang 21 devel/gcc-arm-embedded fails to build, with errors similar to: /wrkdirs/usr/ports/devel/gcc-arm-embedded/work-default/src/binutils-gdb/binutils/readelf.c:23278:37: error: pointer comparison always evaluates to false [-Werror,-Wtautological-compare] 23278 | || inote.namedata + inote.namesz < inote.namedata) | ^ and later many instances of: In file included from <built-in>:1: In file included from /wrkdirs/usr/ports/devel/gcc-arm-embedded/work-default/src/binutils-gdb--gdb/gdb/defs.h:63: /wrkdirs/usr/ports/devel/gcc-arm-embedded/work-default/src/binutils-gdb--gdb/gdb/../gdbsupport/enum-flags.h:97:34: error: non-type template argument is not a constant expression 97 | integer_for_size<sizeof (T), static_cast<bool>(T (-1) < T (0))>::type | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /wrkdirs/usr/ports/devel/gcc-arm-embedded/work-default/src/binutils-gdb--gdb/gdb/../gdbsupport/enum-flags.h:134:20: note: in instantiation of template class 'enum_underlying_type<ui_out_flag>' requested here 134 | typedef typename enum_underlying_type<enum_type>::type underlying_type; | ^ /wrkdirs/usr/ports/devel/gcc-arm-embedded/work-default/src/binutils-gdb--gdb/gdb/ui-out.h:385:16: note: in instantiation of template class 'enum_flags<ui_out_flag>' requested here 385 | ui_out_flags m_flags; | ^ /wrkdirs/usr/ports/devel/gcc-arm-embedded/work-default/src/binutils-gdb--gdb/gdb/../gdbsupport/enum-flags.h:97:52: note: integer value -1 is outside the valid range of values [0, 15] for the enumeration type 'ui_out_flag' 97 | integer_for_size<sizeof (T), static_cast<bool>(T (-1) < T (0))>::type | ^ The readelf error is due to it assuming pointer wrapping, which is undefined behavior. This can be worked around by casting the pointers to uintptr_t, or by adding -fno-strict-overflow to the CFLAGS (but if you are messing with the CFLAGS, you might as well disable -Werror). The enum errors are because it is no longer allowed to cast integer values to enum values, if they fall outside of the valid range. Upstream fixed this in <https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=4a0b2cb7210>, which applies with a small bit of editing.
Created attachment 268037 [details] devel/gcc-arm-embedded: fix build with clang 21
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=37ed2bf6371b0b273013a710ee32f6addf768a62 commit 37ed2bf6371b0b273013a710ee32f6addf768a62 Author: Dimitry Andric <dim@FreeBSD.org> AuthorDate: 2026-02-13 21:28:34 +0000 Commit: Dimitry Andric <dim@FreeBSD.org> CommitDate: 2026-03-12 23:46:18 +0000 devel/gcc-arm-embedded: fix build with clang 21 With clang 21 devel/gcc-arm-embedded fails to build, with errors similar to: /wrkdirs/usr/ports/devel/gcc-arm-embedded/work-default/src/binutils-gdb/binutils/readelf.c:23278:37: error: pointer comparison always evaluates to false [-Werror,-Wtautological-compare] 23278 | || inote.namedata + inote.namesz < inote.namedata) | ^ and later many instances of: In file included from <built-in>:1: In file included from /wrkdirs/usr/ports/devel/gcc-arm-embedded/work-default/src/binutils-gdb--gdb/gdb/defs.h:63: /wrkdirs/usr/ports/devel/gcc-arm-embedded/work-default/src/binutils-gdb--gdb/gdb/../gdbsupport/enum-flags.h:97:34: error: non-type template argument is not a constant expression 97 | integer_for_size<sizeof (T), static_cast<bool>(T (-1) < T (0))>::type | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /wrkdirs/usr/ports/devel/gcc-arm-embedded/work-default/src/binutils-gdb--gdb/gdb/../gdbsupport/enum-flags.h:134:20: note: in instantiation of template class 'enum_underlying_type<ui_out_flag>' requested here 134 | typedef typename enum_underlying_type<enum_type>::type underlying_type; | ^ /wrkdirs/usr/ports/devel/gcc-arm-embedded/work-default/src/binutils-gdb--gdb/gdb/ui-out.h:385:16: note: in instantiation of template class 'enum_flags<ui_out_flag>' requested here 385 | ui_out_flags m_flags; | ^ /wrkdirs/usr/ports/devel/gcc-arm-embedded/work-default/src/binutils-gdb--gdb/gdb/../gdbsupport/enum-flags.h:97:52: note: integer value -1 is outside the valid range of values [0, 15] for the enumeration type 'ui_out_flag' 97 | integer_for_size<sizeof (T), static_cast<bool>(T (-1) < T (0))>::type | ^ The readelf error is due to it assuming pointer wrapping, which is undefined behavior. This can be worked around by casting the pointers to uintptr_t, or by adding -fno-strict-overflow to the CFLAGS (but if you are messing with the CFLAGS, you might as well disable -Werror). The enum errors are because it is no longer allowed to cast integer values to enum values, if they fall outside of the valid range. Upstream fixed this in <https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=4a0b2cb7210>, which applies with a small bit of editing. PR: 293168 Approved by: maintainer timeout (2 weeks) MFH: 2026Q1 ...-gdb_gdb_unittests_enum-flags-selftests.c (new) | 36 +++++ ...binutils-gdb--gdb_gdbsupport_enum-flags.h (new) | 156 +++++++++++++++++++++ ...h-binutils-gdb--gdb_include_diagnostics.h (new) | 25 ++++ .../patch-binutils-gdb_binutils_readelf.c (new) | 11 ++ ...-gdb_gdb_unittests_enum-flags-selftests.c (new) | 36 +++++ ...atch-binutils-gdb_gdbsupport_enum-flags.h (new) | 156 +++++++++++++++++++++ .../patch-binutils-gdb_include_diagnostics.h (new) | 25 ++++ 7 files changed, 445 insertions(+)
A commit in branch 2026Q1 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=d5268682b2a3d8350d275a629951ad975bcdd20e commit d5268682b2a3d8350d275a629951ad975bcdd20e Author: Dimitry Andric <dim@FreeBSD.org> AuthorDate: 2026-02-13 21:28:34 +0000 Commit: Dimitry Andric <dim@FreeBSD.org> CommitDate: 2026-03-12 23:46:41 +0000 devel/gcc-arm-embedded: fix build with clang 21 With clang 21 devel/gcc-arm-embedded fails to build, with errors similar to: /wrkdirs/usr/ports/devel/gcc-arm-embedded/work-default/src/binutils-gdb/binutils/readelf.c:23278:37: error: pointer comparison always evaluates to false [-Werror,-Wtautological-compare] 23278 | || inote.namedata + inote.namesz < inote.namedata) | ^ and later many instances of: In file included from <built-in>:1: In file included from /wrkdirs/usr/ports/devel/gcc-arm-embedded/work-default/src/binutils-gdb--gdb/gdb/defs.h:63: /wrkdirs/usr/ports/devel/gcc-arm-embedded/work-default/src/binutils-gdb--gdb/gdb/../gdbsupport/enum-flags.h:97:34: error: non-type template argument is not a constant expression 97 | integer_for_size<sizeof (T), static_cast<bool>(T (-1) < T (0))>::type | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /wrkdirs/usr/ports/devel/gcc-arm-embedded/work-default/src/binutils-gdb--gdb/gdb/../gdbsupport/enum-flags.h:134:20: note: in instantiation of template class 'enum_underlying_type<ui_out_flag>' requested here 134 | typedef typename enum_underlying_type<enum_type>::type underlying_type; | ^ /wrkdirs/usr/ports/devel/gcc-arm-embedded/work-default/src/binutils-gdb--gdb/gdb/ui-out.h:385:16: note: in instantiation of template class 'enum_flags<ui_out_flag>' requested here 385 | ui_out_flags m_flags; | ^ /wrkdirs/usr/ports/devel/gcc-arm-embedded/work-default/src/binutils-gdb--gdb/gdb/../gdbsupport/enum-flags.h:97:52: note: integer value -1 is outside the valid range of values [0, 15] for the enumeration type 'ui_out_flag' 97 | integer_for_size<sizeof (T), static_cast<bool>(T (-1) < T (0))>::type | ^ The readelf error is due to it assuming pointer wrapping, which is undefined behavior. This can be worked around by casting the pointers to uintptr_t, or by adding -fno-strict-overflow to the CFLAGS (but if you are messing with the CFLAGS, you might as well disable -Werror). The enum errors are because it is no longer allowed to cast integer values to enum values, if they fall outside of the valid range. Upstream fixed this in <https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=4a0b2cb7210>, which applies with a small bit of editing. PR: 293168 Approved by: maintainer timeout (2 weeks) MFH: 2026Q1 (cherry picked from commit 37ed2bf6371b0b273013a710ee32f6addf768a62) ...-gdb_gdb_unittests_enum-flags-selftests.c (new) | 36 +++++ ...binutils-gdb--gdb_gdbsupport_enum-flags.h (new) | 156 +++++++++++++++++++++ ...h-binutils-gdb--gdb_include_diagnostics.h (new) | 25 ++++ .../patch-binutils-gdb_binutils_readelf.c (new) | 11 ++ ...-gdb_gdb_unittests_enum-flags-selftests.c (new) | 36 +++++ ...atch-binutils-gdb_gdbsupport_enum-flags.h (new) | 156 +++++++++++++++++++++ .../patch-binutils-gdb_include_diagnostics.h (new) | 25 ++++ 7 files changed, 445 insertions(+)