[Issue 19054] New: alloca() crashes with SEGFAULT after an exception

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 4 07:23:26 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=19054

          Issue ID: 19054
           Summary: alloca() crashes with SEGFAULT after an exception
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P1
         Component: druntime
          Assignee: nobody at puremagic.com
          Reporter: tomer at weka.io

it seems RCX is corrupt after the exception (which has finished handling and
all), which AFAICT should hold the size of the temp stack size

```
import core.stdc.stdlib: alloca;

void main() {
    void* p1 = alloca(10);
    writeln(p1);

    try {
        throw new Exception("foo");
    }
    catch (Exception ex) {
        writeln(ex.msg);
    }

    void* p2 = alloca(10);  // <<< SEGFAULT on 0x7ffffffff000
    //rax            0x7fffffffd7b0    140737488345008
    //rbx            0x3    3
    //rcx            0x1ffffffffffffcf8    2305843009213693176
    //rdx            0x7fffffffd870    140737488345200
    //rsi            0x7ffffffff000    140737488351232
    //rdi            0x7fffffffeff0    140737488351216
    //rbp            0x7fffffffd900    0x7fffffffd900
    //rsp            0x7fffffffd848    0x7fffffffd848

    writeln(p2);
}
```

--


More information about the Digitalmars-d-bugs mailing list