This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix is_gimple_tmp_var
- From: neroden at twcny dot rr dot com (Nathanael Nerode)
- To: gcc-patches at gcc dot gnu dot org, kenner at vlsi1 dot ultra dot nyu dot edu, gcc at gcc dot gnu dot org
- Date: Fri, 13 Aug 2004 21:50:35 -0400
- Subject: [PATCH] Fix is_gimple_tmp_var
This patch should fix Richard Kenner's Ada problem (and likely
other unrecognized problems too, given that it's a latent bug).
It is currently untested, but I figured given the simplicity and size of
the patch, and its potential importance, I should submit it now. Testing
it for regressions will take much longer than writing it did; and I can't
test on on Ada (but I hope you can, Richard!)
* tree.h (struct tree_decl): Add gimple_tmp_var bit and
macro to test it.
* tree-gimple.c (is_gimple_tmp_var): Use the bit.
* gimplify.c (create_tmp_var_raw): Set the bit.
Index: gimplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gimplify.c,v
retrieving revision 2.62
diff -u -r2.62 gimplify.c
--- gimplify.c 12 Aug 2004 03:54:11 -0000 2.62
+++ gimplify.c 14 Aug 2004 01:40:55 -0000
@@ -326,6 +326,8 @@
DECL_ARTIFICIAL (tmp_var) = 1;
/* And we don't want debug info for it. */
DECL_IGNORED_P (tmp_var) = 1;
+ /* It has certain guaranteed properties due to the way we generated it. */
+ DECL_GIMPLE_TMP_VAR (tmp_var) = 1;
/* Make the variable writable. */
TREE_READONLY (tmp_var) = 0;
Index: tree-gimple.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-gimple.c,v
retrieving revision 2.21
diff -u -r2.21 tree-gimple.c
--- tree-gimple.c 12 Aug 2004 14:33:58 -0000 2.21
+++ tree-gimple.c 14 Aug 2004 01:40:57 -0000
@@ -450,7 +450,8 @@
is_gimple_tmp_var (tree t)
{
/* FIXME this could trigger for other local artificials, too. */
- return (TREE_CODE (t) == VAR_DECL && DECL_ARTIFICIAL (t)
+ return (TREE_CODE (t) == VAR_DECL
+ && DECL_ARTIFICIAL (t) && DECL_GIMPLE_TMP_VAR (t)
&& !TREE_STATIC (t) && !DECL_EXTERNAL (t));
}
Index: tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.h,v
retrieving revision 1.587
diff -u -r1.587 tree.h
--- tree.h 12 Aug 2004 14:34:01 -0000 1.587
+++ tree.h 14 Aug 2004 01:41:01 -0000
@@ -2167,6 +2167,13 @@
#define DECL_POSSIBLY_INLINED(DECL) \
FUNCTION_DECL_CHECK (DECL)->decl.possibly_inlined
+/* Nonzero for a decl which is a GIMPLE temporary variable. These
+ are always DECL_ARTIFICAL, but also have other known and required
+ properties (which are slightly hard to describe). */
+
+#define DECL_GIMPLE_TMP_VAR (DECL) \
+ VAR_DECL_CHECK (DECL)->decl.gimple_tmp_var
+
/* Enumerate visibility settings. */
#ifndef SYMBOL_VISIBILITY_DEFINED
#define SYMBOL_VISIBILITY_DEFINED
@@ -2234,7 +2241,8 @@
unsigned lang_flag_7 : 1;
unsigned possibly_inlined : 1;
- /* 15 unused bits. */
+ unsigned gimple_tmp_var : 1;
+ /* 14 unused bits. */
union tree_decl_u1 {
/* In a FUNCTION_DECL for which DECL_BUILT_IN holds, this is
--
This space intentionally left blank.