Bug 277280 - sysutils/coreutils: fix build with clang 18
Summary: sysutils/coreutils: fix build with clang 18
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: Li-Wen Hsu
URL:
Keywords:
Depends on:
Blocks: 276104
  Show dependency treegraph
 
Reported: 2024-02-24 12:18 UTC by Dimitry Andric
Modified: 2024-02-27 05:02 UTC (History)
2 users (show)

See Also:
jharris: maintainer-feedback+


Attachments
sysutils/coreutils: fix build with clang 18 (2.26 KB, patch)
2024-02-24 12:19 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 2024-02-24 12:18:04 UTC
Clang 18 has become more stringent about use of checked integer
operations, resulting in errors when building sysutils/coreutils:

  lib/posixtm.c:194:15: error: operand argument to checked integer operation must be an integer type other than plain 'char', 'bool', bit-precise, or an enumeration ('bool' invalid)
    194 |           if (ckd_add (&t, t, leapsec))
        |               ^~~~~~~~~~~~~~~~~~~~~~~~
  /usr/include/stdckdint.h:16:37: note: expanded from macro 'ckd_add'
     16 |         (_Bool)__builtin_add_overflow((a), (b), (result))
        |                                            ^~~

The actual issue is the gnulib part of coreutils, which is a separate
GNU project. That project has already identified and fixed it:

https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commit;h=67c298c36f6

Apply the fix to fix the build with clang 18.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2024-02-24 12:19:02 UTC
Created attachment 248717 [details]
sysutils/coreutils: fix build with clang 18
Comment 2 jharris 2024-02-26 05:22:22 UTC
Comment on attachment 248717 [details]
sysutils/coreutils: fix build with clang 18

Approved, thanks!
Comment 3 commit-hook freebsd_committer freebsd_triage 2024-02-27 05:02:31 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=45b681ee03a1caebb65a89e4772a7afdcbacbf42

commit 45b681ee03a1caebb65a89e4772a7afdcbacbf42
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-02-27 05:01:23 +0000
Commit:     Li-Wen Hsu <lwhsu@FreeBSD.org>
CommitDate: 2024-02-27 05:01:23 +0000

    sysutils/coreutils: Fix build with clang 18

    PR:             277280
    Approved by:    maintainer

 sysutils/coreutils/Makefile                        |  1 +
 sysutils/coreutils/files/patch-lib_posixtm.c (new) | 24 ++++++++++++++++++++++
 2 files changed, 25 insertions(+)