the new GC might be buggy

Thomas Kuehne thomas-dloop at kuehne.cn
Wed Jan 24 03:49:42 PST 2007


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

While updating Flectioned to DMD-1.001 I've encountered a _potential_
issue with the new GC.

# class LazyTypeInfo : TypeInfo{
#    char[] unique;
# 
#    this(char[] name){
#       this.unique = name.dup;
#       printf("LAZY_1: this:%p message:%p %.*s\n", this, unique.ptr,
#       unique);
#    }
# 
#    char[] toString(){
#       printf("LAZY_2: this:%p message:%p %.*s\n", this, unique.ptr, unique);
#       return format("LazyTypeInfo(%s)", unique);
#    }
# }

No LazyTypeInfo can be collected before all LazyTypeInfos have been
instantiated and all instantiations of LazyTypeInfo are plain "new
LazyTypeInfo("some string)".

LAZY_1: this:0xf7d57170 message:0xf7d57140 aaA.AA
LAZY_1: this:0xf7d57140 message:0xf7d26640 std.asserterror.AssertError
LAZY_2: this:0xf7d57140 message:0xf7d26640

As you can see 0xf7d57140 first points to the content of an array and
later on to that of a LazyTypeInfo instance. In addition the above
"name.dup" was a "name" in previous versions and works with DMD-1.00 and
GDC-0.21.

Complete source: 
http://svn.dsource.org/projects/flectioned/downloads/flectioned.zip

failure detection:
Error: 4invalid UTF-8 sequence

I'll try to reduce the code a bit before filling a bug report - if it is
indeed a D issue.

Thomas


-----BEGIN PGP SIGNATURE-----

iD8DBQFFt1SiLK5blCcjpWoRAne6AJ43a+/bBV6Nfwt0nVJmVbX2GWkJNwCfdRds
XZAZElTDEVJDHLqI2Z2/xXU=
=aBAI
-----END PGP SIGNATURE-----



More information about the Digitalmars-d-announce mailing list