[Issue 8664] New: Compiler causes stack overflow with recursive typedef and option -g

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Sep 15 05:18:40 PDT 2012


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

           Summary: Compiler causes stack overflow with recursive typedef
                    and option -g
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: ice
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: r.sagitario at gmx.de


--- Comment #0 from Rainer Schuetze <r.sagitario at gmx.de> 2012-09-15 05:19:38 PDT ---
The file fail4.d from the dmd test suite causes a stack overflow when
generating debug information at the same time. The code is

typedef foo bar;
typedef bar foo;

Without "-g" on the command line, dmd reports:
test.d(3): Error: typedef test.foo circular definition

If dmd is compiled with the Microsoft compiler instead of dmc, this function

type *TypeTypedef::toCtype()
{
    return sym->basetype->toCtype();
}

in toctype.c is tail recursion optimized, which results in a freeze.

The problem does not happen with "alias", because the recursion is dealt with
in the front end:

test.d(2): Error: alias test.bar recursive alias declaration

-- 
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