[Bug lto/91988] New: Inlining fails with LTO enabled
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91988 Bug ID: 91988 Summary: Inlining fails with LTO enabled Product: gcc Version: 8.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: gcc-bugzilla at tobias dot goedderz.info CC: marxin at gcc dot gnu.org Target Milestone: --- Inlining fails with LTO when there is an argument with a destructor. This seems unintentional to me, given the following behaviour. Given the following example files: ==> main.cpp <== #include "lib.h" int main() { return fun(A{}); } ==> lib.h <== #ifndef LIB_H #define LIB_H class A { public: ~A() {} }; __attribute__((always_inline)) int fun(A); #endif // LIB_H ==> lib.cpp <== #include "lib.h" __attribute__((always_inline)) int fun(A a) { return 0; } and compiling with /usr/bin/g++-8 -g -Wall -pedantic -O3 -std=c++14 -flto -c lib.cpp /usr/bin/g++-8 -g -Wall -pedantic -O3 -std=c++14 -flto -c main.cpp /usr/bin/g++-8 -g -Wall -pedantic -O3 -std=c++14 -flto -o main-gcc main.o lib.o fails with error: inlining failed in call to always_inline ‘fun(A)’: mismatched arguments in the last step. Removing "__attribute__((always_inline))" and inspecting the deassembled output confirms that the function isn't inlined. If the body is moved to the header file (and the "inline" specifier added), the function is inlined. If the destructor of "A" is removed, or changed to "~A() = default", the function is inlined. If the argument to "fun" is changed to a "const&", the function is inlined.
[Bug lto/91988] Inlining fails with LTO enabled
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91988 --- Comment #1 from Tobias Gödderz --- Happens with GCC 9.1.0 as well.
[Bug c++/91387] New: Segfault using -flto
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91387 Bug ID: 91387 Summary: Segfault using -flto Product: gcc Version: 8.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gcc-bugzilla at tobias dot goedderz.info Target Milestone: --- Created attachment 46684 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46684&action=edit Preprocessed source code Hi, I'm experiencing g++ segfaults during compilation. This is a "minimal" example in terms of command line parameters, using the preprocessed source (which is not minimal): > $ /usr/bin/g++-8 -std=c++14 -O2 -flto -fno-devirtualize -c > ShapeContainerTest.ii > during IPA pass: cp > /home/tobias/Documents/ArangoDB/arangodb/arangodb/tests/Geo/ShapeContainerTest.cpp: > In function ‘arangodb::velocypack::Builder::openCompoundValue(unsigned char) > [clone .part.119]’: > /home/tobias/Documents/ArangoDB/arangodb/arangodb/tests/Geo/ShapeContainerTest.cpp:427:2: > internal compiler error: Segmentation fault > }} > ^ > Please submit a full bug report, > with preprocessed source if appropriate. > See for instructions. This is with g++ (Ubuntu 8.3.0-6ubuntu1~18.04.1) 8.3.0. I have two other files exhibiting a similar error, if it's of interest. The one referenced above is attached. Please tell me if and how I can be of further help. Best regards, Tobias