File 2222-erts-Fix-OpenBSD-gcc-compiler-bug-in-re-code.patch of Package erlang
From 32a8787eb7651d41371afdf3f55fd3a77486861d Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Thu, 12 May 2016 17:37:40 +0200
Subject: [PATCH] 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(-)
diff --git a/erts/emulator/beam/erl_bif_re.c b/erts/emulator/beam/erl_bif_re.c
index f4daecd..ff7746c 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;
--
2.1.4