[Bug go/64573] New: Cmd.Start swallows error from fork()/clone()

2015-01-12 Thread eswierk at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64573

Bug ID: 64573
   Summary: Cmd.Start swallows error from fork()/clone()
   Product: gcc
   Version: 4.9.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: go
  Assignee: ian at airs dot com
  Reporter: eswierk at gmail dot com
CC: cmang at google dot com

Created attachment 34428
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34428&action=edit
Proposed fix

Cmd.Start ignores the error code from the underlying fork() or clone() syscall,
instead returning a nil error while setting Process.Pid to 0.  If the caller
then tries to Wait on the command, it can end up reaping some other child
process (since waitpid(0) means wait for any child in the process group).

The attached patch should make the behavior identical to that of golang.


[Bug go/64573] Cmd.Start swallows error from fork()/clone()

2015-01-12 Thread eswierk at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64573

Ed Swierk  changed:

   What|Removed |Added

  Attachment #34428|0   |1
is obsolete||

--- Comment #1 from Ed Swierk  ---
Created attachment 34430
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34430&action=edit
Proposed fix (in proper patch format)


[Bug libgcc/61666] New: go float32/64 to int64 conversion segfaults on mips32 when libgcc_cv_mips_hard_float=yes

2014-07-01 Thread eswierk at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61666

Bug ID: 61666
   Summary: go float32/64 to int64 conversion segfaults on mips32
when libgcc_cv_mips_hard_float=yes
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libgcc
  Assignee: unassigned at gcc dot gnu.org
  Reporter: eswierk at gmail dot com

Created attachment 33042
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33042&action=edit
Test case

I'm using gccgo 4.9.0 to cross-compile (for mips32 target) a Go program that
converts a float32 or float64 to an int64.  When I run the program on a Cavium
Octeon2 target, the program segfaults when it reaches the conversion (the third
Println in the attached test case).

The problem appears to be related to
https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=207593 .

I rebuilt gccgo, hacking libgcc/configure so that libgcc_cv_mips_hard_float=no.
 With I recompile my program with the modified gccgo, it runs fine.

$ mips-linux-gnu-gccgo -v -g -o blerg blerg.go
Using built-in specs.
COLLECT_GCC=mips-linux-gnu-gccgo
COLLECT_LTO_WRAPPER=/usr/lib/gcc-cross/mips-linux-gnu/4.9/lto-wrapper
Target: mips-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.9.0-9-1blerg1'
--with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.9 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-in\
clude-dir=/usr/mips-linux-gnu/include/c++/4.9.0 --libdir=/usr/lib --enable-nls
--enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes
--enable-gnu-unique-object --disable-libmudflap --disable-libitm
--disable-libsanitizer --disable-libquadmath --enable-plugin --with-system-zlib
--disable-browser-plugin --enable-java-awt=gtk --enable-\
gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-mips-cross/jre
--enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-mips-cross
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-mips-cross
--with-arch-directory=mips --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--disable-libgcj --enable-multiarch --with-arch-32=mip\
s2 --with-tune-32=mips32 --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=mips-linux-gnu
--program-prefix=mips-linux-gnu- --includedir=/usr/mips-linux-gnu/include
Thread model: posix
gcc version 4.9.0 (Debian 4.9.0-9-1blerg1)
COLLECT_GCC_OPTIONS='-v' '-g' '-o' 'blerg' '-shared-libgcc' '-march=mips2'
'-mtune=mips32' '-mllsc' '-mno-shared'
 /usr/lib/gcc-cross/mips-linux-gnu/4.9/go1 blerg.go -quiet -dumpbase blerg.go
-march=mips2 -mtune=mips32 -mllsc -mno-shared -auxbase blerg -g -version
-L/usr/lib/gcc-cross/mips-linux-gnu/4.9
-L/usr/lib/gcc-cross/mips-linux-gnu/4.9/../../../../mips-linux-gnu/lib -o
/tmp/ccYmAhFL.s
GNU Go (Debian 4.9.0-9-1blerg1) version 4.9.0 (mips-linux-gnu)
compiled by GNU C version 4.9.0, GMP version 6.0.0, MPFR version
3.1.2-p3, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU Go (Debian 4.9.0-9-1blerg1) version 4.9.0 (mips-linux-gnu)
compiled by GNU C version 4.9.0, GMP version 6.0.0, MPFR version
3.1.2-p3, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
COLLECT_GCC_OPTIONS='-v' '-g' '-o' 'blerg' '-shared-libgcc' '-march=mips2'
'-mtune=mips32' '-mllsc' '-mno-shared'
 /usr/lib/gcc-cross/mips-linux-gnu/4.9/../../../../mips-linux-gnu/bin/as -v -EB
-O1 -g -no-mdebug -mabi=32 -march=mips2 -mno-shared -mtune=mips32
-mfix-loongson2f-nop -KPIC -o /tmp/ccpszM3o.o /tmp/ccYmAhFL.s
GNU assembler version 2.24.51 (mips-linux-gnu) using BFD version (GNU Binutils
for Debian) 2.24.51.20140425
COMPILER_PATH=/usr/lib/gcc-cross/mips-linux-gnu/4.9/:/usr/lib/gcc-cross/mips-linux-gnu/4.9/:/usr/lib/gcc-cross/mips-linux-gnu/:/usr/lib/gcc-cross/mips-linux-gnu/4.9/:/usr/lib/gcc-cross/mips-linux-gnu/:/usr/lib/gcc-cross/mips-linux-gnu/4.9/../../../../mips-linux-gnu/bin/
LIBRARY_PATH=/usr/lib/gcc-cross/mips-linux-gnu/4.9/:/usr/lib/gcc-cross/mips-linux-gnu/4.9/../../../../mips-linux-gnu/lib/
COLLECT_GCC_OPTIONS='-v' '-g' '-o' 'blerg' '-shared-libgcc' '-march=mips2'
'-mtune=mips32' '-mllsc' '-mno-shared'
 /usr/lib/gcc-cross/mips-linux-gnu/4.9/collect2 -plugin
/usr/lib/gcc-cross/mips-linux-gnu/4.9/liblto_plugin.so
-plugin-opt=/usr/lib/gcc-cross/mips-linux-gnu/4.9/lto-wrapper
-plugin-opt=-fresolution=/tmp/cczxCGt2.res -plugin-opt=-pass-through=-lgcc_s
-plugin-opt=-pa

[Bug libgcc/61666] go float32/64 to int64 conversion segfaults on mips32 when libgcc_cv_mips_hard_float=yes

2014-07-04 Thread eswierk at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61666

Ed Swierk  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #1 from Ed Swierk  ---
The root cause of the problem appears to be the Linux kernel's emulation of
MIPS floating-point branch instructions. To emulate an FP branch instruction
correctly, it copies the next instruction (the branch delay slot) to a
temporary frame on the user stack and executes it there. But if the user stack
is marked non-executable, this causes a segv.

http://www.linux-mips.org/archives/linux-mips/2014-07/msg00032.html