D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2328 - setTypeInfo in gc.d backwards.
Summary: setTypeInfo in gc.d backwards.
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D1 (retired)
Hardware: All All
: P2 critical
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-02 13:36 UTC by David Simcha
Modified: 2014-03-01 00:36 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description David Simcha 2008-09-02 13:36:16 UTC
According to Phobos object docs:

uint flags();
    Get flags for type: 1 means GC should scan for pointers 

This is implemented correctly.

import std.stdio;

void main() {
    writefln(typeid(uint).flags & 1);  //0
    writefln(typeid(uint*).flags & 1); //1
    writefln(typeid(void*).flags & 1); //1
    writefln(typeid(float).flags & 1); //0
}

However, source code to setTypeInfo:

void setTypeInfo(TypeInfo ti, void* p)
{
    if (ti.flags() & 1)
	hasNoPointers(p);
    else
	hasPointers(p);
}

The if statement in this code is clearly backwards.
Comment 1 David Simcha 2009-01-25 22:15:37 UTC
No longer relevant to D2, but should still be fixed in D1.
Comment 2 github-bugzilla 2012-04-25 01:43:15 UTC
Commit pushed to phobos-1.x at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/e13d211422f71a681f08bf28df2c54bd7bf9dc88
fix Issue 2328 - setTypeInfo in gc.d backwards.