[LLVMdev] RFA: Problem with Exceptions

Bill Wendling isanbard at gmail.com
Thu Aug 30 15:54:39 PDT 2007


On 8/30/07, Dale Johannesen <dalej at apple.com> wrote:
>
> On Aug 30, 2007, at 3:31 PM, Bill Wendling wrote:
>
> > Hi all,
> >
> > I'm compiling this trivial program on Darwin:
> >
> > int main(int argc, char **argv) {
> >   try {
> >     throw argc;
> >   } catch(int i) {
> >     return i;
> >   }
> >
> >   return 0;
> > }
> >
> > However, it segfaults when I run it. I've attached the .s files
> > generated by LLVM and GCC, but it looks as if LLVM isn't generating a
> > gxx_personality_v0 section (like it does for Unwind_Resume, et al). Is
> > this what's causing the failure? Does anyone know how to get it to
> > generate this section?
>
> The most obvious thing different is that gcc expects the return value
> of the
> throw (EDX) to be 1, while llvm expects it to be 2.  Try changing the
> cmp to 2
> at line 46 to cmp against 1 instead and see if that works.
>
It still fails. :-(

-bw



More information about the llvm-dev mailing list