Cycle detected between modules with ctors/dtors
Steven Schveighoffer
schveiguy at yahoo.com
Mon Apr 25 11:21:29 PDT 2011
On Mon, 25 Apr 2011 14:07:28 -0400, Mandeep <mandeep at brars.co.in> wrote:
> On 04/25/2011 07:56 PM, Steven Schveighoffer wrote:
>> On Sat, 23 Apr 2011 02:16:22 -0400, Mandeep <mandeep at brars.co.in> wrote:
>>
>>> Hi,
>>>
>>> I am trying to compile the code that was working with dmd 2.050 using
>>> dmd 2.052.
>>>
>>> The code compiles but it gives me errors with message when trying to
>>> run:
>>>
>>> Cycle detected between modules with ctors/dtors
>>
>> The cyclic module import code was changed significantly in 2.051, due to
>> this bug:
>>
>> http://d.puremagic.com/issues/show_bug.cgi?id=4384
>>
>> I would appreciate if you think the cycle is not correct to post a case
>> of where cycle detection is flagging a cycle that shouldn't be
>> considered a cycle.
>>
>> -Steve
>
> The cases i could find were pieces of bigger codebase with cycles
> coming out of more than 4-5 files with lot of code. I tried to repeat
> the code sequence with a couple of files with simplistic function but
> was not able to come out with a smaller test case for the above. Would
> try to come up with a test case again if i can. But i think moving
> around the code from static constructors as suggested in an earlier post
> in the thread helped.
>
> Also, I think that the cyclic const/dest have a problem, because the
> same code was working find with 2.050.
The cyclic check is conservative, there is a very good possibility that
the cyclic dependency does not alter the execution of the code at all. So
just because the code runs correctly does not mean that there is not a
cycle. All the cycle checker does is guarantee that the static
constructors/destructors are executed in a sane order. The compiler
doesn't give enough info (and can't AFAIK) to tell if the cycle is harmful
or not.
But if the cycle checker is identifying a cycle where there isn't one, I
want to fix that. It should be simple to verify, just follow the path
listed in the exception and see if the cycle does exist. If this is an
error, you can email me privately, and I can help you reduce the test case.
> Another bit of diff from my older scenario is that 2.050 was on 32 bit
> and i am using -m64 with 2.052, which i am not sure should be a problem.
Although I have not tested the 64-bit compiler (not having a 64-bit linux
box), I believe that the cyclic import check is the same.
-Steve
More information about the Digitalmars-d-learn
mailing list