FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.

» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian GCC

LinkBack Thread Tools
Old 05-31-2010, 05:46 PM
Peter De Wachter
Default Bug#583837: "circular initialization dependency" depending on link order

Hi Iain,

Thanks for the patch. I didn't see your reply until now (with the BTS
you have to explicitly Cc the bug submitter, see [1]), and in the
meantime I've managed to create a minimal variant of the parsec47
problem. There's a cycle of three modules, one of which does not use
static constructors. I've included the code below.

If you compile this with
gdc -o p47 P47Boot.d Ship.d P47GameManager.d Enemy.d
you get a working program, and
gdc -o p47 Ship.d Enemy.d P47Boot.d P47GameManager.d
gives a broken program.

I don't know if this is correct D code, but it bothers me that the
compiler isn't consistent: either both versions should fail or both
should work. (Consider that it's quite easy to write a build script that
will link the objects in essentially random order, all you have to do is
to use a wildcard to specify your source files.) Given the description
in the manual, I'm guessing it should fail, which would mean that
there's a bug in the cycle detection algorithm.

Peter De Wachter

[1] http://www.debian.org/doc/developers-reference/pkgs.html#bug-answering

==> P47Boot.d <==
module P47Boot;

import P47GameManager;

import std.stdio;

public int main(char[][] args) {
writefln("Hello world");
return 0;

==> P47GameManager.d <==
module P47GameManager;

import Enemy;

public class P47GameManager {

==> Enemy.d <==
module Enemy;

import Ship;

public class Enemy{

public static this() {


==> Ship.d <==
module Ship;

import P47GameManager;

public class Ship {

public static this() {


Thread Tools

All times are GMT. The time now is 06:33 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org