From 23810777867d0a7df1ef149ec6ed4135ce07fb01 Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Wed, 18 Mar 2015 13:29:22 -0700 Subject: [PATCH] cmd/yacc: fix default action Previously, a production rule like A: B C D would cause yacc to check that A and B have the same declared types, but then it would generate an implicit action of { $$ = $3 } (i.e., copy the value from D), even if A and D have different types. Fixes #10192. Change-Id: I51cfd7baa0011557141dca33b7af1d892cc6f49e Reviewed-on: https://go-review.googlesource.com/7780 Reviewed-by: Russ Cox --- src/cmd/yacc/yacc.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/cmd/yacc/yacc.go b/src/cmd/yacc/yacc.go index d0a9279c877c59..f52ef2f4d7949b 100644 --- a/src/cmd/yacc/yacc.go +++ b/src/cmd/yacc/yacc.go @@ -637,9 +637,6 @@ outer: if tempty != nontrst[curprod[0]-NTBASE].value { lerrorf(ruleline, "default action causes potential type clash") } - fmt.Fprintf(fcode, "\n\tcase %v:", nprod) - fmt.Fprintf(fcode, "\n\t\t%sVAL.%v = %sS[%spt-0].%v", - prefix, typeset[tempty], prefix, prefix, typeset[tempty]) } moreprod() prdptr[nprod] = make([]int, mem)