Skip to content

runtime: stepflt 0x10ca4 0xeebf8bc2 Unsupported floating point instruction #7038

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gopherbot opened this issue Dec 31, 2013 · 7 comments
Closed
Milestone

Comments

@gopherbot
Copy link
Contributor

by andrea.fazzi@alcacoop.it:

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.

1. Run the following program on a Raspberry PI:

http://play.golang.org/p/oaT1Gm_4sZ

What is the expected output?

I expect the application doesn't crash.

What do you see instead?

The application crashes with a SIGILL: illegal instruction. Stacktrace follows:

go run main.go
SIGILL: illegal instruction
PC=0x10c90

main.HomogRotate3D(0x3d4ccccd, 0x0, 0x3f800000, 0x0, 0x0, ...)
    /home/pi/src/raspberry_issue/main.go:12 +0x90 fp=0xb6e3cf2c
main.main()
    /home/pi/src/raspberry_issue/main.go:19 +0x70 fp=0xb6e3cf8c
runtime.main()
    /home/pi/src/go/src/pkg/runtime/proc.c:220 +0x100 fp=0xb6e3cfc0
runtime.goexit()
    /home/pi/src/go/src/pkg/runtime/proc.c:1394 fp=0xb6e3cfc0

goroutine 2 [runnable]:
runtime.MHeap_Scavenger()
    /home/pi/src/go/src/pkg/runtime/mheap.c:439
runtime.goexit()
    /home/pi/src/go/src/pkg/runtime/proc.c:1394

trap    0x6
error   0x0
oldmask 0x0
r0      0x0
r1      0x2
r2      0x0
r3      0x0
r4      0x0
r5      0x0
r6      0x0
r7      0x104c26
r8      0xc24e107e
r9      0x64170
r10     0x10301140
fp      0x407b8
ip      0xb6e3ceb0
sp      0xb6e3cec4
lr      0x29298
pc      0x10c90
cpsr    0x60000010
fault   0x0
exit status 2


Which compiler are you using (5g, 6g, 8g, gccgo)?

5g

Which operating system are you using?

$ cat /etc/debian_version 
7.0

$ uname -r
3.6.11-rpi-aufs

Which version are you using?  (run 'go version')

$ go version
go version go1.2 linux/arm

$ cat /proc/cpuinfo
Processor   : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS    : 697.95
Features    : swp half thumb fastmult vfp edsp java tls 
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part    : 0xb76
CPU revision    : 7

Hardware    : BCM2708
Revision    : 000e
Serial      : 00000000b7d2dc6f
@gopherbot
Copy link
Contributor Author

Comment 1 by andrea.fazzi@alcacoop.it:

The program doesn't crash anymore when the following patch is applied:
--- main.go.original    2013-12-31 00:49:27.353031123 +0100
+++ main.go 2013-12-31 08:36:19.763468679 +0100
@@ -9,7 +9,8 @@
 
 func HomogRotate3D(angle float32, axis Vec3f) Mat4f {
    x, y, z := axis[0], axis[1], axis[2]
-   s, c := float32(math.Sin(float64(angle))), float32(math.Cos(float64(angle)))
+   s := float32(math.Sin(float64(angle)))
+   c := float32(math.Cos(float64(angle)))
    k := 1 - c
    return Mat4f{x*x*k + c, x*y*k + z*s, x*z*k - y*s, 0, x*y*k - z*s, y*y*k + c, y*z*k + x*s, 0, x*z*k + y*s, y*z*k - x*s, z*z*k + c, 0, 0, 0, 0, 1}
 }

@davecheney
Copy link
Contributor

Comment 2:

It looks like your Go install has GOARM=5 hard coded.
udoo(~/src) % GOARM=6 go run boom.go                                            
udoo(~/src) % GOARM=5 go run boom.go 
stepflt 0x10ca4 0xeebf8bc2
Unsupported floating point instruction
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x347f0]
goroutine 1 [running]:
runtime.panic(0x39518, 0x6d348)
        /home/dfc/go/src/pkg/runtime/panic.c:264 +0x134
runtime: unexpected return pc for stepflt called from 0x0
goroutine 2 [runnable]:
runtime.MHeap_Scavenger()
        /home/dfc/go/src/pkg/runtime/mheap.c:439
runtime.goexit()
        /home/dfc/go/src/pkg/runtime/proc.c:1394
exit status 2
Applying the fix,
//        s, c := float32(math.Sin(float64(angle))), float32(math.Cos(float64(angle)))
        s := float32(math.Sin(float64(angle)))
          c := float32(math.Cos(float64(angle)))
solves the runtime error. I think we have to teach the soft float impl how to handle
this opcode, and you should figure out why your Go install is compiled in softfloat mode.

Labels changed: added release-go1.3, repo-main, arch-arm.

Status changed to Accepted.

@davecheney
Copy link
Contributor

Comment 3:

I think there might be two issues here.
1. stepflt cannot handle this instruction, because it is new, we've never seen it before
2. because it's a new instruction, it may actually be a VFPv3 instruction, not a VFPv1
(bcm2385) instruction so will need to be gated using GOARM=7 as we do for vmov (?).
I'll crack out my RPi later this evening and check item 2 and create a related issue if
this is indeed the case.

@davecheney
Copy link
Contributor

Comment 4:

@andrea, sorry I didn't believe you, and now I've made a mess out of these issues. 
I'll leave this one for the softfloat issue and have opened issue #7044 for the RPi issue.

@gopherbot
Copy link
Contributor Author

Comment 5 by andrea.fazzi@alcacoop.it:

Doubt is the basis of science :) 
I think I've got a similar issue running the same code on a Samsung GT-S5280 with a
Cortex A5 CPU. This time it doesn't SIGILL but the calculation inside HomogRotate3D is
wrong and produces a corrupted rendering. Should I open a new issue once I'll be able to
produce a more detailed report?

@davecheney
Copy link
Contributor

Comment 6:

Yes, have a look at the instruction generated in the other issue. It's trying to sign
extend a fixed point (not an int) to a floating point number.
Can you please add something to check the output of the function and post that in the
issue body.

@davecheney
Copy link
Contributor

Comment 7:

This isn't a softfloat error, the compiler is generating the wrong opcode.

Status changed to Duplicate.

Merged into issue #7044.

@rsc rsc added this to the Go1.3 milestone Apr 14, 2015
@rsc rsc removed the release-go1.3 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants