otp icon indicating copy to clipboard operation
otp copied to clipboard

Segfault when using `setelement` and `erlang:system_time`

Open giacomocavalieri opened this issue 1 year ago • 2 comments

Describe the bug Running the following code results in a segmentation fault:

-module(wibble).
-export([a/0]).

a() ->
    C1 = {erlang:system_time(), true},
    C2 = erlang:setelement(2, C1, false),
    C3 = erlang:setelement(2, C2, false),
    b(C3).

b(_) -> erlang:error("crash!").

To Reproduce Compile and run the code:

1> c(wibble).
{ok,wibble}
2> wibble:a().
[1]    56687 segmentation fault  erl

Expected behavior I'd expect to see the exception and not the shell to die with a segfault

Affected versions

  • Erlang/OTP 26 [erts-14.2.5] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit] [dtrace]

Additional information I've asked others and it looks like this only happens on macOS with OTP26, while OTP27 doesn't have the same problem

giacomocavalieri avatar Sep 05 '24 13:09 giacomocavalieri

Thanks for your report, and sorry for taking so long to start working on it. I've fixed it in #8898 :-)

jhogberg avatar Oct 03 '24 15:10 jhogberg

No problem at all, thank you so much! 💜

giacomocavalieri avatar Oct 03 '24 15:10 giacomocavalieri