[llvm-bugs] [Bug 39935] New: libunwind (SEH on MinGW) : segfault during unwinding

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Dec 10 02:36:41 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=39935

            Bug ID: 39935
           Summary: libunwind (SEH on MinGW) : segfault during unwinding
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: jeanmichael.celerier at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

Created attachment 21209
  --> https://bugs.llvm.org/attachment.cgi?id=21209&action=edit
code that reproduces the problem

Hello,
I originally posted this issue here :
https://github.com/mstorsjo/llvm-mingw/issues/25  

The attached repro gives an example which causes a segfault (with the
llvm-mingw toolchain)
The build.sh script will build a code and launch the program in the case which
causes the problem (segfault while unwinding). There are a bunch of files but
the actual stack trace is very short and only spans two files (main.cpp and
parser/sourcereader.cpp):

Thread 1 hit Catchpoint 1 (exception thrown), 0x0000000140010a90 in __cxa_throw
()
(gdb) bt
#0  0x0000000140010a90 in __cxa_throw ()
#1  0x000000014000657d in SourceReader::parseLocal (this=<optimized out>,
    fname=<optimized out>) at C:/dev/repro-except/parser\sourcereader.cpp:93
#2  0x0000000140006235 in SourceReader::parseFile (this=<optimized out>,
    fname=<optimized out>) at C:/dev/repro-except/parser\sourcereader.cpp:84
#3  0x000000014000c4fa in compileFaustFactory (argc=<optimized out>,
    argv=0x524250, name=<optimized out>, dsp_content=<optimized out>,
    error_msg=..., generate=<optimized out>)
    at C:/dev/repro-except\main.cpp:21
#4  0x000000014000c668 in main (argc=<optimized out>,
    argv=0x140012260 <typeinfo for faustexception>)
    at C:/dev/repro-except\main.cpp:33


The smallest change to the code path, for instance changing parseLocal from : 


Tree SourceReader::parseLocal(const char* fname)
{
    stringstream error;

    throw faustexception("blah");
    return gGlobal->gResult;
}

to

Tree SourceReader::parseLocal(const char* fname)
{
    throw faustexception("blah");
    return gGlobal->gResult;
}


or removing the untaken if branch in sourcereader.cpp:79, makes the problem go
away.

Also, it works at -O1, it's only starting from -O2 that it fails.

The same code works fine with clang on both linux and macos.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181210/32663b03/attachment.html>


More information about the llvm-bugs mailing list