March 09, 2016
http://bugzilla.gdcproject.org/show_bug.cgi?id=216

            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 failure 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=<optimized out>, p1=0x76cad3b0,
    p2=0x76cad3d0) at ../../../../gcc-5.3.0/libphobos/libdruntime/object.d:1027
#1  0x0160cd54 in _aaKeys_x (e=0x76cad3a0, this=<optimized out>)
    at ../../../../gcc-5.3.0/libphobos/libdruntime/rt/aaA.d:784
#2  _aaEqual (tiRaw=<optimized out>, e1=..., e2=...) 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=0x7efff124, m=<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=...)
    at ../../../../gcc-5.3.0/libphobos/libdruntime/rt/minfo.d:287
#7  0x016092bc in object.ModuleInfo.opApply(scope int(object.ModuleInfo*)
delegate) (dg=...)
    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=0x7efff390) 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=0x7efff390, dg=...) at
../../../../gcc-5.3.0/libphobos/libdruntime/rt/dmain2.d:451
#11 0x0160fd70 in _d_run_main (argc=1, argv=<optimized out>,
mainFunc=<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 sure
if we can do anything about this)
2) The JSONValue contains members which can't be compared bitwise anyway (AAs,
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.

-- 
You are receiving this mail because:
You are watching all bug changes.