Clang 6.0.[01]: UNREACHABLE executed
Dimitry Andric
dim at FreeBSD.org
Fri Jul 13 16:45:44 UTC 2018
On 13 Jul 2018, at 14:30, Jonathan Anderson <jonathan at freebsd.org> wrote:
>
> I recently ran into an unreachable statement execution in Clang 6, both
> with v6.0.0 from the llvm60 package and v6.0.1 from HEAD (FreeBSD
> r335799 / LLVM r335540). I don't see this issue in Clang 5 or in the
> version that ships with macOS High Sierra (which they're calling 9.1.0,
> but that's apparently more of a "marketing version" than a true version
> number).
>
> creduce managed to shrink my 2.8 MiB preprocessed sources down to a 604
> B test case:
>
> https://gist.github.com/trombonehero/2da555bd1292be973f9d14c843c56ae5
>
> This isn't a valid C++ file (e.g., it cuts off after `return o` on line
> 23), but I would expect it to cause compiler errors rather than a
> compiler crash. You can see the output from the crash at:
>
> https://gist.github.com/trombonehero/8fce4a8f39ae121a2f9f14b45b0b65a1
>
> Any thoughts?
It doesn't crash for me, at least not with the command line you provided
in the gist. It just gives a large number of parse errors:
$ clang -v
FreeBSD clang version 6.0.0 (tags/RELEASE_600/final 326565) (based on LLVM 6.0.0)
Target: x86_64-unknown-freebsd11.2
Thread model: posix
InstalledDir: /usr/bin
$ clang -cc1 -triple x86_64-portbld-freebsd12.0 -emit-obj -mrelax-all -disable-free -main-file-name test-8fd60b.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -coverage-notes-file /usr/home/jon/Desktop/test-8fd60b.gcno -resource-dir /usr/local/llvm60/lib/clang/6.0.0 -internal-isystem /usr/include/c++/v1 -fdeprecated-macro -fdebug-compilation-dir /usr/home/jon/Desktop -ferror-limit 19 -fmessage-length 80 -fobjc-runtime=gnustep -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o test-8fd60b.o -x c++ foo.cpp
foo.cpp:2:13: error: expected '{' after base class list
struct b : a template <class c>
^
foo.cpp:2:13: error: expected ';' after struct
struct b : a template <class c>
^
;
foo.cpp:4:23: error: expected ';' at end of declaration
__declval() template <class d, class... e>
^
;
foo.cpp:6:36: error: expected ';' at end of declaration
-> decltype(g(h...)) template <class, class d, class... e>
^
;
foo.cpp:8:18: error: no template named 'declval'; did you mean '__declval'?
: decltype(f(declval<d>(), e()...)) template <class d, class... e>
^~~~~~~
__declval
foo.cpp:4:12: note: '__declval' declared here
__declval() template <class d, class... e>
^
foo.cpp:8:40: error: expected '{' after base class list
: decltype(f(declval<d>(), e()...)) template <class d, class... e>
^
foo.cpp:8:40: error: expected ';' after struct
: decltype(f(declval<d>(), e()...)) template <class d, class... e>
^
;
foo.cpp:10:33: error: expected ';' after struct
template<class > struct function
^
;
foo.cpp:13:6: error: unknown class name '_Rp0'; did you mean '_Rp'?
:_Rp0
^~~~
_Rp
foo.cpp:11:16: note: '_Rp' declared here
template<class _Rp, class ...k>
^
foo.cpp:13:10: error: expected '{' after base class list
:_Rp0
^
{
foo.cpp:18:1: error: expected ')'
}
^
foo.cpp:17:13: note: to match this '('
function(d
^
foo.cpp:17:15: error: expected ';' at end of declaration list
function(d
^
;
foo.cpp:18:2: error: expected ';' after struct
}
^
;
foo.cpp:23:17: error: expected '}'
return o
^
foo.cpp:20:1: note: to match this '{'
{
^
foo.cpp:13:6: error: base specifier must name a class
:_Rp0
^~~~
foo.cpp:21:23: note: in instantiation of template class 'function<int (m, m)>'
requested here
function<int(m, m)> n() {
^
foo.cpp:23:16: error: use of undeclared identifier 'o'
return o
^
foo.cpp:23:17: error: expected '}'
return o
^
foo.cpp:22:21: note: to match this '{'
return [](m, m) {
^
foo.cpp:22:12: error: no viable conversion from returned value of type '(lambda
at foo.cpp:22:12)' to function return type 'function<int (m, m)>'
return [](m, m) {
^~~~~~~~~~
foo.cpp:12:8: note: candidate constructor (the implicit copy constructor) not
viable: no known conversion from '(lambda at foo.cpp:22:12)' to 'const
function<int (m, m)> &' for 1st argument
struct function<_Rp(k...)>
^
foo.cpp:12:8: note: candidate constructor (the implicit move constructor) not
viable: no known conversion from '(lambda at foo.cpp:22:12)' to
'function<int (m, m)> &&' for 1st argument
struct function<_Rp(k...)>
^
foo.cpp:17:5: note: candidate template ignored: substitution failure [with d =
(lambda at foo.cpp:22:12)]: no member named 'l' in 'b<i<void, (lambda at
foo.cpp:22:12), m, m> >'
function(d
^
foo.cpp:22:12: note: candidate function
return [](m, m) {
^
foo.cpp:23:17: error: expected '}'
return o
^
foo.cpp:21:27: note: to match this '{'
function<int(m, m)> n() {
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
-Dimitry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 223 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.freebsd.org/pipermail/freebsd-toolchain/attachments/20180713/3c9aa2be/attachment.sig>
More information about the freebsd-toolchain
mailing list