Bug 271537 - net/libfabric: fix build with clang 16 on i386
Summary: net/libfabric: fix build with clang 16 on i386
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: Dimitry Andric
URL:
Keywords:
Depends on:
Blocks: 271047
  Show dependency treegraph
 
Reported: 2023-05-20 18:30 UTC by Dimitry Andric
Modified: 2023-05-20 20:10 UTC (History)
0 users

See Also:
yuri: maintainer-feedback+


Attachments
net/libfabric: fix build with clang 16 on i386 (7.44 KB, patch)
2023-05-20 18:31 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-05-20 18:30:58 UTC
Clang 16 has a new error about incompatible function types, which shows
up when building net/libfabric (on i386):

  prov/hook/src/hook_domain.c:124:12: error: incompatible function pointer types passing 'ssize_t (struct fid_ep *, size_t)' (aka 'int (struct fid_ep *, unsigned int)') to parameter of type 'ssize_t (*)(struct fid_ep *, uint64_t)' (aka 'int (*)(struct fid_ep *, unsigned long long)') [-Wincompatible-function-pointer-types]
                                                       hook_credit_handler);
                                                       ^~~~~~~~~~~~~~~~~~~
  prov/hook/src/hook_domain.c:150:17: error: incompatible function pointer types initializing 'void (*)(struct fid_ep *, uint64_t)' (aka 'void (*)(struct fid_ep *, unsigned long long)') with an expression of type 'void (struct fid_ep *, size_t)' (aka 'void (struct fid_ep *, unsigned int)') [-Wincompatible-function-pointer-types]
          .add_credits = hook_add_credits,
                         ^~~~~~~~~~~~~~~~
  prov/hook/src/hook_domain.c:152:22: error: incompatible function pointer types initializing 'void (*)(struct fid_domain *, ssize_t (*)(struct fid_ep *, uint64_t))' (aka 'void (*)(struct fid_domain *, int (*)(struct fid_ep *, unsigned long long))') with an expression of type 'void (struct fid_domain *, ssize_t (*)(struct fid_ep *, size_t))' (aka 'void (struct fid_domain *, int (*)(struct fid_ep *, unsigned int))') [-Wincompatible-function-pointer-types]
          .set_send_handler = hook_set_send_handler,
                              ^~~~~~~~~~~~~~~~~~~~~

The problem is that the 'credits' parameter used in these functions is
size_t in some cases, but uint64_t in other cases. On LP64 architectures
this does not result in any errors, but on e.g. i386 you get the above.

Make the 'credits' parameter uint64_t everywhere to fix this issue.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2023-05-20 18:31:21 UTC
Created attachment 242298 [details]
net/libfabric: fix build with clang 16 on i386
Comment 2 Yuri Victorovich freebsd_committer freebsd_triage 2023-05-20 19:40:59 UTC
Approved.
Comment 3 commit-hook freebsd_committer freebsd_triage 2023-05-20 20:04:40 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=26bc5ce8ba1e9cfbb40d77530b99307a98eac10d

commit 26bc5ce8ba1e9cfbb40d77530b99307a98eac10d
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-05-20 18:27:11 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2023-05-20 20:02:45 +0000

    net/libfabric: fix build with clang 16

    Clang 16 has a new error about incompatible function types, which shows
    up when building net/libfabric (on i386):

      prov/hook/src/hook_domain.c:124:12: error: incompatible function pointer types passing 'ssize_t (struct fid_ep *, size_t)' (aka 'int (struct fid_ep *, unsigned int)') to parameter of type 'ssize_t (*)(struct fid_ep *, uint64_t)' (aka 'int (*)(struct fid_ep *, unsigned long long)') [-Wincompatible-function-pointer-types]
                                                           hook_credit_handler);
                                                           ^~~~~~~~~~~~~~~~~~~
      prov/hook/src/hook_domain.c:150:17: error: incompatible function pointer types initializing 'void (*)(struct fid_ep *, uint64_t)' (aka 'void (*)(struct fid_ep *, unsigned long long)') with an expression of type 'void (struct fid_ep *, size_t)' (aka 'void (struct fid_ep *, unsigned int)') [-Wincompatible-function-pointer-types]
              .add_credits = hook_add_credits,
                             ^~~~~~~~~~~~~~~~
      prov/hook/src/hook_domain.c:152:22: error: incompatible function pointer types initializing 'void (*)(struct fid_domain *, ssize_t (*)(struct fid_ep *, uint64_t))' (aka 'void (*)(struct fid_domain *, int (*)(struct fid_ep *, unsigned long long))') with an expression of type 'void (struct fid_domain *, ssize_t (*)(struct fid_ep *, size_t))' (aka 'void (struct fid_domain *, int (*)(struct fid_ep *, unsigned int))') [-Wincompatible-function-pointer-types]
              .set_send_handler = hook_set_send_handler,
                                  ^~~~~~~~~~~~~~~~~~~~~

    The problem is that the 'credits' parameter used in these functions is
    size_t in some cases, but uint64_t in other cases. On LP64 architectures
    this does not result in any errors, but on e.g. i386 you get the above.

    Make the 'credits' parameter uint64_t everywhere to fix this issue.

    PR:             271537
    Approved by:    yuri (maintainer)
    MFH:            2023Q2

 net/libfabric/Makefile                             |  1 +
 .../files/patch-include_ofi__hook.h (new)          | 11 ++++++++
 .../files/patch-prov_hook_src_hook__domain.c (new) | 29 ++++++++++++++++++++++
 .../files/patch-prov_rxm_src_rxm__domain.c (new)   | 25 +++++++++++++++++++
 .../files/patch-prov_verbs_src_fi__verbs.h (new)   | 11 ++++++++
 .../patch-prov_verbs_src_verbs__domain.c (new)     | 16 ++++++++++++
 .../files/patch-prov_verbs_src_verbs__ep.c (new)   | 11 ++++++++
 7 files changed, 104 insertions(+)