[Issue 10703] New: Front-end code removal "optimisation" with try/catch blocks produces wrong codegen

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 23 07:28:23 PDT 2013


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

           Summary: Front-end code removal "optimisation" with try/catch
                    blocks produces wrong codegen
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: ibuclaw at ubuntu.com


--- Comment #0 from Iain Buclaw <ibuclaw at ubuntu.com> 2013-07-23 07:28:21 PDT ---
Simple example that compiles with dmd but runtime segfaults at the location of
'goto'.  This is also uncompilable with gdc, and would cause an ICE if not for
working around the problem as per
https://github.com/D-Programming-Language/dmd/pull/2176.


void main()
{
  int a;
  goto L2;    // BOOM!

  try { }
  catch (Exception e) {
L2: ;
      a += 100;
  }
  assert(a == 100);
}


The most obvious wrong thing about code like this is that it skips over the
initialisation of 'e', which is a direct violation of the spec for
GotoStatements.  But if the code is actively removed from the front-end, that
makes checking this violation impossible in lower layers of the code generation
routines.  So we need to be able to achieve this in the front-end.

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


More information about the Digitalmars-d-bugs mailing list