Hi,

This patch turns an ICE into a sorry() error.  Not marking the PR as
fixed, as an implementation of ModuleInfo code generation should be
worked out when named section support is not present on the target.

Bootstrapped and regression tested the D testsuite on
x86_64-linux-gnu, with further checking done on pdp11-aout
cross-compiler target to verify the sorry() path is executed and the
ICE is no longer present.

Committed to trunk as r274769.

--
Iain
---
gcc/d/ChangeLog:

        PR d/88722
        * modules.cc: Include diagnostic.h.
        (register_moduleinfo): Use sorry instead of gcc_assert for targets
        without named sections.
---
diff --git a/gcc/d/modules.cc b/gcc/d/modules.cc
index 88cc5e89e9a..a25e06ae1cd 100644
--- a/gcc/d/modules.cc
+++ b/gcc/d/modules.cc
@@ -24,6 +24,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "dmd/module.h"
 
 #include "tree.h"
+#include "diagnostic.h"
 #include "fold-const.h"
 #include "tm.h"
 #include "function.h"
@@ -404,7 +405,8 @@ build_dso_registry_var (const char * name, tree type)
 static void
 register_moduleinfo (Module *decl, tree minfo)
 {
-  gcc_assert (targetm_common.have_named_sections);
+  if (!targetm_common.have_named_sections)
+    sorry ("%<-fmoduleinfo%> is not supported on this target");
 
   /* Build the ModuleInfo reference, this is done once for every Module.  */
   tree ident = mangle_internal_decl (decl, "__moduleRef", "Z");

Reply via email to