www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Bug 72] New: valgrind: use of unitialized values in the gcx module

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/bugzilla/show_bug.cgi?id=72

           Summary: valgrind: use of unitialized values in the gcx module
           Product: D
           Version: 0.150
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: thomas-dloop kuehne.cn


Context:
DStress' next torture step will include running new compiler versions,
generated programs and old compiler version with changed/new test cases under
valgrind. The aim is to locate usage of uninitialized values and potential GC
issues.

See also: 
dkdk2l$76$1 digitaldaemon.com: Tiago Gasiba's "memory leakage in D"
djtk1c$22gs$1 digitaldaemon.com: Tiago Gasiba's "Garbage Collector Bug?"

Potentially related:
dv416n$2s5q$1 digitaldaemon.com: Johan Gröngvist's "A program leaking memory."

The snipplets below are missing line numbers due to Phobos compilation settings
and a not yet triangled "   parsing :(0,7) gave NULL type ((0,7) remains)"
valgrind issue.

Conditional jump or move depends on uninitialized value(s)
   at 0x80665A2: _D3gcx3Gcx8findPoolFPvZPS3gcx4Pool (in /tmp/dstress/log)
   by 0x80669CF: _D3gcx3Gcx4markFPvPvZv (in /tmp/dstress/log)
   by 0x8066BB7: _D3gcx3Gcx11fullcollectFPvZk (in /tmp/dstress/log)
   by 0x8066A79: _D3gcx3Gcx16fullcollectshellFZk (in /tmp/dstress/log)
   by 0x8065BAF: _D3gcx2GC12mallocNoSyncFkZPv (in /tmp/dstress/log)
   by 0x8065AF6: _D3gcx2GC6mallocFkZPv (in /tmp/dstress/log)
   by 0x806000D: _d_arrayappendc (in /tmp/dstress/log)

Use of uninitialised value of size 4
   at 0x80669E3: _D3gcx3Gcx4markFPvPvZv (in /tmp/dstress/log)
   by 0x8066BB7: _D3gcx3Gcx11fullcollectFPvZk (in /tmp/dstress/log)
   by 0x8066A79: _D3gcx3Gcx16fullcollectshellFZk (in /tmp/dstress/log)
   by 0x8065BAF: _D3gcx2GC12mallocNoSyncFkZPv (in /tmp/dstress/log)
   by 0x8065AF6: _D3gcx2GC6mallocFkZPv (in /tmp/dstress/log)
   by 0x806000D: _d_arrayappendc (in /tmp/dstress/log)

Use of uninitialised value of size 4
   at 0x8067358: _D6gcbits6GCBits4testFkZk (in /tmp/dstress/log)
   by 0x8066A17: _D3gcx3Gcx4markFPvPvZv (in /tmp/dstress/log)
   by 0x8066BB7: _D3gcx3Gcx11fullcollectFPvZk (in /tmp/dstress/log)
   by 0x8066A79: _D3gcx3Gcx16fullcollectshellFZk (in /tmp/dstress/log)
   by 0x8065BAF: _D3gcx2GC12mallocNoSyncFkZPv (in /tmp/dstress/log)
   by 0x8065AF6: _D3gcx2GC6mallocFkZPv (in /tmp/dstress/log)
   by 0x806000D: _d_arrayappendc (in /tmp/dstress/log)

Use of uninitialised value of size 4
   at 0x8067370: _D6gcbits6GCBits3setFkZv (in /tmp/dstress/log)
   by 0x8066A24: _D3gcx3Gcx4markFPvPvZv (in /tmp/dstress/log)
   by 0x8066BB7: _D3gcx3Gcx11fullcollectFPvZk (in /tmp/dstress/log)
   by 0x8066A79: _D3gcx3Gcx16fullcollectshellFZk (in /tmp/dstress/log)
   by 0x8065BAF: _D3gcx2GC12mallocNoSyncFkZPv (in /tmp/dstress/log)
   by 0x8065AF6: _D3gcx2GC6mallocFkZPv (in /tmp/dstress/log)
   by 0x806000D: _d_arrayappendc (in /tmp/dstress/log)

Conditional jump or move depends on uninitialised value(s)
   at 0x8066C6A: _D3gcx3Gcx11fullcollectFPvZk (in /tmp/dstress/log)
   by 0x8066A79: _D3gcx3Gcx16fullcollectshellFZk (in /tmp/dstress/log)
   by 0x8065BAF: _D3gcx2GC12mallocNoSyncFkZPv (in /tmp/dstress/log)
   by 0x8065AF6: _D3gcx2GC6mallocFkZPv (in /tmp/dstress/log)
   by 0x806000D: _d_arrayappendc (in /tmp/dstress/log)


-- 
Mar 24 2006
parent reply "Walter Bright" <newshound digitalmars.com> writes:
<d-bugmail puremagic.com> wrote in message 
news:bug-72-3 http.d.puremagic.com/bugzilla/...
 Use of uninitialised value of size 4
   at 0x8067370: _D6gcbits6GCBits3setFkZv (in /tmp/dstress/log)
   by 0x8066A24: _D3gcx3Gcx4markFPvPvZv (in /tmp/dstress/log)
   by 0x8066BB7: _D3gcx3Gcx11fullcollectFPvZk (in /tmp/dstress/log)
   by 0x8066A79: _D3gcx3Gcx16fullcollectshellFZk (in /tmp/dstress/log)
   by 0x8065BAF: _D3gcx2GC12mallocNoSyncFkZPv (in /tmp/dstress/log)
   by 0x8065AF6: _D3gcx2GC6mallocFkZPv (in /tmp/dstress/log)
   by 0x806000D: _d_arrayappendc (in /tmp/dstress/log)
I don't know what to make of this. Here's the code in question: void set(uint i) in { assert(i < nbits); } body { //(cast(bit *)(data + 1))[i] = 1; data[1 + (i >> BITS_SHIFT)] |= (1 << (i & BITS_MASK)); } Where's the use of an uninitialized value?
Mar 24 2006
parent reply Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Walter Bright schrieb am 2006-03-25:
<d-bugmail puremagic.com> wrote in message 
 news:bug-72-3 http.d.puremagic.com/bugzilla/...
 Use of uninitialised value of size 4
   at 0x8067370: _D6gcbits6GCBits3setFkZv (in /tmp/dstress/log)
   by 0x8066A24: _D3gcx3Gcx4markFPvPvZv (in /tmp/dstress/log)
   by 0x8066BB7: _D3gcx3Gcx11fullcollectFPvZk (in /tmp/dstress/log)
   by 0x8066A79: _D3gcx3Gcx16fullcollectshellFZk (in /tmp/dstress/log)
   by 0x8065BAF: _D3gcx2GC12mallocNoSyncFkZPv (in /tmp/dstress/log)
   by 0x8065AF6: _D3gcx2GC6mallocFkZPv (in /tmp/dstress/log)
   by 0x806000D: _d_arrayappendc (in /tmp/dstress/log)
I don't know what to make of this. Here's the code in question: void set(uint i) in { assert(i < nbits); } body { //(cast(bit *)(data + 1))[i] = 1; data[1 + (i >> BITS_SHIFT)] |= (1 << (i & BITS_MASK)); } Where's the use of an uninitialized value?
Seems to be a side effect of the "-release" flag. compiling phobos with no flags: => no uninitialized value messages compiling phobos with "-inline": => no uninitialized value messages compiling phobos with "-O": => no unitialized value messages compiling phobos with "-release": => "_D6gcbits6GCBits3setFkZv" message twice compiling phobos with "-inline -O": => no unitialized value messages compiling phobos with "-inline -release": => "_D6gcbits6GCBits3setFkZv" message twice compiling phobos with "-O -release": => "_D6gcbits6GCBits3setFkZv" message twice compiling phobos with "-inline -O -release": => "_D6gcbits6GCBits3setFkZv" message twice Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFEJRYy3w+/yD4P9tIRAlbtAJ4vez0F6J9sq157uToFxNhX0muxigCgwkD5 QTFqxrhpoQrKAtUd10DmLZ4= =+Idk -----END PGP SIGNATURE-----
Mar 25 2006
parent reply Brad Roberts <braddr puremagic.com> writes:
Which file(s) in phobos triggers this?  I'll create a minimalized test 
case.
Mar 25 2006
parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Brad Roberts schrieb am 2006-03-25:
 Which file(s) in phobos triggers this?  I'll create a minimalized test 
 case.
The code below triggers the _D6gcbits6GCBits3setFkZv issue. Phobos compiled without "-release": 2 x Conditional jump or move depends on uninitialised value 2 x Use of uninitialised value of size 4 Phobos compiled with "-release": 2 x Use of uninitialised value of size 4
 int main(){
	char[] dummy;
	dummy = "abc".dup;
	for(int a=0; a < 120; a++){
		char[] tmp = new char[a % 80];
		for(int b=0; b  < a % 10; b++){
			dummy = dummy[0 .. $ % 33] ~ tmp[0 .. $ % 11] ~ dummy[ $ % 33 .. $];
		}
	}
	return dummy.length / 2000002;
 }
Setting: DMD-0.150 / Linux / Valgrind-3.1.1 Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFELUuJ3w+/yD4P9tIRAgiZAJ4+F+4Tso6NHhIdemX2s/05b/X7WwCeNVVD OtbaOUNFuyavZggkxBGBbIw= =bR0O -----END PGP SIGNATURE-----
Mar 31 2006