https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80803

--- Comment #14 from boger at us dot ibm.com ---
I have found the incorrect code that is causing this test to fail but not sure
what causes it.  My previous theory was not correct.

The problem is that the second argument being passed to runtime.DeepEqual in
net.TestParseIP is wrong.  The storage for the arguments are being generated by
calls to runtime.newobject, followed by code to fill in the contents.  The
arguments are slices so should have 3 doublewords including the address and 2
lengths.  The first argument is initialized correctly but the second is not
storing the length values.  Here is a snippet of code from the bad a.out:

  10066158:   69 91 fc 4b     bl      1002f2c0
<00003287.plt_call.runtime.newobject>
    1006615c:   18 00 41 e8     ld      r2,24(r1)
    10066160:   10 02 01 e9     ld      r8,528(r1)
    10066164:   18 02 41 e9     ld      r10,536(r1)
    10066168:   20 02 21 e9     ld      r9,544(r1)
    1006616c:   f8 01 a1 38     addi    r5,r1,504
    10066170:   78 1b 72 7c     mr      r18,r3
    10066174:   78 fb e3 7f     mr      r3,r31
    10066178:   78 93 44 7e     mr      r4,r18
    1006617c:   f8 01 01 f9     std     r8,504(r1)
    10066180:   00 02 41 f9     std     r10,512(r1)
    10066184:   08 02 21 f9     std     r9,520(r1)
    10066188:   d9 92 fc 4b     bl      1002f460
<00003287.plt_call.runtime.typedmemmove>
    1006618c:   18 00 41 e8     ld      r2,24(r1)
    10066190:   78 fb e3 7f     mr      r3,r31
    10066194:   2d 91 fc 4b     bl      1002f2c0
<00003287.plt_call.runtime.newobject>
    10066198:   18 00 41 e8     ld      r2,24(r1)
    1006619c:   e0 01 a1 38     addi    r5,r1,480
    100661a0:   e0 01 c1 fb     std     r30,480(r1)
    100661a4:   78 1b 70 7c     mr      r16,r3
    100661a8:   78 fb e3 7f     mr      r3,r31
    100661ac:   78 83 04 7e     mr      r4,r16
    100661b0:   b1 92 fc 4b     bl      1002f460
<00003287.plt_call.runtime.typedmemmove>
    100661b4:   18 00 41 e8     ld      r2,24(r1)
    100661b8:   78 fb e5 7f     mr      r5,r31
    100661bc:   78 83 06 7e     mr      r6,r16
    100661c0:   78 fb e3 7f     mr      r3,r31
    100661c4:   78 93 44 7e     mr      r4,r18
    100661c8:   49 9b fc 4b     bl      1002fd10
<00003287.plt_call.reflect.DeepEqual>


In gdb I can see that the length field in the slice passed to DeepEqual and
then deepValueEqual is 0 causing them to appear not equal, and the length 0
causes other problems later on.

I tried to reproduce this in a small testcase but it did not fail.  In that
case the code looks like this:

   10002c48:   19 f9 ff 4b     bl      10002560
<000000be.plt_call.runtime.newobject>
    10002c4c:   18 00 41 e8     ld      r2,24(r1)
    10002c50:   78 1b 69 7c     mr      r9,r3
    10002c54:   c0 02 3f f9     std     r9,704(r31)
    10002c58:   48 03 1f e9     ld      r8,840(r31)
    10002c5c:   50 03 5f e9     ld      r10,848(r31)
    10002c60:   58 03 3f e9     ld      r9,856(r31)
    10002c64:   a8 02 1f f9     std     r8,680(r31)
    10002c68:   b0 02 5f f9     std     r10,688(r31)
    10002c6c:   b8 02 3f f9     std     r9,696(r31)
    10002c70:   c0 02 3f e9     ld      r9,704(r31)
    10002c74:   a8 02 5f 39     addi    r10,r31,680
    10002c78:   78 53 45 7d     mr      r5,r10
    10002c7c:   78 4b 24 7d     mr      r4,r9
    10002c80:   58 80 62 e8     ld      r3,-32680(r2)
    10002c84:   fd fa ff 4b     bl      10002780
<000000be.plt_call.runtime.typedmemmove>
    10002c88:   18 00 41 e8     ld      r2,24(r1)
    10002c8c:   c0 02 3f e9     ld      r9,704(r31)
    10002c90:   78 4b 33 7d     mr      r19,r9
    10002c94:   58 80 82 ea     ld      r20,-32680(r2)
    10002c98:   58 80 62 e8     ld      r3,-32680(r2)
    10002c9c:   c5 f8 ff 4b     bl      10002560
<000000be.plt_call.runtime.newobject>
    10002ca0:   18 00 41 e8     ld      r2,24(r1)
    10002ca4:   78 1b 69 7c     mr      r9,r3
    10002ca8:   a0 02 3f f9     std     r9,672(r31)
    10002cac:   c8 02 1f e9     ld      r8,712(r31)
    10002cb0:   d0 02 5f e9     ld      r10,720(r31)
    10002cb4:   d8 02 3f e9     ld      r9,728(r31)
    10002cb8:   88 02 1f f9     std     r8,648(r31)
    10002cbc:   90 02 5f f9     std     r10,656(r31)
    10002cc0:   98 02 3f f9     std     r9,664(r31)
    10002cc4:   a0 02 3f e9     ld      r9,672(r31)
    10002cc8:   88 02 5f 39     addi    r10,r31,648
    10002ccc:   78 53 45 7d     mr      r5,r10
    10002cd0:   78 4b 24 7d     mr      r4,r9
    10002cd4:   58 80 62 e8     ld      r3,-32680(r2)
    10002cd8:   a9 fa ff 4b     bl      10002780
<000000be.plt_call.runtime.typedmemmove>
    10002cdc:   18 00 41 e8     ld      r2,24(r1)
    10002ce0:   a0 02 3f e9     ld      r9,672(r31)
    10002ce4:   78 4b 35 7d     mr      r21,r9
    10002ce8:   78 a3 85 7e     mr      r5,r20
    10002cec:   78 ab a6 7e     mr      r6,r21
    10002cf0:   78 93 43 7e     mr      r3,r18
    10002cf4:   78 9b 64 7e     mr      r4,r19
    10002cf8:   19 f8 ff 4b     bl      10002510
<000000be.plt_call.reflect.DeepEqual>

Reply via email to