This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ bug: tree based representation of "switch"?
- To: pfeifer at dbai dot tuwien dot ac dot at
- Subject: Re: C++ bug: tree based representation of "switch"?
- From: Mark Mitchell <mark at codesourcery dot com>
- Date: Wed, 20 Sep 2000 11:28:35 -0700
- Cc: gcc-patches at gcc dot gnu dot org
- Organization: CodeSourcery, LLC
- References: <20000918225834W.mitchell@codesourcery.com><Pine.BSF.4.21.0009190842430.23519-300000@deneb.dbai.tuwien.ac.at>
Gerald --
This was a bug involving the evil SAVE_EXPR and the even more evil
UNSAVE_EXPR. Ugh. For GCC 3.1, we'll have to see about getting rid
of these beasts.
Fixed with this patch.
Thanks for the report!
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
2000-09-20 Mark Mitchell <mark@codesourcery.com>
* tree.c (mark_local_for_remap_r): Handle CASE_LABELs.
Index: testsuite/g++.old-deja/g++.other/inline14.C
===================================================================
RCS file: inline14.C
diff -N inline14.C
*** /dev/null Tue May 5 13:32:27 1998
--- inline14.C Wed Sep 20 11:25:09 2000
***************
*** 0 ****
--- 1,49 ----
+ // Build don't link:
+ // Origin: Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
+
+ #include <iostream>
+
+ struct IDENT
+ {
+ enum TYPE { Variable, Constant } type;
+
+ ostream& printTo(ostream& out) const
+ {
+ switch (type)
+ {
+ case Variable:
+ out << '_';
+ break;
+ default:
+ break;
+ }
+ return out;
+ }
+ };
+
+
+ template <class T>
+ struct TC
+ {
+ IDENT i;
+
+ const IDENT& getIdent() const
+ {
+ return i;
+ }
+ };
+
+ template <class T>
+ inline ostream& operator<< (ostream& out, const TC<T> &c)
+ {
+ c.getIdent().printTo(out);
+ return out;
+ }
+
+ void foo(const TC<IDENT> &c)
+ {
+ cerr << c
+ << ": " // This line is crucial!
+ << c
+ << endl;
+ }
Index: tree.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/tree.c,v
retrieving revision 1.216
diff -c -p -r1.216 tree.c
*** tree.c 2000/09/17 07:38:21 1.216
--- tree.c 2000/09/20 18:25:01
*************** mark_local_for_remap_r (tp, walk_subtree
*** 2465,2470 ****
--- 2465,2472 ----
else if (TREE_CODE (t) == TARGET_EXPR
&& nonstatic_local_decl_p (TREE_OPERAND (t, 0)))
decl = TREE_OPERAND (t, 0);
+ else if (TREE_CODE (t) == CASE_LABEL)
+ decl = CASE_LABEL_DECL (t);
else
decl = NULL_TREE;