[Bug 293168] devel/gcc-arm-embedded: fix build with clang 21

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 13 Feb 2026 21:28:19 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=293168

            Bug ID: 293168
           Summary: devel/gcc-arm-embedded: fix build with clang 21
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: lev@FreeBSD.org
          Reporter: dim@FreeBSD.org
             Flags: maintainer-feedback?(lev@FreeBSD.org)
          Assignee: lev@FreeBSD.org

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.