[llvm-bugs] [Bug 30278] New: fobjc-exceptions does not imply fexceptions

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 5 00:51:43 PDT 2016


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

            Bug ID: 30278
           Summary: fobjc-exceptions does not imply fexceptions
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Driver
          Assignee: unassignedclangbugs at nondot.org
          Reporter: vries at gcc.gnu.org
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Consider basic.m:
...
#import <objc/Object.h>
#import <stdio.h>

int
main (void)
{
  @try {

    printf ("try\n");

    @throw nil;

  } @catch (...) {

    printf ("caught\n");

  }

  printf ("done\n");
  return 0;
}
...

with gcc, we have:
...
$ gcc basic.m -fobjc-exceptions -lobjc && (./a.out ; echo $? )
try
caught
done
0
...

However, with clang, we have:
...
$ clang basic.m -fobjc-exceptions -lobjc && (./a.out ; echo $? )
try
Aborted (core dumped)
134
...

Only when I add -fexceptions to the clang command line, do I get the same:
...
try
caught
done
0
...

With gcc, -fobjc-exceptions implies -fexceptions (gcc/c-family/c-opts.c):
...
  if (flag_objc_exceptions && !flag_objc_sjlj_exceptions)
    flag_exceptions = 1;
...

-- 
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/20160905/3f6b304d/attachment-0001.html>


More information about the llvm-bugs mailing list