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:
---------------

(this=3D<optimized out>, p1=3D0x76cad3b0,=20
    p2=3D0x76cad3d0) at ../../../../gcc-5.3.0/libphobos/libdruntime/object.=
d:1027

    at ../../../../gcc-5.3.0/libphobos/libdruntime/rt/aaA.d:784

../../../../gcc-5.3.0/libphobos/libdruntime/rt/aaA.d:807

../../../../gcc-5.3.0/libphobos/src/std/json.d:1155

../../../../gcc-5.3.0/libphobos/src/std/json.d:1

    at ../../../../gcc-5.3.0/libphobos/libdruntime/core/runtime.d:448

int(immutable(object.ModuleInfo*)) delegate) (dg=3D...)
    at ../../../../gcc-5.3.0/libphobos/libdruntime/rt/minfo.d:287

delegate) (dg=3D...)
    at ../../../../gcc-5.3.0/libphobos/libdruntime/object.d:1467

../../../../gcc-5.3.0/libphobos/libdruntime/core/runtime.d:438

../../../../gcc-5.3.0/libphobos/libdruntime/rt/dmain2.d:475

function).tryExec(scope void() delegate) (this=3D0x7efff390, dg=3D...) at
../../../../gcc-5.3.0/libphobos/libdruntime/rt/dmain2.d:451

mainFunc=3D<optimized out>)
    at ../../../../gcc-5.3.0/libphobos/libdruntime/rt/dmain2.d:484


---------------


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