3 ms·
Fail to build yes, but I don't know that it can cause failure to run. LTO can identify existing issues as you point out which will cause a failure to build, but
by Kranar 3y ago
Fail to build yes, but I don't know that it can cause failure to run. LTO can identify existing issues as you point out which will cause a failure to build, but if it does build then it would not introduce any new issues that weren't already there nor would any of those issues prevent an application from running.
- chlorion 3y agoThe Gentoo bug tracker has a specific meta-bug for tracking packages that break when built with LTO. The vast majority of the bugs are "failed to compile". It seems like that is the most common issue by far. There are cases where it causes runtime errors as well. Sometimes software is written incorrectly and has "undefined behavior" (you probably know this already). The thing with UB is that it may or may not cause a visible bug at runtime. Sometimes these bugs go unnoticed for a long time. It's really common for code with UB to run without visible errors when compiled without optimizations, but when you compile it with optimizations it segfaults at runtime. LTO is adding another form of optimization and sometimes the transformations the compiler made just happen to cause already existing UB to "surface". This is what I meant by LTO "causing" runtime issues to appear! There are cases of this happening in the Gentoo bug tracker, and in the Linux kernel! https://lwn.net/Articles/512548/ https://lwn.net/Articles/512548/
- Kranar 3y agoThanks for that link, much appreciated.