From 32a8787eb7651d41371afdf3f55fd3a77486861d Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Thu, 12 May 2016 17:37:40 +0200 Subject: erts: Fix OpenBSD gcc compiler bug in re code The OpenBSD 5.8 gcc compiler emits erroneous code which results in the re:run function behaving badly, though strangely enough it does not segfault the vm. This fix moves code around a bit in order to make gcc emit correct code. --- erts/emulator/beam/erl_bif_re.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'erts/emulator/beam/erl_bif_re.c') diff --git a/erts/emulator/beam/erl_bif_re.c b/erts/emulator/beam/erl_bif_re.c index f4daecd2a4..ff7746ce1d 100644 --- a/erts/emulator/beam/erl_bif_re.c +++ b/erts/emulator/beam/erl_bif_re.c @@ -630,9 +630,15 @@ static Eterm build_exec_return(Process *p, int rc, RestartContext *restartp, Ete } } else { ReturnInfo *ri; - ReturnInfo defri = {RetIndex,0,{0}}; + ReturnInfo defri; if (restartp->ret_info == NULL) { + /* OpenBSD 5.8 gcc compiler for some reason creates + bad code if the above initialization is done + inline with the struct. So don't do that. */ + defri.type = RetIndex; + defri.num_spec = 0; + defri.v[0] = 0; ri = &defri; } else { ri = restartp->ret_info; -- cgit v1.2.3