[LLVMbugs] [Bug 22421] New: [ms] longjmp doesn't work with /MD (or /MDd) in 64-bit binaries with optimizations

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jan 30 16:04:54 PST 2015


http://llvm.org/bugs/show_bug.cgi?id=22421

            Bug ID: 22421
           Summary: [ms] longjmp doesn't work with /MD (or /MDd) in 64-bit
                    binaries with optimizations
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nicolasweber at gmx.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

D:\src\llvm-ninja-rel64>type jmp_set.cc
#include <setjmp.h>

struct Base {
  virtual void vfun(int argc, char* argv[]) {};
  virtual bool fail() {}
};

struct Sub : Base {
  bool f(int argc, char* argv[]) {
    jmp_buf buf;
    if (setjmp(buf))
        return fail();

    int sum = 0;
    for (int i = 0; i < argc; ++i)
      sum += argv[i][0];

    longjmp(buf, 1);
  }
  virtual void vfun(int argc, char* argv[]) {
    f(argc, argv);
  }
};

int main(int argc, char* argv[]) {
  Base* b = new Sub;
  b->vfun(argc, argv);
}

D:\src\llvm-ninja-rel64>bin\clang-cl -m64 jmp_set.cc /MD
jmp_set.cc(5,24) :  warning: control reaches end of non-void function
[-Wreturn-type]
  virtual bool fail() {}
                       ^
1 warning generated.

D:\src\llvm-ninja-rel64>jmp_set


crashes!

-- 
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/20150131/f53e7267/attachment.html>


More information about the llvm-bugs mailing list