lewissbaker / cppcoro

A library of C++ coroutine abstractions for the coroutines TS
MIT License
3.41k stars 468 forks source link

Segmentation faults when building using apple clang 11.0.3 #154

Closed voertler closed 4 years ago

voertler commented 4 years ago

When trying to build with latest clang 11.0.3 I get several segmentation faults and even out of memory errors:

clang: /usr/bin/clang
llvm-ar: /usr/bin/ar
Building with /Users/thilo/Documents/coseda/cppcoro/config.cake - Variant(release='optimised', platform='darwin', architecture='x64', compiler='clang')
Building with /Users/thilo/Documents/coseda/cppcoro/config.cake - Variant(release='debug', platform='darwin', architecture='x64', compiler='clang')
Compiling test/recursive_generator_tests.cpp
Compiling test/async_generator_tests.cpp
Compiling test/recursive_generator_tests.cpp
test/recursive_generator_tests.cpp:156:2: warning: control reaches end of non-void lambda [-Wreturn-type]
        };
        ^
test/recursive_generator_tests.cpp:160:11: note: in instantiation of function template specialization '_DOCTEST_ANON_FUNC_16()::(anonymous class)::operator()<(lambda at test/recursive_generator_tests.cpp:148:11)>' requested here
                return f(n, f);
                        ^
test/recursive_generator_tests.cpp:237:2: warning: control may reach end of non-void lambda [-Wreturn-type]
        };
        ^
test/recursive_generator_tests.cpp:239:14: note: in instantiation of function template specialization '_DOCTEST_ANON_FUNC_20()::(anonymous class)::operator()<(lambda at test/recursive_generator_tests.cpp:219:11) &>' requested here
        auto gen = f(0, f);
                    ^
test/recursive_generator_tests.cpp:297:2: warning: control may reach end of non-void lambda [-Wreturn-type]
        };
        ^
test/recursive_generator_tests.cpp:299:14: note: in instantiation of function template specialization '_DOCTEST_ANON_FUNC_22()::(anonymous class)::operator()<(lambda at test/recursive_generator_tests.cpp:252:11) &>' requested here
        auto gen = f(1, f);
                    ^
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin19.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
clang: note: diagnostic msg: PLEASE submit a bug report to http://developer.apple.com/bugreporter/ and include the crash backtrace, preprocessed source, and associated run script.
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /Users/thilo/Documents/coseda/cppcoro/recursive_generator_tests-ca7e05.cpp
clang: note: diagnostic msg: /Users/thilo/Documents/coseda/cppcoro/recursive_generator_tests-ca7e05.sh
clang: note: diagnostic msg: Crash backtrace is located in
clang: note: diagnostic msg: /Users/thilo/Library/Logs/DiagnosticReports/clang_<YYYY-MM-DD-HHMMSS>_<hostname>.crash
clang: note: diagnostic msg: (choose the .crash file that corresponds to your crash)
clang: note: diagnostic msg: 

********************
/usr/bin/clang: failed with exit code 254
test/recursive_generator_tests.cpp:156:2: warning: control reaches end of non-void lambda [-Wreturn-type]
        };
        ^
test/recursive_generator_tests.cpp:160:11: note: in instantiation of function template specialization '_DOCTEST_ANON_FUNC_16()::(anonymous class)::operator()<(lambda at test/recursive_generator_tests.cpp:148:11)>' requested here
                return f(n, f);
                        ^
test/recursive_generator_tests.cpp:237:2: warning: control may reach end of non-void lambda [-Wreturn-type]
        };
        ^
test/recursive_generator_tests.cpp:239:14: note: in instantiation of function template specialization '_DOCTEST_ANON_FUNC_20()::(anonymous class)::operator()<(lambda at test/recursive_generator_tests.cpp:219:11) &>' requested here
        auto gen = f(0, f);
                    ^
test/recursive_generator_tests.cpp:297:2: warning: control may reach end of non-void lambda [-Wreturn-type]
        };
        ^
test/recursive_generator_tests.cpp:299:14: note: in instantiation of function template specialization '_DOCTEST_ANON_FUNC_22()::(anonymous class)::operator()<(lambda at test/recursive_generator_tests.cpp:252:11) &>' requested here
        auto gen = f(1, f);
                    ^
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin19.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
clang: note: diagnostic msg: PLEASE submit a bug report to http://developer.apple.com/bugreporter/ and include the crash backtrace, preprocessed source, and associated run script.
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /Users/thilo/Documents/coseda/cppcoro/recursive_generator_tests-2a2f2d.cpp
clang: note: diagnostic msg: /Users/thilo/Documents/coseda/cppcoro/recursive_generator_tests-2a2f2d.sh
clang: note: diagnostic msg: Crash backtrace is located in
clang: note: diagnostic msg: /Users/thilo/Library/Logs/DiagnosticReports/clang_<YYYY-MM-DD-HHMMSS>_<hostname>.crash
clang: note: diagnostic msg: (choose the .crash file that corresponds to your crash)
clang: note: diagnostic msg: 

********************
/usr/bin/clang: failed with exit code 254
^C/usr/bin/clang: failed with exit code -2
Build failed with 3 errors.
The following targets failed to build:
- build/darwin_x64_clang11.0.3_debug/test/obj/recursive_generator_tests.o
- build/darwin_x64_clang11.0.3_optimised/test/obj/recursive_generator_tests.o
- build/darwin_x64_clang11.0.3_optimised/test/obj/async_generator_tests.o
lewissbaker commented 4 years ago

This was a known issue with Clang 9.0, on which I believe AppleClang 11 was based.

It has been fixed in upstream Clang 10 and so will hopefully be incorporated into the next release of AppleClang.

See https://bugs.llvm.org/show_bug.cgi?id=43492