Thread overview
[Issue 19656] D compiler fails to resolve circular module dependency when modules are compiled separately
Feb 06, 2019
Puneet Goel
Feb 12, 2019
Puneet Goel
Feb 13, 2019
Seb
Mar 16, 2019
Puneet Goel
Mar 16, 2019
Puneet Goel
Mar 18, 2019
Dlang Bot
Mar 20, 2019
Dlang Bot
Mar 21, 2019
Dlang Bot
Mar 25, 2019
Dlang Bot
Mar 13, 2020
Dlang Bot
February 06, 2019
https://issues.dlang.org/show_bug.cgi?id=19656

--- Comment #1 from Puneet Goel <puneet@coverify.org> ---
Also see related bug https://issues.dlang.org/show_bug.cgi?id=19657

--
February 12, 2019
https://issues.dlang.org/show_bug.cgi?id=19656

Puneet Goel <puneet@coverify.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|blocker                     |regression

--- Comment #2 from Puneet Goel <puneet@coverify.org> ---
Works with version 2.074.1 of DMD. Fails with 2.075.0 and later. Marking as regression.

--
February 13, 2019
https://issues.dlang.org/show_bug.cgi?id=19656

Seb <greeenify@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |greeenify@gmail.com

--- Comment #3 from Seb <greeenify@gmail.com> ---
Any chance you could reduce this further? (Same also for the other bugs that
you opened).

This would help a lot for debugging them.

--
March 16, 2019
https://issues.dlang.org/show_bug.cgi?id=19656

Puneet Goel <puneet@coverify.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

--
March 16, 2019
https://issues.dlang.org/show_bug.cgi?id=19656

--- Comment #4 from Puneet Goel <puneet@coverify.org> ---
I will shortly add a PR for this and for other similar issues.

--
March 18, 2019
https://issues.dlang.org/show_bug.cgi?id=19656

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
@puneet created dlang/dmd pull request #9462 "Fix for issue 19656" mentioning this issue:

- Fix for issue 19656

  When DMD encounters an associative array with a class type (say Foo)
  specified as key, the compiler immediately wants to analyze the Foo
  class. And in some cases it might so happen that DMD was already in
  the process of analyzing Foo. In such a scenario, the
  visit(ClassDeclaration ) method malfunctions and marks Foo with
  PASS.semanticdone without actually completing analysis of the
  class. Since this method marks a ongoing call with setting _scope to
  null, this situation can be avoided by testing _scope for Foo before
  calling the dsymbolSemantic method. This makes sure that if semantic
  analysis for Foo is already running, it would not be run again.

https://github.com/dlang/dmd/pull/9462

--
March 20, 2019
https://issues.dlang.org/show_bug.cgi?id=19656

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> ---
@puneet created dlang/dmd pull request #9471 "Fix issues 19655, 19656, 19657, 19746 & 19750" fixing this issue:

- Fix issues 19655, 19656, 19657, 19746 & 19750

  The Semantic (pass 1) analysis for classes is handled by
visit(ClassDeclaration ) method of DsymbolSemanticVisitor class. For a given
class, this method may be run multiple times in order to resolve forward
references. The method incrementally tries to resolve the types referred to by
the members of the class.

  The subsequent calls to this method are short-circuited if the class members
have been fully analyzed. For this the code tests that it is not the first/main
call to the method (semanticRun == PASS.init else branch), scx is not set, and
that the cldec.symtab is already set. If all these conditions are met, the
method returns. But before returning, the method was setting cldec.semanticRun
to PASS.semanticdone. It should not set semanticRun since the class has not
been fully analyzed yet. The base class analysis for this class could be
pending and as a result vtable may not have been fully created.

  This fake setting of semanticRun results in the semantic analyzer to believe
that the class has been fully analyzed. As exposed by the issues 19656, 19657,
19746 and 19750, it may result in compile time errors when a derived type class
is getting analyzed and because of this fake semanticdone on the base class,
the semantic analysis construes that an overridden method is not defined in the
base class. Issue 19655 exposes a scenario where a buggy vtable may be created
and a call to class method may result in execution of some adhoc code.

https://github.com/dlang/dmd/pull/9471

--
March 21, 2019
https://issues.dlang.org/show_bug.cgi?id=19656

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #9471 "Fix issues 19655, 19656, 19657, 19746 & 19750" was merged into stable:

- 592d0c790b90be5aab9d011200b98efa539b4a27 by Puneet Goel:
  Fix issues 19655, 19656, 19657, 19746 & 19750

  The Semantic (pass 1) analysis for classes is handled by
visit(ClassDeclaration ) method of DsymbolSemanticVisitor class. For a given
class, this method may be run multiple times in order to resolve forward
references. The method incrementally tries to resolve the types referred to by
the members of the class.

  The subsequent calls to this method are short-circuited if the class members
have been fully analyzed. For this the code tests that it is not the first/main
call to the method (semanticRun == PASS.init else branch), scx is not set, and
that the cldec.symtab is already set. If all these conditions are met, the
method returns. But before returning, the method was setting cldec.semanticRun
to PASS.semanticdone. It should not set semanticRun since the class has not
been fully analyzed yet. The base class analysis for this class could be
pending and as a result vtable may not have been fully created.

  This fake setting of semanticRun results in the semantic analyzer to believe
that the class has been fully analyzed. As exposed by the issues 19656, 19657,
19746 and 19750, it may result in compile time errors when a derived type class
is getting analyzed and because of this fake semanticdone on the base class,
the semantic analysis construes that an overridden method is not defined in the
base class. Issue 19655 exposes a scenario where a buggy vtable may be created
and a call to class method may result in execution of some adhoc code.

https://github.com/dlang/dmd/pull/9471

--
March 25, 2019
https://issues.dlang.org/show_bug.cgi?id=19656

--- Comment #8 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #9489 "Merge remote-tracking branch 'upstream/stable' into merge_stable" was merged into master:

- 58878aeb8d32474ac24a0dd51446533a93602564 by Puneet Goel:
  Fix issues 19655, 19656, 19657, 19746 & 19750 (#9471)

  Fix issues 19655, 19656, 19657, 19746 & 19750
  merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>

https://github.com/dlang/dmd/pull/9489

--
March 13, 2020
https://issues.dlang.org/show_bug.cgi?id=19656

--- Comment #9 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #10913 "[dmd-cxx] Fix issues 19655, 19656, 19657, 19746 & 19750 (#9471)" was merged into dmd-cxx:

- 968386f6da15cb30c229bf0ca3325d86c6fa8714 by Puneet Goel:
  Fix issues 19655, 19656, 19657, 19746 & 19750 (#9471)

  Fix issues 19655, 19656, 19657, 19746 & 19750
  merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>

https://github.com/dlang/dmd/pull/10913

--