[Issue 4384] Cyclic dependency check for modules is broken

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 25 13:37:16 PDT 2010


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


Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WONTFIX                     |


--- Comment #2 from Steven Schveighoffer <schveiguy at yahoo.com> 2010-06-25 13:37:13 PDT ---
No, this can be fixed.  It has nothing to do with the contents of the static
ctors/dtors, the problem is that the cycle detection algorithm is broken (it
fails to detect non-trivial cycles).

The question to answer is if the compiler can generate a transitive dependency
list.

That is, if module a depends on b, and module b depends on c, then module a
depends on c.  Can this be detected at compile time?

If so, then the compiler can generate a full list, and the topographical sort
of the modules can be very easy without allocating extra space.

If not, then we can still solve the problem by first eliminating unneeded
modules from the list.

My guess is that the compiler cannot generate such a list, but if I"m wrong,
then the compiler can improve startup performance by generating the list.

Right now, the runtime incorrectly allows cycles which can result in undefined
behavior when D specifically is supposed to disallow import cycles, regardless
of ctor/dtor contents.  I can fix this, and keep the algorithm complexity the
same, but it's a bit awkward and requires allocating memory.

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