http://d.puremagic.com/issues/show_bug.cgi?id=4925

           Summary: [ICE] segfault with module-scope assert(0)
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: ice-on-valid-code, patch
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: rsi...@gmail.com


--- Comment #0 from Shin Fujishiro <rsi...@gmail.com> 2010-09-23 13:34:12 PDT 
---
The following code crashes the compiler:

const int a = (assert(0), 1);

Patch:
--- src/expression.c
+++ src/expression.c
@@ -5695,8 +5695,11 @@ Expression *AssertExp::semantic(Scope *sc)
     }
     if (e1->isBool(FALSE))
     {
-        FuncDeclaration *fd = sc->parent->isFuncDeclaration();
-        fd->hasReturnExp |= 4;
+        if (sc->parent && sc->parent->isFuncDeclaration())
+        {
+            FuncDeclaration *fd = sc->parent->isFuncDeclaration();
+            fd->hasReturnExp |= 4;
+        }

         if (!global.params.useAssert)
         {   Expression *e = new HaltExp(loc);

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to