From: Iain Buclaw Date: Sat, 26 Jan 2019 21:07:15 +0000 (+0000) Subject: Fix ICE when handling void initialized manifest constants. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e4e13e261060dde55de4f7135fe09a816a51f929;p=gcc.git Fix ICE when handling void initialized manifest constants. gcc/d/ChangeLog: 2019-01-26 Iain Buclaw PR d/89042 * decl.cc (DeclVisitor::visit(VarDeclaration)): Don't assert if handling a void initialized manifest constant. gcc/testsuite/ChangeLog: 2019-01-26 Iain Buclaw PR d/89042 * gdc.dg/pr89042a.d: New test. * gdc.dg/pr89042b.d: New test. From-SVN: r268304 --- diff --git a/gcc/d/ChangeLog b/gcc/d/ChangeLog index 7014b215f5a..151fe1c6ab1 100644 --- a/gcc/d/ChangeLog +++ b/gcc/d/ChangeLog @@ -1,3 +1,9 @@ +2019-01-26 Iain Buclaw + + PR d/89042 + * decl.cc (DeclVisitor::visit(VarDeclaration)): Don't assert if + handling a void initialized manifest constant. + 2019-01-21 Iain Buclaw * d-frontend.cc (Compiler::paintAsType): Update for new signature. diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc index aba1abbf891..7edfe523d3e 100644 --- a/gcc/d/decl.cc +++ b/gcc/d/decl.cc @@ -593,8 +593,11 @@ public: if (d->isInstantiated ()) return; + /* Cannot make an expression out of a void initializer. */ + if (!d->_init || d->_init->isVoidInitializer ()) + return; + tree decl = get_symbol_decl (d); - gcc_assert (d->_init && !d->_init->isVoidInitializer ()); Expression *ie = initializerToExpression (d->_init); /* CONST_DECL was initially intended for enumerals and may be used for diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d6f6e0f266f..f1e89d56010 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-01-26 Iain Buclaw + + PR d/89042 + * gdc.dg/pr89042a.d: New test. + * gdc.dg/pr89042b.d: New test. + 2019-01-26 Harald Anlauf PR fortran/57553 diff --git a/gcc/testsuite/gdc.dg/pr89042a.d b/gcc/testsuite/gdc.dg/pr89042a.d new file mode 100644 index 00000000000..42e05aee181 --- /dev/null +++ b/gcc/testsuite/gdc.dg/pr89042a.d @@ -0,0 +1,2 @@ +// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89042 +enum void[] a = void; diff --git a/gcc/testsuite/gdc.dg/pr89042b.d b/gcc/testsuite/gdc.dg/pr89042b.d new file mode 100644 index 00000000000..73a1c6eff2d --- /dev/null +++ b/gcc/testsuite/gdc.dg/pr89042b.d @@ -0,0 +1,2 @@ +// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89042 +enum void[2] a = void;