Thread overview | |||||
---|---|---|---|---|---|
|
March 04, 2011 [Issue 5698] New: va_arg sets wrong length for (u)short[] | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=5698 Summary: va_arg sets wrong length for (u)short[] Product: D Version: unspecified Platform: x86_64 OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody@puremagic.com ReportedBy: mathias.baumann@sociomantic.com --- Comment #0 from Mathias Baumann <mathias.baumann@sociomantic.com> 2011-03-04 10:07:48 PST --- Created an attachment (id=929) test case demonstrating the problem va_arg sets wrong length for ushort[] the attached program outputs: vararg_: ubyte[].length = 3 ushort[].length = 140737237065760 short[].length = 139885158469104 uint[].length = 3 vararg: ubyte[].length = 3 ushort[].length = 0 short[].length = 0 uint[].length = 3 I tested with D1, but the bug is possibly also existant in D2. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 15, 2011 [Issue 5698] va_arg sets wrong length for (u)short[] | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mathias Baumann | http://d.puremagic.com/issues/show_bug.cgi?id=5698 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |clugdbug@yahoo.com.au --- Comment #1 from Don <clugdbug@yahoo.com.au> 2011-03-15 02:04:42 PDT --- When I compile the test code on D2 Windows (replacing tango.stdc.stdarg -> core.stdc.stdarg), I just get indication of memory corruption: vararg_: ubyte[].length = 18419671623532547 ushort[].length = 18419809062486019 short[].length = 18419860602093571 uint[].length = 18419912141701123 There's this code in the test case: T[] usa; va_arg(ap, _arguments[0],cast(void*) &usa); Are you sure this is correct? Looks wrong to me, remember that static arrays are passed by value. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 15, 2011 [Issue 5698] va_arg sets wrong length for (u)short[] | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mathias Baumann | http://d.puremagic.com/issues/show_bug.cgi?id=5698 --- Comment #2 from Mathias Baumann <mathias.baumann@sociomantic.com> 2011-03-15 03:41:30 PDT --- I am not 100% sure, no. But I just replaced the array declerations with ubyte uba[] = [ 32,33,34]; uint a[] = [1,2,3]; ushort c[] = [ cast(ushort)51, 52, 53 ]; short sc[] = [ cast(short)51, 52, 53 ]; and it resulted in the same problem. I hope initializing them like this does qualify them as dynamic arrays. (?) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation