OSDN Git Service

2011-12-08 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 8 Dec 2011 08:50:35 +0000 (08:50 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 8 Dec 2011 08:50:35 +0000 (08:50 +0000)
PR lto/48437
* lto-streamer-out.c (tree_is_indexable): Exclude block-local
extern declarations.

* gcc.dg/lto/20111207-2_0.c: New testcase.
* gcc.dg/guality/pr48437.c: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182100 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/lto-streamer-out.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/guality/pr48437.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/lto/20111207-2_0.c [new file with mode: 0644]

index 5d50a19..325c1e0 100644 (file)
@@ -1,3 +1,9 @@
+2011-12-08  Richard Guenther  <rguenther@suse.de>
+
+       PR lto/48437
+       * lto-streamer-out.c (tree_is_indexable): Exclude block-local
+       extern declarations.
+
 2011-12-07  Andrew Pinski  <apinski@cavium.com>
 
        PR middle-end/45416
index 62cf9a1..655cf89 100644 (file)
@@ -129,6 +129,16 @@ tree_is_indexable (tree t)
   else if (TREE_CODE (t) == VAR_DECL && decl_function_context (t)
           && !TREE_STATIC (t))
     return false;
+  /* If this is a decl generated for block local externs for
+     debug info generation, stream it unshared alongside BLOCK_VARS.  */
+  else if (VAR_OR_FUNCTION_DECL_P (t)
+          /* ???  The following tests are a literal match on what
+             c-decl.c:pop_scope does.  */
+          && TREE_PUBLIC (t)
+          && DECL_EXTERNAL (t)
+          && DECL_CONTEXT (t)
+          && TREE_CODE (DECL_CONTEXT (t)) == FUNCTION_DECL)
+    return false;
   else
     return (TYPE_P (t) || DECL_P (t) || TREE_CODE (t) == SSA_NAME);
 }
index 31b2d2e..ededf04 100644 (file)
@@ -1,3 +1,9 @@
+2011-12-08  Richard Guenther  <rguenther@suse.de>
+
+       PR lto/48437
+       * gcc.dg/lto/20111207-2_0.c: New testcase.
+       * gcc.dg/guality/pr48437.c: Likewise.
+
 2011-12-07  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/51401
diff --git a/gcc/testsuite/gcc.dg/guality/pr48437.c b/gcc/testsuite/gcc.dg/guality/pr48437.c
new file mode 100644 (file)
index 0000000..5346baa
--- /dev/null
@@ -0,0 +1,17 @@
+/* PR lto/48437 */
+/* { dg-do run } */
+/* { dg-options "-g" } */
+
+#include "../nop.h"
+
+int i __attribute__((used));
+int main()
+{
+  volatile int i;
+  for (i = 3; i < 7; ++i)
+    {
+      extern int i;
+      asm volatile (NOP : : : "memory"); /* { dg-final { gdb-test 14 "i" "0" } } */
+    }
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20111207-2_0.c b/gcc/testsuite/gcc.dg/lto/20111207-2_0.c
new file mode 100644 (file)
index 0000000..672db53
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-lto-do run } */
+
+int
+test (void)
+{
+  int f (void);
+  return 0;
+}
+
+int
+main (void)
+{
+  int f (void);
+  int test (void);
+
+  return test ();
+}