Bug 264007 - editors/wxhexeditor: fix build on armv7
Summary: editors/wxhexeditor: fix build on armv7
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: arm Any
: --- Affects Only Me
Assignee: Alexey Dokuchaev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-15 23:04 UTC by Robert Clausecker
Modified: 2022-05-23 09:55 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (danfe)
fuz: merge-quarterly?


Attachments
editors/wxhexeditor: fix build on armv7 (1.29 KB, patch)
2022-05-15 23:04 UTC, Robert Clausecker
fuz: maintainer-approval? (danfe)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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(+)