LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 1439 - invoke has no landing pad after codegen
Summary: invoke has no landing pad after codegen
Status: RESOLVED FIXED
Alias: None
Product: new-bugs
Classification: Unclassified
Component: new bugs (show other bugs)
Version: unspecified
Hardware: Other Linux
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-22 16:10 PDT by Duncan Sands
Modified: 2010-02-22 12:47 PST (History)
2 users (show)

See Also:
Fixed By Commit(s):


Attachments
testcase .ll (7.87 KB, text/plain)
2007-05-22 16:11 PDT, Duncan Sands
Details
original .cpp (420 bytes, text/plain)
2007-05-22 16:18 PDT, Duncan Sands
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Duncan Sands 2007-05-22 16:10:30 PDT
In the testcase there are two calls to @__cxa_throw,
one of which is an invoke the other a normal call.
[Only the invoke one should be called when the program
is run].
After codegen
  llc -enable-eh -asm-verbose e.bc
there is only one call to @__cxa_throw but it
is the wrong one!  First of all, from the assembler
comment (#finally) you can see that it is the normal
call version that got put in (the other is in finally.i):

.LBB2_1:        #finally
        movl $_ZTI1A, 4(%esp)
        movl $_ZN1AD1Ev, 8(%esp)
        movl %esi, (%esp)
        call __cxa_throw
.LBB2_2:        #unwind

Secondly, in the exception handling table there is no
landing pad for this code range, there is only

        .long   .Llabel4-.Leh_func_begin2       # Region start
        .long   .Llabel5-.Llabel4       # Region length
        .long   0x0     # Landing pad
        .uleb128        0       # Action

which does not cover this.

My guess is that codegen cleverly saw that it could collapse
the two calls to @__cxa_throw into one call, thinking that they
were equivalent, without noticing that they differed in that
one was an invoke.
Comment 1 Duncan Sands 2007-05-22 16:11:03 PDT
Created attachment 865 [details]
testcase .ll
Comment 2 Duncan Sands 2007-05-22 16:18:19 PDT
Created attachment 866 [details]
original .cpp
Comment 3 Dale Johannesen 2007-05-22 16:32:33 PDT
Is this a new regression?
Comment 4 Duncan Sands 2007-05-22 16:50:23 PDT
> Is this a new regression?

I don't know.
Comment 5 Dale Johannesen 2007-05-22 17:20:56 PDT
Tail merging, mine.
Comment 6 Dale Johannesen 2007-05-22 19:33:10 PDT
Wrong again, this fails identically with tail merging turned off.  Nor is it branch folding.  I do not 
understand how this works well enough to figure it out.
Comment 7 Anton Korobeynikov 2007-05-23 04:43:16 PDT
Dale, this is EH issue.

<aKor> The problem is:
<aKor> 1. Call is known to throw
<aKor> 2. But, it's outside any EH scope
<aKor> we're not creating invoke in this case
<aKor> this is right
<baldrick> inside f() it is; however the call to f() is an invoke
<aKor> yes
<baldrick> I mean, inside f() it is outside any eh scope
<baldrick> doesn't this just indicate that stack unwinding is not working properly?
<aKor> yes, in some sence:
<aKor> if there won't be frame with personality function specified, it will
unwind upper by default
<aKor> by when we have personality function, we should mark every call as "can
throw" and emit null LPs
<aKor> (this is how gcc does)
<aKor> so, this is some sort of "invalid EH information emitted" :)