http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48137

           Summary: [4.6/4.7 Regression] "sorry, unimplemented: inlining
                    failed in call to 'cb'" with -fnon-call-exceptions
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: zso...@seznam.cz
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu


Created attachment 23667
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23667
reduced testcase

Compiler output:
$ gcc -O -fipa-cp -fnon-call-exceptions testcase.c                       
testcase.c: In function 'f1':
testcase.c:3:52: sorry, unimplemented: inlining failed in call to 'cb': 
testcase.c:10:6: sorry, unimplemented: called from here

Compilation succeeds when either:
a) __attribute__ ((always_inline)) is removed from cb()
b) -fnon-call-exceptions is removed
c) -fipa-cp is removed
d) *p (dereferencing null pointer) is removed

(e) -O is removed)

In all a,b,c,d cases, the generated code is:
f1:
.LFB3:
    .cfi_startproc
    addl    $1, x(%rip)
    ret
    .cfi_endproc

so the (possibly causing exception?) *p is removed. (even when it is declared
as "volatile int *")

This seems to be a recent regression, as r170436 seems to work fine (generated
code is the same as above). Also, r170436 (and 4.5.2) generates write to *p if
it is "volatile int *".

I don't know what's the expected behaviour, but removing write to null pointer
looks strange.

Tested revisions:
r170964 - fail
r170436 - OK
4.5.2 - OK

Reply via email to