www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Assertion failure: module.c 470 - recursive/circular struct containment

reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Using DMD 0.110, Windows 98SE.

The compiler isn't properly catching structs that recursively contain 
themselves.

----------
struct Qwert {
     Qwert asdfg;
}
----------
Assertion failure: '!deferred.dim' on line 470 in file 'module.c'
----------

after which the compiler hangs.  The same happens if two structs 
circularly contain each other:

----------
struct Qwert {
     Yuiop asdfg;
}

struct Yuiop {
     Qwert hjkl;
}
----------

DMD should detect the error and deliver an appropriate message.

Stewart.

-- 
My e-mail is valid but not my primary mailbox.  Please keep replies on 
the 'group where everyone may benefit.
Jan 12 2005
parent reply Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Added to DStress as
http://dstress.kuehne.cn/compile/struct_19.d
http://dstress.kuehne.cn/compile/struct_20.d

Stewart Gordon schrieb am Wed, 12 Jan 2005 10:29:57 +0000:
 The compiler isn't properly catching structs that recursively contain 
 themselves.
<snip>
 after which the compiler hangs.  The same happens if two structs 
 circularly contain each other:
<snip>
 DMD should detect the error and deliver an appropriate message.
Why should this be an error? Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFB5SU23w+/yD4P9tIRApbAAKDNXnPh/04+hD5l3V3/6cEVCAKB1ACdFVGy 2IUt4Sd9CHbFUGzEkh18+zM= =/uCw -----END PGP SIGNATURE-----
Jan 12 2005
parent reply Russ Lewis <spamhole-2001-07-16 deming-os.org> writes:
Thomas Kuehne wrote:
 Why should this be an error?
Because structs are included by value. Thus, the size of the two structs would be infinite. That's probably why the compiler is hanging - an infinite loop, trying to determine the size of the struct.
Jan 12 2005
parent reply Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Russ Lewis schrieb am Wed, 12 Jan 2005 08:28:48 -0700:
 Thomas Kuehne wrote:
 Why should this be an error?
Because structs are included by value.
http://www.digitalmars.com/d/struct.html ... moved test cases: http://dstress.kuehne.cn/nocompile/struct_19.d http://dstress.kuehne.cn/nocompile/struct_20.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFB5cWQ3w+/yD4P9tIRAtjtAJ4jSaJTNVVS6/HEwW4DajKT5w2ZvgCgir0v s7zq/Y8wICwCGoHFxY+3MjA= =6M6y -----END PGP SIGNATURE-----
Jan 12 2005
parent reply "Simon Buchan" <buchan.home ihug.co.nz> writes:
On Thu, 13 Jan 2005 01:49:20 +0100, Thomas Kuehne  
<thomas-dloop kuehne.thisisspam.cn> wrote:

 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1

 Russ Lewis schrieb am Wed, 12 Jan 2005 08:28:48 -0700:
 Thomas Kuehne wrote:
 Why should this be an error?
Because structs are included by value.
http://www.digitalmars.com/d/struct.html ... moved test cases: http://dstress.kuehne.cn/nocompile/struct_19.d http://dstress.kuehne.cn/nocompile/struct_20.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFB5cWQ3w+/yD4P9tIRAtjtAJ4jSaJTNVVS6/HEwW4DajKT5w2ZvgCgir0v s7zq/Y8wICwCGoHFxY+3MjA= =6M6y -----END PGP SIGNATURE-----
Have you tried it in C lately? (You're probabaly thinking of something like: struct node { node* next; // something }; , forgive me if I'm being an idiot.) -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Jan 14 2005
parent reply Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Simon Buchan schrieb am Fri, 14 Jan 2005 21:23:39 +1300:
 On Thu, 13 Jan 2005 01:49:20 +0100, Thomas Kuehne  
<thomas-dloop kuehne.thisisspam.cn> wrote:

 Russ Lewis schrieb am Wed, 12 Jan 2005 08:28:48 -0700:
 Thomas Kuehne wrote:
 Why should this be an error?
Because structs are included by value.
moved test cases: http://dstress.kuehne.cn/nocompile/struct_19.d http://dstress.kuehne.cn/nocompile/struct_20.d
Have you tried it in C lately? (You're probabaly thinking of something like:
 struct node {
 	node* next;
 	// something
 };
mind the asterix? struct node{ node next; }; Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFB544i3w+/yD4P9tIRAkj+AJ4kq3lvuoENSXqLLpM02+LAV/dB7ACgibZu 6eUPhpOipgJV06AqvTuhDZg= =8aCM -----END PGP SIGNATURE-----
Jan 14 2005
next sibling parent reply "Simon Buchan" <buchan.home ihug.co.nz> writes:
On Fri, 14 Jan 2005 10:17:22 +0100, Thomas Kuehne  
<thomas-dloop kuehne.thisisspam.cn> wrote:

 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1

 Simon Buchan schrieb am Fri, 14 Jan 2005 21:23:39 +1300:
 On Thu, 13 Jan 2005 01:49:20 +0100, Thomas Kuehne
 <thomas-dloop kuehne.thisisspam.cn> wrote:

 Russ Lewis schrieb am Wed, 12 Jan 2005 08:28:48 -0700:
 Thomas Kuehne wrote:
 Why should this be an error?
Because structs are included by value.
moved test cases: http://dstress.kuehne.cn/nocompile/struct_19.d http://dstress.kuehne.cn/nocompile/struct_20.d
Have you tried it in C lately? (You're probabaly thinking of something like:
 struct node {
 	node* next;
 	// something
 };
mind the asterix? struct node{ node next; }; Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFB544i3w+/yD4P9tIRAkj+AJ4kq3lvuoENSXqLLpM02+LAV/dB7ACgibZu 6eUPhpOipgJV06AqvTuhDZg= =8aCM -----END PGP SIGNATURE-----
Err... the asterix was the whole point. -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Jan 14 2005
parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Simon Buchan wrote:
<snip>
 Err... the asterix was the whole point.
What has René Goscinny's character to do with anything? Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Jan 14 2005
parent "Simon Buchan" <buchan.home ihug.co.nz> writes:
On Fri, 14 Jan 2005 11:18:54 +0000, Stewart Gordon <smjg_1998 yahoo.com>  
wrote:

 Simon Buchan wrote:
 <snip>
 Err... the asterix was the whole point.
What has René Goscinny's character to do with anything? Stewart.
:P That would be _the_ Asterix. (Note capital letter) Not quite sure why the two main characters were named after a marker for special explination/emphasis and a phalic symbol of constructive skills. -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Jan 14 2005
prev sibling parent Russ Lewis <spamhole-2001-07-16 deming-os.org> writes:
Thomas Kuehne wrote:
 mind the asterix?
 
 struct node{
 	node next;
 };
Thomas, your last two messages in this thread have been (almost) impossible for me to understand. However, guys, I think we can all conclude that Thomas understands the problem now. He *did*, after all, move the testcases to the "nocompile" set. Can we end this?
Jan 14 2005