diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-01-12 09:43:31 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-01-12 09:43:31 +0000 |
commit | 9f28a7ee8ff2cd44964cffaa0e12a87664cf2dba (patch) | |
tree | cf837610df26a25fc371d690acc9bce414016e16 | |
parent | e97b7d029f5cf233b6c256ebabc29f1619083369 (diff) | |
download | gcc-9f28a7ee8ff2cd44964cffaa0e12a87664cf2dba.tar.gz |
PR tree-optimization/42645
* tree-inline.c (processing_debug_stmt): Move earlier. Make static.
(remap_ssa_name): If processing_debug_stmt and name wasn't found in
decl_map, set processing_debug_stmt to -1 and return name without
any remapping.
* g++.dg/other/pr42645-1.C: New test.
* g++.dg/other/pr42645-2.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155830 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/pr42645-1.C | 26 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/pr42645-2.C | 34 | ||||
-rw-r--r-- | gcc/tree-inline.c | 20 |
5 files changed, 87 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b233eb61e05..47491c08311 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2010-01-12 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/42645 + * tree-inline.c (processing_debug_stmt): Move earlier. Make static. + (remap_ssa_name): If processing_debug_stmt and name wasn't found in + decl_map, set processing_debug_stmt to -1 and return name without + any remapping. + 2010-01-11 Dave Korn <dave.korn.cygwin@gmail.com> * doc/install.texi (Specific#x-x-cygwin): Document minimum required diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0093948d36e..cc978cd3bd4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2010-01-12 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/42645 + * g++.dg/other/pr42645-1.C: New test. + * g++.dg/other/pr42645-2.C: New test. + 2010-01-11 Janis Johnson <janis187@us.ibm.com> PR target/42416 diff --git a/gcc/testsuite/g++.dg/other/pr42645-1.C b/gcc/testsuite/g++.dg/other/pr42645-1.C new file mode 100644 index 00000000000..5dc76f9efd9 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/pr42645-1.C @@ -0,0 +1,26 @@ +// PR tree-optimization/42645 +// { dg-do compile } +// { dg-options "-fcompare-debug -O1" } + +extern void foo (); + +struct S +{ + struct T + { + int t1; + char t2[4]; + T *t3; + } t; + int m1 () const { return t.t3[0].t1; } + char *m2 () { foo (); } + void m3 (int x) { char *m = m2 (); if (m1 () > 0 && x > 0); } + void m4 () { if (m1 () > 0) for (int i = 0; i < 4; i++) t.t2[i] = 0; } +}; + +void +f (S *a) +{ + a->m3 (0); + a->m4 (); +} diff --git a/gcc/testsuite/g++.dg/other/pr42645-2.C b/gcc/testsuite/g++.dg/other/pr42645-2.C new file mode 100644 index 00000000000..67632e51d91 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/pr42645-2.C @@ -0,0 +1,34 @@ +// PR tree-optimization/42645 +// { dg-do compile } +// { dg-options "-fcompare-debug -O1" } + +struct C +{ + bool b; + C (); +}; + +static inline C *foo () {} + +extern void f4 (); + +static inline int +f3 () +{ + f4 (); +} + +static inline void +f2 (bool b) +{ + int tmp = f3 (); + if (C ().b && b) + C (); +} + +void +f1 () +{ + C *c = foo (); + f2 (c->b); +} diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index aacd903bac5..883a431c7ff 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -1,5 +1,5 @@ /* Tree inlining. - Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 + Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. Contributed by Alexandre Oliva <aoliva@redhat.com> @@ -171,6 +171,12 @@ insert_debug_decl_map (copy_body_data *id, tree key, tree value) *pointer_map_insert (id->debug_map, key) = value; } +/* If nonzero, we're remapping the contents of inlined debug + statements. If negative, an error has occurred, such as a + reference to a variable that isn't available in the inlined + context. */ +static int processing_debug_stmt = 0; + /* Construct new SSA name for old NAME. ID is the inline context. */ static tree @@ -185,6 +191,12 @@ remap_ssa_name (tree name, copy_body_data *id) if (n) return unshare_expr (*n); + if (processing_debug_stmt) + { + processing_debug_stmt = -1; + return name; + } + /* Do not set DEF_STMT yet as statement is not copied yet. We do that in copy_bb. */ new_tree = remap_decl (SSA_NAME_VAR (name), id); @@ -244,12 +256,6 @@ remap_ssa_name (tree name, copy_body_data *id) return new_tree; } -/* If nonzero, we're remapping the contents of inlined debug - statements. If negative, an error has occurred, such as a - reference to a variable that isn't available in the inlined - context. */ -int processing_debug_stmt = 0; - /* Remap DECL during the copying of the BLOCK tree for the function. */ tree |