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]

PATCH: Fix optimization/12180


This patch fixes optimization/12180 whereby we tried to inline
functions that made use of (certain) varargs primitives.

Tested on i686-pc-linux-gnu, applied on the mainline and on the
branch.

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2003-10-02  Mark Mitchell  <mark@codesourcery.com>

	PR optimization/12180
	* tree-inline.c (inline_forbidden_p_1): Do not permit inlining of
	functions containing calls to 

2003-10-02  Mark Mitchell  <mark@codesourcery.com>

	PR optimization/12180
	* gcc.dg/20031002-1.c: New test.

Index: tree-inline.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-inline.c,v
retrieving revision 1.77
diff -c -5 -p -r1.77 tree-inline.c
*** tree-inline.c	16 Sep 2003 07:58:23 -0000	1.77
--- tree-inline.c	2 Oct 2003 23:59:14 -0000
*************** inline_forbidden_p_1 (tree *nodep, int *
*** 918,927 ****
--- 918,929 ----
  	{
  	  /* 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:
  	  {
  	    inline_forbidden_reason = "%Hfunction '%F' can never be inlined "
  				      "because it uses variable argument lists";
  	    return node;
  	  }
Index: testsuite/gcc.dg/20031002-1.c
===================================================================
RCS file: testsuite/gcc.dg/20031002-1.c
diff -N testsuite/gcc.dg/20031002-1.c
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/gcc.dg/20031002-1.c	2 Oct 2003 23:59:14 -0000
***************
*** 0 ****
--- 1,14 ----
+ /* { dg-do compile } */
+ /* { dg-options "-O3" } */
+ 
+ void generic_sendmsg (char *fmt, ...)
+ {
+   __builtin_next_arg(fmt);
+ }
+ 
+ void generic_sendstat()
+ {
+   double t;
+ 
+   generic_sendmsg("F %3.2f", t);
+ }


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