-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
Description
by pwil3058:
$GOOS=linux $GOARCH=amd64 Version: accc5a64ee63 tip In the distribution directory, do: LANG=C LANGUAGE="en_US.UTF8" bison -v -y src/cmd/gc/go.y Expected output: Actual output: conflicts: 1 shift/reduce This conflict can cause compile failure in exactly one way e.g.: Copy the attached files: pkg1.go, pkg2.go, Makefile; to a directory: make Expected output: 6g pkg1.go 6g pkg2.go Actual output: 6g pkg1.go 6g pkg2.go pkg2.go:3: syntax error: unexpected }, expecting . make: *** [all] Error 1 This failure is caused by line 16 in pkg1.go which is exactly the same as line 9 except that it has a field tag which, together with the fact the function type being declared has no return type, is the cause of the problem. The problem is not triggered until the package in pkg1.go is imported by pkg2.go (which is all it does). Confirmation of this analysys can be made by commenting out the tag on line 16 and running make. There will be no problems. Analysis of src/cmd/gc/y.output indicates that the cause of the shift/reduce conflict is summarised in the extracted subset in the attached file conflict.y. It can be further localised to the five (simplified) productions: hidden_importsym: LLITERAL '.' sym hidden_structdcl: sym hidden_type oliteral oliteral: /* empty */ | LLITERAL hidden_type: hidden_importsym Since the language construct that triggers the failure is fairly uncommon, this is probably not urgent.
Attachments: