This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Go patch committed: Traverse erroneous send/receive statements


This patch to the Go frontend ensures that even erroneous send/receive
statements are traversed.  This will force the compiler to traverse
them, which means that any names that they define will have their types
determined.  This avoids knock-on errors if statements that are added to
the tree refer to those names.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r 89d21108be7d go/parse.cc
--- a/go/parse.cc	Thu Feb 24 05:58:05 2011 -0800
+++ b/go/parse.cc	Thu Feb 24 07:15:04 2011 -0800
@@ -4203,6 +4203,12 @@
 
   if (got_case)
     clauses->add(is_send, channel, val, var, is_default, statements, location);
+  else if (statements != NULL)
+    {
+      // Add the statements to make sure that any names they define
+      // are traversed.
+      this->gogo_->add_block(statements, location);
+    }
 }
 
 // CommCase = ( "default" | ( "case" ( SendExpr | RecvExpr) ) ) ":" .

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]