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: internal compiler error: Segmentation fault during GIMPLE pass: ealias #44383

Closed
ALTree opened this issue Feb 18, 2021 · 3 comments
Closed
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@ALTree
Copy link
Member

ALTree commented Feb 18, 2021

$ gccgo --version
gccgo (Debian 10.2.1-6) 10.2.1 20210110
package main

func main() {
	var b1, b2 byte
	f := func() int {
		var m map[byte]int
		return m[b1/b2]
	}
	f()
}
$ gccgo -O2 crash.go 

during GIMPLE pass: ealias
In function ‘main.main..func1’:
go1: internal compiler error: Segmentation fault
0x7f5b4b547d5f ???
	./signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
0x7f5b4b532d09 __libc_start_main
	../csu/libc-start.c:308
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-10/README.Bugs> for instructions.

cc @ianlancetaylor @thanm

@ALTree ALTree added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Feb 18, 2021
@ALTree ALTree added this to the Gccgo milestone Feb 18, 2021
@thanm
Copy link
Contributor

thanm commented Feb 18, 2021

Looks to be reproduceable on tip:

$ gccgo -O2 -c crash.go
In function ‘main.main..func1’:
go1: error: definition in block 3 does not dominate use in block 9
for SSA_NAME: _3 in statement:
# VUSE <.MEM_13(D)>
_18 = *_3;
during GIMPLE pass: ssa
go1: internal compiler error: verify_ssa failed
0x1081a31 verify_ssa(bool, bool)
	../../gcc-trunk/gcc/tree-ssa.c:1214
0xd8be95 execute_function_todo
	../../gcc-trunk/gcc/passes.c:2049
0xd8cbdc do_per_function
	../../gcc-trunk/gcc/passes.c:1687
0xd8cbdc execute_todo
	../../gcc-trunk/gcc/passes.c:2096

@ALTree ALTree changed the title gccgo: internal compiler error: Segmentation fault gccgo: internal compiler error: Segmentation fault during GIMPLE pass: ealias Feb 18, 2021
@gopherbot
Copy link

Change https://golang.org/cl/300789 mentions this issue: test: add test that caused a gofrontend internal error

@gopherbot
Copy link

Change https://golang.org/cl/300809 mentions this issue: compiler: create temporaries for heap variables

gopherbot pushed a commit that referenced this issue Mar 11, 2021
For #44383

Change-Id: I3610105dad3574e210e226d3ba80a4ba5a7eeaa6
Reviewed-on: https://go-review.googlesource.com/c/go/+/300789
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
nstester pushed a commit to nstester/gcc that referenced this issue Mar 12, 2021
The compiler generally doesn't create a temporary for an expression
that is a variable, because it's normally valid to simply reload the
value from the variable.  However, if the variable is in the heap,
then loading the value is a pointer indirection.  The process of
creating GCC IR can cause the variable load and the pointer
indirection to be split, such that the second evaluation only does the
pointer indirection.  If there are conditionals in between the two
uses, this can cause the second use to load the pointer from an
uninitialized register.

Avoid this by introducing a new Expression method that returns whether
it is safe to evaluate an expression multiple times, and use it
everywhere.

The test case is https://golang.org/cl/300789.

Fixes golang/go#44383

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/300809
@golang golang locked and limited conversation to collaborators Mar 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants