commit:     7ea2cf10a9f26e915cada4262066dacd87513a62
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 28 02:58:13 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jul 28 02:59:31 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7ea2cf10

net-misc/dhcp: avoid undefined/broken runtime behaviour with -O3

-fstrict-aliasing (enabled by -O3) breaks code within dhcp
which violates the no-strict-aliasing rule. So, let's tag on
an option to avoid assuming that rule / avoid the optimisation
which is unsafe here.

Bug: https://bugs.gentoo.org/787935
Signed-off-by: Sam James <sam <AT> gentoo.org>

 net-misc/dhcp/{dhcp-4.4.2_p1.ebuild => dhcp-4.4.2_p1-r1.ebuild} | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net-misc/dhcp/dhcp-4.4.2_p1.ebuild 
b/net-misc/dhcp/dhcp-4.4.2_p1-r1.ebuild
similarity index 98%
rename from net-misc/dhcp/dhcp-4.4.2_p1.ebuild
rename to net-misc/dhcp/dhcp-4.4.2_p1-r1.ebuild
index 4b86781a388..57fd8dd47f4 100644
--- a/net-misc/dhcp/dhcp-4.4.2_p1.ebuild
+++ b/net-misc/dhcp/dhcp-4.4.2_p1-r1.ebuild
@@ -159,6 +159,10 @@ src_configure() {
        #define _PATH_DHCRELAY6_PID  "${r}/dhcrelay6.pid"
        EOF
 
+       # Breaks with -O3 because of reliance on undefined behaviour
+       # bug #787935
+       append-flags -fno-strict-aliasing
+
        # https://bugs.gentoo.org/720806
        if use ppc || use arm || use hppa; then
                append-libs -latomic

Reply via email to