Bug 264007

Summary: editors/wxhexeditor: fix build on armv7
Product: Ports & Packages Reporter: Robert Clausecker <fuz>
Component: Individual Port(s)Assignee: Alexey Dokuchaev <danfe>
Status: Closed FIXED    
Severity: Affects Only Me CC: danfe
Priority: --- Flags: bugzilla: maintainer-feedback? (danfe)
fuz: merge-quarterly?
Version: Latest   
Hardware: arm   
OS: Any   
Attachments:
Description Flags
editors/wxhexeditor: fix build on armv7 fuz: maintainer-approval? (danfe)

Description Robert Clausecker freebsd_committer freebsd_triage 2022-05-15 23:04:36 UTC
Created attachment 233947 [details]
editors/wxhexeditor: fix build on armv7

char is an unsigned type on armv7, causing an expression to have
type unsigned int where this is not expected.  Insert a cast to
int to make the code work.

Please MFH this build fix if possible.
Tested with Poudriere on armv7 i386 amd64 FreeBSD 13.
Comment 1 Alexey Dokuchaev freebsd_committer freebsd_triage 2022-05-23 09:32:40 UTC
(In reply to Robert Clausecker from comment #0)
> Insert a cast to int to make the code work.
While it would work, I don't think this is not the right fix (type casts are rarely so).  At a quick glance, mixing `char' and `wchar_t' operands in ternary expression apparently causes the compiler to fallback to primitive types: the result is `int' on x86 which accidentally works because there is operator+=(int) overload while there is no `unsigned int' one, which is actually what `wchar_t' is typedef'ed from on ARM.  Correct fix would be to not compare apples and oranges, i.e. do not mix different types in ternary expression.
Comment 2 commit-hook freebsd_committer freebsd_triage 2022-05-23 09:55:19 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=43f9f2c86ae89d8285ff6fcd441b0395a292d0c1

commit 43f9f2c86ae89d8285ff6fcd441b0395a292d0c1
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2022-05-23 09:52:24 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2022-05-23 09:52:24 +0000

    editors/wxhexeditor: fix the port's build on ARM

    Mixing different types in ternary expression is a bad idea.

    PR:     264007

 .../files/patch-src_HexEditorCtrl_wxHexCtrl_wxHexCtrl.cpp        | 9 +++++++++
 1 file changed, 9 insertions(+)