Date: Fri, 13 Jul 2018 18:45:38 +0200 From: Dimitry Andric <dim@FreeBSD.org> To: Jonathan Anderson <jonathan@freebsd.org> Cc: freebsd-toolchain@freebsd.org Subject: Re: Clang 6.0.[01]: UNREACHABLE executed Message-ID: <51FD8F40-A5B8-4292-ACD4-A0105E428311@FreeBSD.org> In-Reply-To: <95573ED5-49CD-4BC6-863D-849C1CAA774D@FreeBSD.org> References: <95573ED5-49CD-4BC6-863D-849C1CAA774D@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--Apple-Mail=_16AB790B-1DE4-4E11-A041-73E0BDB3F471 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 13 Jul 2018, at 14:30, Jonathan Anderson <jonathan@freebsd.org> = wrote: >=20 > 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). >=20 > creduce managed to shrink my 2.8 MiB preprocessed sources down to a = 604 > B test case: >=20 > https://gist.github.com/trombonehero/2da555bd1292be973f9d14c843c56ae5 >=20 > 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: >=20 > https://gist.github.com/trombonehero/8fce4a8f39ae121a2f9f14b45b0b65a1 >=20 > 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=3Dgdb -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=3Dgnustep = -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 =3D (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=3D] 20 errors generated. -Dimitry --Apple-Mail=_16AB790B-1DE4-4E11-A041-73E0BDB3F471 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCW0jXMgAKCRCwXqMKLiCW o4iZAKD8TJQPmWQm6B8BA35ZkJWUYdXCAACfcrKUNsSzAI4LRSorAQNpQMk8sfU= =Gtm7 -----END PGP SIGNATURE----- --Apple-Mail=_16AB790B-1DE4-4E11-A041-73E0BDB3F471--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?51FD8F40-A5B8-4292-ACD4-A0105E428311>