Summary: | emulators/emu64 : Fails to build on FreeBSD 12.1-RELEASE-p1 powerpc 32 bit: error: narrowing conversion of '-1' from 'int' to 'char' [-Wnarrowing] | ||||||
---|---|---|---|---|---|---|---|
Product: | Ports & Packages | Reporter: | canardo <canardo909> | ||||
Component: | Individual Port(s) | Assignee: | Piotr Kubaj <pkubaj> | ||||
Status: | Closed FIXED | ||||||
Severity: | Affects Only Me | CC: | danfe, jhibbits, pkubaj, powerpc, zirias | ||||
Priority: | --- | Flags: | zirias:
maintainer-feedback+
|
||||
Version: | Latest | ||||||
Hardware: | powerpc | ||||||
OS: | Any | ||||||
Attachments: |
|
Description
canardo
2020-03-31 08:24:23 UTC
Created attachment 212886 [details]
allow narrowing conversions
This looks like the code assumes char is always signed, I will report a bug upstream. Could you try whether you can build with the attached patch and whether the result works correctly?
Upstream issue reported at https://github.com/ThKattanek/emu64/issues/191 (In reply to Felix Palmen from comment #1) I manually patch the Makefile, and build is now successful. Thanks, but the interesting question is whether the emulator actually works as expected :) The patch here only tells the compiler to ignore the problem, so maybe the result isn't behaving correctly. If everything works, I'd keep this patch for now until the next release of emu64 -- otherwise I'll try to import upstream patches. (In reply to Felix Palmen from comment #4) Unfortunately, I've plenty of things to tweak on my powerpc, including xorg stuff. So, I'll not be able to test emu64 anytime soon. Anyways, thanks for the fix, and if I see other problems, I'll report them for sure. Ok I have no idea how to move forward on this. My upstream bug report was closed stating the bug was fixed by changing this one occurence and a promise to look over the full source. The patch I attached does not solve the problem, but maybe "works around" it -- someone on an architecture where `char` is unsigned would have to confirm. As an alternative, I could add a patch with the upstream correction, but again, someone has to confirm that. I don't have a system with unsigned `char` at hand ... Careful, that narrowing on powerpc and arm would yield a value of 255. If it's used as a '< 0' check later, said check will fail. I've run into this a lot when people set the return value of getopt() to a char, and compare to -1, leading to an infinite loop. (In reply to Justin Hibbits from comment #7) Justin, that's exactly the reason I wouldn't consider my patch a solution (and I'm a bit disappointed upstream closed my bug report so soon). Now I'm waiting for feedback :) (In reply to Justin Hibbits from comment #7) > I've run into this a lot when people set the return value of getopt() > to a char, and compare to -1, leading to an infinite loop. I've seen that as well and always wondered why people cannot read the manpage to learn that getopt(3) returns an int, not signed char. *** Bug 245315 has been marked as a duplicate of this bug. *** A commit references this bug: Author: pkubaj Date: Fri Apr 3 12:15:53 UTC 2020 New revision: 530485 URL: https://svnweb.freebsd.org/changeset/ports/530485 Log: emulators/emu64: fix build on PPC and ARM char on PPC and ARM is unsigned. PR: 245200 MFH: 2020Q2 (build fix blanket) Changes: head/emulators/emu64/Makefile head/emulators/emu64/files/ head/emulators/emu64/files/patch-src_c64__class.cpp A commit references this bug: Author: pkubaj Date: Fri Apr 3 12:16:54 UTC 2020 New revision: 530486 URL: https://svnweb.freebsd.org/changeset/ports/530486 Log: MFH: r530485 emulators/emu64: fix build on PPC and ARM char on PPC and ARM is unsigned. PR: 245200 Approved by: portmgr (build fix blanket) Changes: _U branches/2020Q2/ branches/2020Q2/emulators/emu64/Makefile branches/2020Q2/emulators/emu64/files/ |