This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: tree inline bug and fix


Hi Roger,

On Sat, 8 Nov 2003, Roger Sayle wrote:

> Re: http://gcc.gnu.org/ml/gcc-patches/2003-11/msg00199.html
>
> Hi Alexey,
>
> On Mon, 3 Nov 2003, Alexey Starovoytov wrote:
> > I believe there is a bug in the function "inline_forbidden_p"
> > in the file "c-objc-common.c".
> > It is possible that function declaration 't' has a non-zero
> > DECL_FUNCTION_CODE (t) field and 't' is not a BUILT_IN function.
> > (In other words t->decl.u1.f != 0 and t->decl.built_in_class == 0)
>
> The patch itself is OK.  I see you already have a copyright assignment
> on file.  However, you must also post a proposed ChangeLog entry with
> patch submissions.  This is even more important if you don't yet have
> CVS write access and someone else will need to commit it for you.  You
> also need to list the target triples you tested on, and whether there
> were any changes in testsuite results.
>
> Please could you post an updated patch with all the required information
> and I'll approve it/apply it for you.  Don't forget to mention
> "PR optimization/12953" in the new ChangeLog entry.
>
> Also feel free to delete the "#if 0" section touched by your change.
> Its reasonable to call builtin_return_address in an inlined function,
> but the result will/should be the return address of the function its
> inlined into.  Anyone aware of this GCC builtin should also be aware of
> GCC's noinline attribute, if their use of the return address is unsafe
> when inlining.
>
> Many thanks.
>
> Roger
> --

I've tested on x86_64-unknown-linux-gnu and observed no new failures
with applied patch comparing to non-patched output.

Here are the "ChangeLog" and "c-objc-common.c" diffs based on
GCC 3.3.2 release:


diff -rc3pN ChangeLog.orig ChangeLog
*** ChangeLog.orig      2003-11-10 22:06:07.000000000 -0800
--- ChangeLog   2003-11-10 22:11:42.000000000 -0800
***************
*** 1,3 ****
--- 1,9 ----
+ 2003-11-10  Alexey Starovoytov  <alexey.starovoytov@sun.com>
+
+       PR optimization/12953
+       * c-objc-common.c (inline_forbidden_p): Added check for BUILT_IN
+       before switch by FUNCTION_CODE.
+
  2003-10-16  Release Manager

        * GCC 3.3.2 Released.



diff -rc3pN c-objc-common.c.orig c-objc-common.c
*** c-objc-common.c.orig        2003-11-10 21:45:18.000000000 -0800
--- c-objc-common.c     2003-11-10 21:47:07.000000000 -0800
*************** inline_forbidden_p (nodep, walk_subtrees
*** 88,111 ****
        if (setjmp_call_p (t))
        return node;

!       switch (DECL_FUNCTION_CODE (t))
!       {
!         /* We cannot inline functions that take a variable number of
!            arguments.  */
!       case BUILT_IN_VA_START:
!       case BUILT_IN_STDARG_START:
!       case BUILT_IN_NEXT_ARG:
!       case BUILT_IN_VA_END:
! #if 0
!         /* Functions that need information about the address of the
!              caller can't (shouldn't?) be inlined.  */
!       case BUILT_IN_RETURN_ADDRESS:
! #endif
!         return node;
!
!       default:
!         break;
!       }

        break;

--- 88,107 ----
        if (setjmp_call_p (t))
        return node;

!       if (DECL_BUILT_IN (t))
!         switch (DECL_FUNCTION_CODE (t))
!         {
!           /* We cannot inline functions that take a variable number of
!              arguments.  */
!         case BUILT_IN_VA_START:
!         case BUILT_IN_STDARG_START:
!         case BUILT_IN_NEXT_ARG:
!         case BUILT_IN_VA_END:
!           return node;
!
!         default:
!           break;
!         }

        break;


I believe that's all you need to check the patch in, since I don't have
CVS write access.

Regards,
Alexey.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]