Bug 271045 - devel/gdb: fix build with clang 16
Summary: devel/gdb: fix build with clang 16
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Luca Pizzamiglio
URL:
Keywords:
Depends on:
Blocks: 271047
  Show dependency treegraph
 
Reported: 2023-04-24 15:29 UTC by Dimitry Andric
Modified: 2023-05-07 18:40 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (pizzamig)


Attachments
devel/gdb: fix build with clang 16 (9.36 KB, patch)
2023-04-24 15:30 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2023-04-24 15:29:43 UTC
Clang 16 has a new error about integer values being outside the valid
range for enum types, which shows up when building gdb:

  In file included from /wrkdirs/usr/ports/devel/gdb/work-py39/gdb-13.1/gdb/x86-fbsd-nat.c:20:
  In file included from /wrkdirs/usr/ports/devel/gdb/work-py39/gdb-13.1/gdb/defs.h:65:
  /wrkdirs/usr/ports/devel/gdb/work-py39/gdb-13.1/gdb/../gdbsupport/enum-flags.h:95:52: error: integer value -1 is outside the valid range of values [0, 15] for this enumeration type [-Wenum-constexpr-conversion]
      integer_for_size<sizeof (T), static_cast<bool>(T (-1) < T (0))>::type
                                                     ^
  In file included from /wrkdirs/usr/ports/devel/gdb/work-py39/gdb-13.1/gdb/x86-bsd-nat.c:20:
  In file included from /wrkdirs/usr/ports/devel/gdb/work-py39/gdb-13.1/gdb/defs.h:65:
  /wrkdirs/usr/ports/devel/gdb/work-py39/gdb-13.1/gdb/../gdbsupport/enum-flags.h:95:52: error: integer value -1 is outside the valid range of values [0, 15] for this enumeration type [-Wenum-constexpr-conversion]
      integer_for_size<sizeof (T), static_cast<bool>(T (-1) < T (0))>::type
                                                     ^
  In file included from /wrkdirs/usr/ports/devel/gdb/work-py39/gdb-13.1/gdb/x86-nat.c:20:
  In file included from /wrkdirs/usr/ports/devel/gdb/work-py39/gdb-13.1/gdb/defs.h:65:
  /wrkdirs/usr/ports/devel/gdb/work-py39/gdb-13.1/gdb/../gdbsupport/enum-flags.h:95:52: error: integer value -1 is outside the valid range of values [0, 15] for this enumeration type [-Wenum-constexpr-conversion]
      integer_for_size<sizeof (T), static_cast<bool>(T (-1) < T (0))>::type
                                                     ^
  In file included from /wrkdirs/usr/ports/devel/gdb/work-py39/gdb-13.1/gdb/windows-tdep.c:18:
  In file included from /wrkdirs/usr/ports/devel/gdb/work-py39/gdb-13.1/gdb/defs.h:65:
  /wrkdirs/usr/ports/devel/gdb/work-py39/gdb-13.1/gdb/../gdbsupport/enum-flags.h:95:52: error: integer value -1 is outside the valid range of values [0, 15] for this enumeration type [-Wenum-constexpr-conversion]
      integer_for_size<sizeof (T), static_cast<bool>(T (-1) < T (0))>::type
                                                     ^

Upstream already noticed this, and committed
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ae61525fcf4 as
a workaround, so add this as an additional patch, until gdb 13.2 is
released.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2023-04-24 15:30:41 UTC
Created attachment 241700 [details]
devel/gdb: fix build with clang 16
Comment 2 commit-hook freebsd_committer freebsd_triage 2023-05-07 18:40:13 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9e765fe77dabf9e37b052510072b0f41a2ab3ae6

commit 9e765fe77dabf9e37b052510072b0f41a2ab3ae6
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-04-24 15:00:37 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2023-05-07 18:38:47 +0000

    devel/gdb: fix build with clang 16

    Clang 16 has a new error about integer values being outside the valid
    range for enum types, which shows up when building gdb:

      In file included from /wrkdirs/usr/ports/devel/gdb/work-py39/gdb-13.1/gdb/x86-fbsd-nat.c:20:
      In file included from /wrkdirs/usr/ports/devel/gdb/work-py39/gdb-13.1/gdb/defs.h:65:
      /wrkdirs/usr/ports/devel/gdb/work-py39/gdb-13.1/gdb/../gdbsupport/enum-flags.h:95:52: error: integer value -1 is outside the valid range of values [0, 15] for this enumeration type [-Wenum-constexpr-conversion]
          integer_for_size<sizeof (T), static_cast<bool>(T (-1) < T (0))>::type
                                                         ^
      In file included from /wrkdirs/usr/ports/devel/gdb/work-py39/gdb-13.1/gdb/x86-bsd-nat.c:20:
      In file included from /wrkdirs/usr/ports/devel/gdb/work-py39/gdb-13.1/gdb/defs.h:65:
      /wrkdirs/usr/ports/devel/gdb/work-py39/gdb-13.1/gdb/../gdbsupport/enum-flags.h:95:52: error: integer value -1 is outside the valid range of values [0, 15] for this enumeration type [-Wenum-constexpr-conversion]
          integer_for_size<sizeof (T), static_cast<bool>(T (-1) < T (0))>::type
                                                         ^
      In file included from /wrkdirs/usr/ports/devel/gdb/work-py39/gdb-13.1/gdb/x86-nat.c:20:
      In file included from /wrkdirs/usr/ports/devel/gdb/work-py39/gdb-13.1/gdb/defs.h:65:
      /wrkdirs/usr/ports/devel/gdb/work-py39/gdb-13.1/gdb/../gdbsupport/enum-flags.h:95:52: error: integer value -1 is outside the valid range of values [0, 15] for this enumeration type [-Wenum-constexpr-conversion]
          integer_for_size<sizeof (T), static_cast<bool>(T (-1) < T (0))>::type
                                                         ^
      In file included from /wrkdirs/usr/ports/devel/gdb/work-py39/gdb-13.1/gdb/windows-tdep.c:18:
      In file included from /wrkdirs/usr/ports/devel/gdb/work-py39/gdb-13.1/gdb/defs.h:65:
      /wrkdirs/usr/ports/devel/gdb/work-py39/gdb-13.1/gdb/../gdbsupport/enum-flags.h:95:52: error: integer value -1 is outside the valid range of values [0, 15] for this enumeration type [-Wenum-constexpr-conversion]
          integer_for_size<sizeof (T), static_cast<bool>(T (-1) < T (0))>::type
                                                         ^

    Upstream already noticed this, and committed
    https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ae61525fcf4 as
    a workaround, so add this as an additional patch, until gdb 13.2 is
    released.

    PR:             271045
    Approved by:    maintainer timeout (2 weeks)
    MFH:            2023Q2

 devel/gdb/Makefile                       |   3 +-
 devel/gdb/files/commit-ae61525fcf4 (new) | 128 +++++++++++++++++++++++++++++++
 2 files changed, 130 insertions(+), 1 deletion(-)