This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug other/80803] libgo appears to be miscompiled on powerpc64le since r247497


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

--- Comment #17 from boger at us dot ibm.com ---
Here's more info on the failures and how to reproduce them.  Starting with
commit 247497 there are 7 new failures in the libgo testsuite.

There are 4 that fail with a SEGV at runtime: reflect, archive/tar,
mime/multipart, and net/mail. I looked at 2 and their stacks look similar but
not quite the same.  The SEGV happens because a 0 is passed as the address of
the src argument.

archive/tar shows a stack like this at the point of the SEGV:
Program received signal SIGSEGV, Segmentation fault.
__memcpy_power7 () at ../sysdeps/powerpc/powerpc64/power7/memcpy.S:219
219     ../sysdeps/powerpc/powerpc64/power7/memcpy.S: No such file or
directory.
(gdb) bt
#0  __memcpy_power7 () at ../sysdeps/powerpc/powerpc64/power7/memcpy.S:219
#1  0x00003fffb6350918 in __GI_memmove (dest=0xc208086600, src=<optimized out>,
len=<optimized out>) at ../sysdeps/powerpc/memmove.c:54
#2  0x00003fffb71567bc in runtime.memmove (p1=<optimized out>, p2=<optimized
out>, len=<optimized out>)
    at ../../../src/libgo/runtime/go-memmove.c:15
#3  0x00003fffb7620fd8 in runtime.typedmemmove (typ=<optimized out>,
dst=<optimized out>, src=<optimized out>)
    at ../../../src/libgo/go/runtime/stubs.go:298
#4  0x00003fffb76215bc in reflect.typedmemmove (typ=<optimized out>,
dst=<optimized out>, src=<optimized out>)
    at ../../../src/libgo/go/runtime/stubs.go:304
#5  0x00003fffb75c8384 in reflect.packEface (v=...) at
../../../src/libgo/go/reflect/value.go:113
#6  reflect.valueInterface (param=..., safe=true) at
../../../src/libgo/go/reflect/value.go:821
#7  0x00003fffb75c8760 in reflect.Interface.N13_reflect.Value
(pointer=<optimized out>) at ../../../src/libgo/go/reflect/value.go:781
#8  0x00003fffb72e570c in fmt.printValue.pN6_fmt.pp (p=<optimized out>,
param=..., verb=<optimized out>, depth=<optimized out>)
    at ../../../src/libgo/go/fmt/print.go:694
#9  0x00003fffb72e623c in fmt.printValue.pN6_fmt.pp (p=<optimized out>,
param=..., verb=<optimized out>, depth=<optimized out>)

With gdb I found that when reflect.typedmemmove calls runtime.typedmemmove, it
is passing a bad argument for the src.

Something similar happens in the reflect test, although that SEGV stack looks
like this:
288     ../sysdeps/powerpc/powerpc64/power7/memcpy.S: No such file or
directory.
(gdb) bt
#0  __memcpy_power7 () at ../sysdeps/powerpc/powerpc64/power7/memcpy.S:288
#1  0x00003fffb6350918 in __GI_memmove (dest=0xc20800b6d0, src=<optimized out>,
len=<optimized out>) at ../sysdeps/powerpc/memmove.c:54
#2  0x00003fffb71567bc in runtime.memmove (p1=<optimized out>, p2=<optimized
out>, len=<optimized out>)
    at ../../../src/libgo/runtime/go-memmove.c:15
#3  0x00003fffb762165c in runtime.typedslicecopy (typ=<optimized out>, dst=...,
src=...) at ../../../src/libgo/go/runtime/stubs.go:329
#4  0x00003fffb76216cc in reflect.typedslicecopy (elemType=<optimized out>,
dst=..., src=...) at ../../../src/libgo/go/runtime/stubs.go:336
#5  0x0000000010052c6c in reflect.Copy (param=..., param=...) at value.go:1747
#6  0x00000000100529f4 in reflect.AppendSlice (param=..., param=...) at
value.go:1702
#7  0x0000000010069514 in reflect_test.TestAppend (t=<optimized out>) at
all_test.go:534

And the bad address is passed for the src argument for the call from
reflect.typedslicecopy to runtime.typedslicecopy.

The tests for fmt, net, and debug/dwarf fail when processing code that calls
reflect.DeepEqual followed by a call to Errorf, something like this:

if out := ParseIP(tt.in); !reflect.DeepEqual(out, tt.out) {
      t.Errorf("ParseIP(%q) = %v, want %v", tt.in, out, tt.out)
}

The argument for tt.out is passed incorrectly to DeepEqual, causing it to
return false when it shouldn't, and then passes bad information to the Errorf
function.

I've tried to reproduce this in a smaller testcase but haven't been able to.  I
run these tests after a build by first editing the src/libgo/testsuite/gotest
to set keep=true and trace=true.  Then I go to my bld directory:

cd bld/powerpc64le-linux/libgo
make fmt/check

That should give you output with the full gccgo command to build the test, the
directory containing the a.out and files from the test.  The name of the
directory is gotestxxxxx.

FAIL
Keeping gotest32163
FAIL: fmt
Makefile:3331: recipe for target 'fmt/check' failed

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]