The source code:

  int bar(int x);

  int
  foo(int x)
  {
    return (bar(x + 1));
  }

generates the following assembly code with -O2 and -O3:

foo:
        .mmi
        alloc r34 = ar.pfs, 1, 3, 1, 0
        nop 0
        mov r33 = b0
        .mmi
        mov r35 = r1
        nop 0
        adds r36 = 1, r32
        ;;
        .mib
        nop 0
        nop 0
        br.call.sptk.many b0 = bar#
        ;;
        .mii
        nop 0
        mov b0 = r33
        mov r1 = r35
        .mib
        nop 0
        mov ar.pfs = r34
        br.ret.sptk.many b0

completely missing the tail call. We have confirmed that the x86
compiler handles this properly, as does the 3.2.1 version for ia64


-- 
           Summary: Missed tail calls on ia64
           Product: gcc
           Version: 4.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jsworley at qwest dot net
  GCC host triplet: i686-linux-gnu
GCC target triplet: ia64-linux-gnu


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

Reply via email to