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

cmd/compile: 8MB error message for one char error #6589

Open
griesemer opened this Issue Oct 14, 2013 · 5 comments

Comments

Projects
None yet
3 participants
@griesemer
Copy link
Contributor

griesemer commented Oct 14, 2013

$ cat x.go
package p

type A interface {
    a() interface{AB}
}

type B interface {
    a() interface{AB}
}

type AB interface {
    a() interface{A;B}
    b() interface{A;B}
}

var x AB
var y interface{A;B}
var _ = x == y


$ go tool 6g x.go
x.go:12: duplicate method a
x.go:13: duplicate method a
x.go:17: duplicate method a
x.go:18: invalid operation: x == y (mismatched types AB and interface { a() interface {
a() interface { a() interface { a() interface { a() interface { a() interface { a()
interface { a() interface { a() interface { a() interface { a<...>; a() interface
{ a<...>; b() interface { a<...>; a() interface { a<...>; b()
interface { a<...>; a() interface { a<...>; b() interface { a<...>;
a() interface { a<...>; b() interface { a<...>; a() interface {
a<...>; b() interface { a<...>; a<...> } } } } } } } } } } }; b()
interface { a<...>; a() interface { a() interface { a<...>; a() interface {
a<...>; b() interface { a<...>; a() interface { a<...>; b() interface
{ a<...>; a() interface { a<...>; b() interface { a<...>; a()
interface { a<...>; b() interface { a<...>; a<...> } } } } } } } } };
b() interface { a<...>; a() interface { a() interface { a<...>; a()
interface { a<...>; b() interface { a<...>; a() interface { a<...>;
b() interface { a<...>; a() interface { a<...>; b() interface {
a<...>; a<...> } } } } } } }; b() interface { a<...>; a() interface {
a() interface { a<...>; a() interface { a<...>; b() interface {
a<...>; a() interface { a<...>; b() interface { a<...>; a<...> }
} } } }; b() interface { a<...>; a() interface { a() interface { a<...>; a()
interface { a<...>; b() interface { a<...>; a<...> } } };...


$ go tool 6g x.go | wc
       4 1586257 8248570


When the program is fixed (rename method a in interface B to b), the compiler runs
extremely long:

$ time go tool 6g x.go

real    0m19.170s
user    0m17.352s
sys 0m1.037s


For comparison, for the incorrect program, gccgo reports:

$ gccgo x.go
x.go:12:20: error: inherited method 'a' is ambiguous
      a() interface{A;B}
                    ^
x.go:13:20: error: inherited method 'a' is ambiguous
      b() interface{A;B}
                    ^
x.go:17:17: error: inherited method 'a' is ambiguous
 var y interface{A;B}
                 ^
x.go:18:11: error: incompatible types in binary expression
 var _ = x == y
           ^


For the correct program, gcc does not appear slower than usual.
@remyoudompheng

This comment has been minimized.

Copy link
Contributor

remyoudompheng commented Oct 14, 2013

Comment 1:

I think this is related to issue #1909.
@griesemer

This comment has been minimized.

Copy link
Contributor Author

griesemer commented Oct 16, 2013

Comment 2:

I think you are correct (related to 1909). I've added another example and some analysis
to 1909.
@rsc

This comment has been minimized.

Copy link
Contributor

rsc commented Nov 27, 2013

Comment 3:

Labels changed: added go1.3maybe.

@rsc

This comment has been minimized.

Copy link
Contributor

rsc commented Dec 4, 2013

Comment 4:

Labels changed: added release-none, removed go1.3maybe.

@rsc

This comment has been minimized.

Copy link
Contributor

rsc commented Dec 4, 2013

Comment 5:

Labels changed: added repo-main.

@rsc rsc removed the compiler-bug label Apr 10, 2015

@rsc rsc added this to the Unplanned milestone Apr 10, 2015

@rsc rsc removed release-none labels Apr 10, 2015

@rsc rsc changed the title cmd/gc: 8MB error message for one char error cmd/compile: 8MB error message for one char error Jun 8, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.