help-rcs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug optimization/14526] New: Parameters passed by reference to inlined


From: uros at kss-loka dot si
Subject: [Bug optimization/14526] New: Parameters passed by reference to inlined function are not optimized away
Date: 11 Mar 2004 09:47:17 -0000

Parameters t1 and t2 in following testcase are not optimized away:

--cut-here--
inline void test(int x, int y, int *foo, int *bar)
{
  *foo = x;
  *bar = y;
}

int main() {
  int x, y;
  int t1, t2;
  int res;

  x = 3;
  y = 6;

  test(x, y, &t1, &t2);
  res = t1 * t2;

  printf ("sd = %i\n", res);

  return 0;
}
--cut-here--

with -O2, main function will be compiled to:
       pushl  %ebp
       movl %esp, %ebp
       subl $24, %esp
       movl $3, -4(%ebp)   <-- load "3" to stack
       andl $-16, %esp
       movl $6, -8(%ebp)   <-- load "6" to stack
       movl -4(%ebp), %eax <-- move "3" from stack to eax
       subl $16, %esp
       movl -8(%ebp), %edx <-- move "6" from stack to edx
       movl $.LC0, (%esp)
       imull  %edx, %eax   <-- multiply
       movl %eax, 4(%esp)
       call printf
       xorl %eax, %eax
       leave
       ret

-- 
           Summary: Parameters passed by reference to inlined function are
                    not optimized away
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: uros at kss-loka dot si
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux
  GCC host triplet: i686-pc-linux
GCC target triplet: i686-pc-linux


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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]