3 changed files with 28 additions and 135 deletions
			
			
		@ -1,111 +0,0 @@
					 | 
				
			||||
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
 | 
				
			||||
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
 | 
				
			||||
#
 | 
				
			||||
# Filename: package/.../gcc/gcc47-pr33763.patch
 | 
				
			||||
# Copyright (C) 2012 The OpenSDE Project
 | 
				
			||||
#
 | 
				
			||||
# More information can be found in the files COPYING and README.
 | 
				
			||||
#
 | 
				
			||||
# This patch file is dual-licensed. It is available under the license the
 | 
				
			||||
# patched project is licensed under, as long as it is an OpenSource license
 | 
				
			||||
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
 | 
				
			||||
# of the GNU General Public License as published by the Free Software
 | 
				
			||||
# Foundation; either version 2 of the License, or (at your option) any later
 | 
				
			||||
# version.
 | 
				
			||||
# --- SDE-COPYRIGHT-NOTE-END ---
 | 
				
			||||
 | 
				
			||||
From ceae6595da8f4f3c7cda06a654e251f0d1bc4976 Mon Sep 17 00:00:00 2001
 | 
				
			||||
From: jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
 | 
				
			||||
Date: Fri, 5 Oct 2012 11:58:46 +0000
 | 
				
			||||
Subject: [PATCH] 	PR tree-optimization/33763
 | 
				
			||||
 	* tree-inline.c (expand_call_inline): Silently ignore always_inline
 | 
				
			||||
 	attribute for redefined extern inline functions.
 | 
				
			||||
 | 
				
			||||
	* c-c++-common/pr33763.c: New test.
 | 
				
			||||
 | 
				
			||||
diff --git a/gcc/testsuite/c-c++-common/pr33763.c b/gcc/testsuite/c-c++-common/pr33763.c
 | 
				
			||||
new file mode 100644
 | 
				
			||||
index 0000000..dbdfa77
 | 
				
			||||
--- /dev/null
 | 
				
			||||
+++ b/gcc/testsuite/c-c++-common/pr33763.c
 | 
				
			||||
@@ -0,0 +1,60 @@
 | 
				
			||||
+/* PR tree-optimization/33763 */
 | 
				
			||||
+/* { dg-do compile } */
 | 
				
			||||
+/* { dg-options "-O2" } */
 | 
				
			||||
+
 | 
				
			||||
+typedef struct
 | 
				
			||||
+{
 | 
				
			||||
+  void *a;
 | 
				
			||||
+  void *b;
 | 
				
			||||
+} T;
 | 
				
			||||
+extern void *foo (const char *, const char *);
 | 
				
			||||
+extern void *bar (void *, const char *, T);
 | 
				
			||||
+extern int baz (const char *, int);
 | 
				
			||||
+
 | 
				
			||||
+extern inline __attribute__ ((always_inline, gnu_inline)) int
 | 
				
			||||
+baz (const char *x, int y)
 | 
				
			||||
+{
 | 
				
			||||
+  return 2;
 | 
				
			||||
+}
 | 
				
			||||
+
 | 
				
			||||
+int
 | 
				
			||||
+baz (const char *x, int y)
 | 
				
			||||
+{
 | 
				
			||||
+  return 1;
 | 
				
			||||
+}
 | 
				
			||||
+
 | 
				
			||||
+int xa, xb;
 | 
				
			||||
+
 | 
				
			||||
+static void *
 | 
				
			||||
+inl (const char *x, const char *y)
 | 
				
			||||
+{
 | 
				
			||||
+  T t = { &xa, &xb };
 | 
				
			||||
+  int *f = (int *) __builtin_malloc (sizeof (int));
 | 
				
			||||
+  const char *z;
 | 
				
			||||
+  int o = 0;
 | 
				
			||||
+  void *r = 0;
 | 
				
			||||
+
 | 
				
			||||
+  for (z = y; *z; z++)
 | 
				
			||||
+    {
 | 
				
			||||
+      if (*z == 'r')
 | 
				
			||||
+	o |= 1;
 | 
				
			||||
+      if (*z == 'w')
 | 
				
			||||
+	o |= 2;
 | 
				
			||||
+    }
 | 
				
			||||
+  if (o == 1)
 | 
				
			||||
+    *f = baz (x, 0);
 | 
				
			||||
+  if (o == 2)
 | 
				
			||||
+    *f = baz (x, 1);
 | 
				
			||||
+  if (o == 3)
 | 
				
			||||
+    *f = baz (x, 2);
 | 
				
			||||
+
 | 
				
			||||
+  if (o && *f > 0)
 | 
				
			||||
+    r = bar (f, "w", t);
 | 
				
			||||
+  return r;
 | 
				
			||||
+}
 | 
				
			||||
+
 | 
				
			||||
+void *
 | 
				
			||||
+foo (const char *x, const char *y)
 | 
				
			||||
+{
 | 
				
			||||
+  return inl (x, y);
 | 
				
			||||
+}
 | 
				
			||||
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
 | 
				
			||||
index 349e0b0..5854bd9 100644
 | 
				
			||||
--- a/gcc/tree-inline.c
 | 
				
			||||
+++ b/gcc/tree-inline.c
 | 
				
			||||
@@ -3836,6 +3836,12 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id)
 | 
				
			||||
 	goto egress;
 | 
				
			||||
 
 | 
				
			||||
       if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn))
 | 
				
			||||
+          /* For extern inline functions that get redefined we always
 | 
				
			||||
+	     silently ignored always_inline flag. Better behaviour would
 | 
				
			||||
+	     be to be able to keep both bodies and use extern inline body
 | 
				
			||||
+	     for inlining, but we can't do that because frontends overwrite
 | 
				
			||||
+	     the body.  */
 | 
				
			||||
+	  && !cg_edge->callee->local.redefined_extern_inline
 | 
				
			||||
 	  /* Avoid warnings during early inline pass. */
 | 
				
			||||
 	  && cgraph_global_info_ready
 | 
				
			||||
 	  /* PR 20090218-1_0.c. Body can be provided by another module. */
 | 
				
			||||
-- 
 | 
				
			||||
1.7.3.4
 | 
				
			||||
 | 
				
			||||
					Loading…
					
					
				
		Reference in new issue