Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 922590

Summary: dev-lang/ldc2-1.35.0-r1::dlang fails to build (lto): gen/asm-x86.h:3869:64: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
Product: Gentoo Linux Reporter: Rafael Kitover <rkitover>
Component: OverlaysAssignee: Marco Leise <Marco.Leise>
Status: UNCONFIRMED ---    
Severity: normal CC: a.horodniceanu, rkitover
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: build log
emerge --info

Description Rafael Kitover 2024-01-21 05:09:53 UTC
Fails to build with recommended LTO flags according to:

https://wiki.gentoo.org/wiki/LTO

Reproducible: Always
Comment 1 Rafael Kitover 2024-01-21 05:10:21 UTC
Created attachment 882714 [details]
build log
Comment 2 Rafael Kitover 2024-01-21 05:10:57 UTC
Created attachment 882715 [details]
emerge --info
Comment 3 Rafael Kitover 2024-01-21 05:11:40 UTC
> emerge -pqv =dev-lang/ldc2-1.35.0-r1
[ebuild  N    ] dev-lang/ldc2-1.35.0-r1  USE="-dmd-2_101 -dmd-2_102 -dmd-2_103 -dmd-2_104 -dmd-2_105 dmd-2_106 -gdc-12 -gdc-13 -ldc2-1_32 -ldc2-1_33 -ldc2-1_34 -ldc2-1_35 -ldc2-1_36 static-libs" ABI_X86="-32 (64) (-x32)"
Comment 4 Andrei Horodniceanu 2024-01-21 11:11:24 UTC
Without LTO flags, for a successful emerge you get:
````
QA: other
QA Notice: Package triggers severe warnings which indicate that it
           may exhibit random runtime failures.
/var/tmp/portage/dev-lang/ldc2-1.36.0/work/ldc-1.36.0-src/gen/abi/x86-64.cpp:191:45: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
/var/tmp/portage/dev-lang/ldc2-1.36.0/work/ldc-1.36.0-src/gen/asm-x86.h:3869:64: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
/var/tmp/portage/dev-lang/ldc2-1.36.0/work/ldc-1.36.0-src/gen/asm-x86.h:3872:64: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
/var/tmp/portage/dev-lang/ldc2-1.36.0/work/ldc-1.36.0-src/gen/asm-x86.h:3869:64: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
/var/tmp/portage/dev-lang/ldc2-1.36.0/work/ldc-1.36.0-src/gen/asm-x86.h:3872:64: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
Please do not file a Gentoo bug and instead report the above QA
issues directly to the upstream developers of this software.
Homepage: https://github.com/ldc-developers/ldc
```

This has been a problem for a while but I haven't investigated it as I didn't want to look into the LTO capabilities of dev-lang/ldc2.

If you do want LTO enabled you should probably enabled it in LDCFLAGS as well so do LDCFLAGS="-O4 -release -flto=thin" but I didn't test it at all and I don't know what will break or if it will work.

You should report this upstream at https://github.com/ldc-developers/ldc. If you can't or aren't interested I've made an issue in the dlang overlay https://github.com/gentoo/dlang/issues/129 which I will eventually look into. I'm caught up with exams at the moment so I won't be of much help for a few weeks.
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-01-21 11:18:48 UTC
(In reply to Horodniceanu Andrei from comment #4)
> 
> This has been a problem for a while but I haven't investigated it as I
> didn't want to look into the LTO capabilities of dev-lang/ldc2.
> 

Need to pass -fno-strict-aliasing anyway then (and report upstream ofc). It's still a problem either way.
Comment 6 Larry the Git Cow gentoo-dev 2024-01-24 20:25:13 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/user/dlang.git/commit/?id=585480e834a5740f4d3086b867b7232cb1c1bf63

commit 585480e834a5740f4d3086b867b7232cb1c1bf63
Author:     Horodniceanu Andrei <a.horodniceanu@proton.me>
AuthorDate: 2024-01-24 18:37:44 +0000
Commit:     Horodniceanu Andrei <a.horodniceanu@proton.me>
CommitDate: 2024-01-24 18:38:50 +0000

    dev-lang/ldc2: backport strict-aliasing fixes
    
    Bug: https://bugs.gentoo.org/922590
    Signed-off-by: Horodniceanu Andrei <a.horodniceanu@proton.me>

 dev-lang/ldc2/ldc2-1.32.2-r1.ebuild                | 79 +++++++++++++++++++++
 dev-lang/ldc2/ldc2-1.33.0-r1.ebuild                | 79 +++++++++++++++++++++
 dev-lang/ldc2/ldc2-1.34.0-r1.ebuild                | 80 ++++++++++++++++++++++
 ...ldc2-1.35.0-r1.ebuild => ldc2-1.35.0-r2.ebuild} |  4 +-
 4 files changed, 241 insertions(+), 1 deletion(-)

https://gitweb.gentoo.org/repo/user/dlang.git/commit/?id=ce1aa5d8fdb60dcd1c08cc1d35cf77fc2998959b

commit ce1aa5d8fdb60dcd1c08cc1d35cf77fc2998959b
Author:     Horodniceanu Andrei <a.horodniceanu@proton.me>
AuthorDate: 2024-01-24 18:21:55 +0000
Commit:     Horodniceanu Andrei <a.horodniceanu@proton.me>
CommitDate: 2024-01-24 18:38:46 +0000

    dev-lang/ldc2: pass -fno-strict-aliasing
    
    Bug: https://bugs.gentoo.org/show_bug.cgi?id=922590
    Signed-off-by: Horodniceanu Andrei <a.horodniceanu@proton.me>

 dev-lang/ldc2/{ldc2-1.36.0.ebuild => ldc2-1.36.0-r1.ebuild} | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Comment 7 Andrei Horodniceanu 2024-01-24 20:27:31 UTC
Fixed upstream in https://github.com/ldc-developers/ldc/commit/b1f976888e5ad3ca45c83aa99e9d8c06a2f72589
Comment 8 Andrei Horodniceanu 2024-01-24 20:28:51 UTC
Sam, are these the proper changes?