Created attachment 889771 [details] emerge-info.txt Compiling dev-lang/perl with -ftrapv causes a miscompile. It compiles however it prevents a few other packages from installing. For example automake will fail on packages like sys-libs/zlib and will give an error of illegal instruction. However, if we compile dev-lang/perl with -fwrapv instead of -ftrapv it compiles again and it allows these other packages to complete the automake phase without the illegal instructions.
Created attachment 889772 [details] sys-libs/zlib build.log This is the build log of sys-apps/zlib when you compile dev-lang/perl with -ftrapv.
Created attachment 889773 [details] sys-libs/zlib automake.out This is the automake.out of sys-libs/zlib when you compile dev-lang/perl with -ftrapv.
It seems this wasn't a miscompile but -ftrapv behaving as it should be as its trapping something hence the illegal instruction and also due to dmesg identifying the "trap". So it could be that there is a bug in either automake or libperl.
(In reply to Tohka from comment #3) > It seems this wasn't a miscompile but -ftrapv behaving as it should be as > its trapping something hence the illegal instruction and also due to dmesg > identifying the "trap". So it could be that there is a bug in either > automake or libperl. A backtrace will be needed.
(In reply to Sam James from comment #4) > (In reply to Tohka from comment #3) > > It seems this wasn't a miscompile but -ftrapv behaving as it should be as > > its trapping something hence the illegal instruction and also due to dmesg > > identifying the "trap". So it could be that there is a bug in either > > automake or libperl. > > A backtrace will be needed. Thank you it will be quite some time until I am able to do so but I have kept a note of that.
While doing something else, I noticed that Perl is built with `-fwrapv` which requests, as an extension, defined semantics for signed integer overflow. Using -ftrapv probably overrides that and is arguably invalid. But we could maybe filter it out in the ebuild.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9b1dea036a1fba87623a59be76dc588595f9c65a commit 9b1dea036a1fba87623a59be76dc588595f9c65a Author: Sam James <sam@gentoo.org> AuthorDate: 2024-05-11 02:11:13 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-05-11 02:11:13 +0000 dev-lang/perl: filter out -ftrapv People shouldn't really pass -ftrapv in global flags anyway but let's filter out -ftrapv in Perl specifically given we know it requires -fwrapv semantics and it even passes that during the build, but -ftrapv if set by the user will be appended and take precdence... Bug: https://bugs.gentoo.org/928904 Signed-off-by: Sam James <sam@gentoo.org> dev-lang/perl/perl-5.38.2-r5.ebuild | 3 +++ 1 file changed, 3 insertions(+)