Skip to content
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

gccgo: compiles weird construct #11561

Closed
dvyukov opened this issue Jul 3, 2015 · 2 comments
Closed

gccgo: compiles weird construct #11561

dvyukov opened this issue Jul 3, 2015 · 2 comments
Milestone

Comments

@dvyukov
Copy link
Member

dvyukov commented Jul 3, 2015

gccgo successfully compiles the following program:

package main
import "fmt"

func main() {
    var a = complex()()
    var i interface{} = a
    fmt.Printf("i: %T %#v\n", i, i)
    fmt.Printf("a: %T %#v\n", a, a)
    fmt.Printf("i: %T %#v\n", i, i)
}

The program panics when executed:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0]

goroutine 16 [running]:
reflect.rawString.pN13_reflect.rtype
    ../../../libgo/go/reflect/type.go:467
reflect.canonicalize
    ../../../libgo/go/reflect/type.go:1943
reflect.toType
    ../../../libgo/go/reflect/type.go:1964
reflect.TypeOf
    ../../../libgo/go/reflect/type.go:1032
fmt.printArg.pN6_fmt.pp
    ../../../libgo/go/fmt/print.go:745
fmt.doPrintf.pN6_fmt.pp
    ../../../libgo/go/fmt/print.go:1183
fmt.Fprintf
    ../../../libgo/go/fmt/print.go:188
fmt.Printf
    ../../../libgo/go/fmt/print.go:197
main.main
    /tmp/111.go:7
created by main
    ../../../libgo/runtime/go-main.c:48

gcc version 6.0.0 2015070 (experimental) (GCC)

@dvyukov
Copy link
Member Author

dvyukov commented Jul 3, 2015

@paranoiacblack

@gopherbot
Copy link
Contributor

CL https://golang.org/cl/12778 mentions this issue.

vries pushed a commit to vries/gcc that referenced this issue Aug 1, 2015
    
    Errors reported from malformed builtin calls are handled in a later
    pass than the one in which they are detected.  If a malformed builtin
    call is lowered into an error expression too early, these errors will
    never be reported.
    
    Fixes golang/go#11561.
    
    Reviewed-on: https://go-review.googlesource.com/12778


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226459 138bc75d-0d04-0410-961f-82ee72b054a4
@golang golang locked and limited conversation to collaborators Aug 5, 2016
asiekierka pushed a commit to WonderfulToolchain/gcc-ia16 that referenced this issue May 16, 2022
    
    Errors reported from malformed builtin calls are handled in a later
    pass than the one in which they are detected.  If a malformed builtin
    call is lowered into an error expression too early, these errors will
    never be reported.
    
    Fixes golang/go#11561.
    
    Reviewed-on: https://go-review.googlesource.com/12778

From-SVN: r226459
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

4 participants