aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2019-01-26 21:07:15 +0000
committerIain Buclaw <ibuclaw@gcc.gnu.org>2019-01-26 21:07:15 +0000
commite4e13e261060dde55de4f7135fe09a816a51f929 (patch)
tree654e8d21aa880ad2e9e2a90e6f88b811d0a39c67 /gcc
parent3a55c8e248e82f0d64ed8acb85183fefe53cfc0a (diff)
downloadgcc-e4e13e261060dde55de4f7135fe09a816a51f929.zip
gcc-e4e13e261060dde55de4f7135fe09a816a51f929.tar.gz
gcc-e4e13e261060dde55de4f7135fe09a816a51f929.tar.bz2
Fix ICE when handling void initialized manifest constants.
gcc/d/ChangeLog: 2019-01-26 Iain Buclaw <ibuclaw@gdcproject.org> 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 <ibuclaw@gdcproject.org> PR d/89042 * gdc.dg/pr89042a.d: New test. * gdc.dg/pr89042b.d: New test. From-SVN: r268304
Diffstat (limited to 'gcc')
-rw-r--r--gcc/d/ChangeLog6
-rw-r--r--gcc/d/decl.cc5
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gdc.dg/pr89042a.d2
-rw-r--r--gcc/testsuite/gdc.dg/pr89042b.d2
5 files changed, 20 insertions, 1 deletions
diff --git a/gcc/d/ChangeLog b/gcc/d/ChangeLog
index 7014b21..151fe1c 100644
--- a/gcc/d/ChangeLog
+++ b/gcc/d/ChangeLog
@@ -1,3 +1,9 @@
+2019-01-26 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ PR d/89042
+ * decl.cc (DeclVisitor::visit(VarDeclaration)): Don't assert if
+ handling a void initialized manifest constant.
+
2019-01-21 Iain Buclaw <ibuclaw@gdcproject.org>
* d-frontend.cc (Compiler::paintAsType): Update for new signature.
diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc
index aba1abb..7edfe52 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 d6f6e0f..f1e89d5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2019-01-26 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ PR d/89042
+ * gdc.dg/pr89042a.d: New test.
+ * gdc.dg/pr89042b.d: New test.
+
2019-01-26 Harald Anlauf <anlauf@gmx.de>
PR fortran/57553
diff --git a/gcc/testsuite/gdc.dg/pr89042a.d b/gcc/testsuite/gdc.dg/pr89042a.d
new file mode 100644
index 0000000..42e05ae
--- /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 0000000..73a1c6e
--- /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;