www.digitalmars.com         C & C++   DMDScript  

D.gnu - [Bug 216] New: master: std.json unittest fails: memcmp of struct

Date: Wed, 9 Mar 2016 12:30:56 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://bugzilla.gdcproject.org/
Auto-Submitted: auto-generated

http://bugzilla.gdcproject.org/show_bug.cgi?id=3D216

            Bug ID: 216
           Summary: master: std.json unittest fails: memcmp of struct
                    containing a union
           Product: GDC
           Version: development
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: gdc
          Assignee: ibuclaw gdcproject.org
          Reporter: johannespfau gmail.com

On ARM, the std.json unittest at line 1155 is failing. I also saw this fail=
ure
once on X86 but couldn't reproduce it there.

In the end, it boils down to this:
---------------
#0  object.TypeInfo_Struct.equals(const(void*), const(void*)) const
(this=3D<optimized out>, p1=3D0x76cad3b0,=20
    p2=3D0x76cad3d0) at ../../../../gcc-5.3.0/libphobos/libdruntime/object.=
d:1027
#1  0x0160cd54 in _aaKeys_x (e=3D0x76cad3a0, this=3D<optimized out>)
    at ../../../../gcc-5.3.0/libphobos/libdruntime/rt/aaA.d:784
#2  _aaEqual (tiRaw=3D<optimized out>, e1=3D..., e2=3D...) at
../../../../gcc-5.3.0/libphobos/libdruntime/rt/aaA.d:807
#3  0x0148e58c in std.json.__unittestL1130_11() () at
../../../../gcc-5.3.0/libphobos/src/std/json.d:1155
#4  0x0149e73c in std.json.__modtest() () at
../../../../gcc-5.3.0/libphobos/src/std/json.d:1
#5  0x016256d0 in __foreachbody3 (this=3D0x7efff124, m=3D<optimized out>)
    at ../../../../gcc-5.3.0/libphobos/libdruntime/core/runtime.d:448
#6  0x01610b50 in rt.minfo.moduleinfos_apply(scope
int(immutable(object.ModuleInfo*)) delegate) (dg=3D...)
    at ../../../../gcc-5.3.0/libphobos/libdruntime/rt/minfo.d:287
#7  0x016092bc in object.ModuleInfo.opApply(scope int(object.ModuleInfo*)
delegate) (dg=3D...)
    at ../../../../gcc-5.3.0/libphobos/libdruntime/object.d:1467
#8  0x01625900 in runModuleUnitTests () at
../../../../gcc-5.3.0/libphobos/libdruntime/core/runtime.d:438
#9  0x0160ffe0 in runAll (this=3D0x7efff390) at
../../../../gcc-5.3.0/libphobos/libdruntime/rt/dmain2.d:475
#10 0x0160fbd0 in rt.dmain2._d_run_main(int, char**, extern(C) int(char[][])
function).tryExec(scope void() delegate) (this=3D0x7efff390, dg=3D...) at
../../../../gcc-5.3.0/libphobos/libdruntime/rt/dmain2.d:451
#11 0x0160fd70 in _d_run_main (argc=3D1, argv=3D<optimized out>,
mainFunc=3D<optimized out>)
    at ../../../../gcc-5.3.0/libphobos/libdruntime/rt/dmain2.d:484
#12 0x76da5cf8 in __libc_start_main () from /usr/lib/libc.so.6
#13 0x000150e0 in _start ()
---------------


This reveals 3 individual GDC/DMDFE/phobos bugs:

1) GDC produces different results than DMD when comparing the memory (not s=
ure
if we can do anything about this)
2) The JSONValue contains members which can't be compared bitwise anyway (A=
As,
strings). But as these are part of a union DMD can't actually compare them
memberwise. It should probably refuse to compile the JSONValue struct.
3) The JSONValue struct needs an opEquals which checks the type of the
JSONValue and compares the correct union members.

--=20
You are receiving this mail because:
You are watching all bug changes.=
Mar 09 2016