www.digitalmars.com         C & C++   DMDScript  

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


           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 puremagic.com
        ReportedBy: r.sagitario gmx.de

--- Comment #0 from Rainer Schuetze <r.sagitario 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: -------
Sep 15 2012