www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19054] New: alloca() crashes with SEGFAULT after an exception


          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 puremagic.com
          Reporter: tomer 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);

    try {
        throw new Exception("foo");
    catch (Exception ex) {

    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


Jul 04 2018