]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: fix OffPtr type in 2-field struct Store rule
authorMichael Munday <munday@ca.ibm.com>
Thu, 9 Mar 2017 18:03:07 +0000 (13:03 -0500)
committerMichael Munday <munday@ca.ibm.com>
Thu, 9 Mar 2017 19:09:56 +0000 (19:09 +0000)
The type of the OffPtr for the first field was incorrect. It should
have been a pointer to the field type, rather than the field
type itself.

Fixes #19475.

Change-Id: I3960b404da0f4bee759331126cce6140d2ce1df7
Reviewed-on: https://go-review.googlesource.com/37869
Run-TryBot: Michael Munday <munday@ca.ibm.com>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/ssa/gen/generic.rules
src/cmd/compile/internal/ssa/rewritegeneric.go

index a81d2826d8b67bbb561ee29e88d2cff8a412a842..e921a1110ba9ceb4b5e7fff323e2a882a5b68110 100644 (file)
     (OffPtr <t.FieldType(1).PtrTo()> [t.FieldOff(1)] dst)
     f1
     (Store [t.FieldType(0).Size()]
-      (OffPtr <t.FieldType(0)> [0] dst)
+      (OffPtr <t.FieldType(0).PtrTo()> [0] dst)
         f0 mem))
 (Store dst (StructMake3 <t> f0 f1 f2) mem) ->
   (Store [t.FieldType(2).Size()]
index 7690e73d41c5ac5ecc098265f0f3f6332a84a257..c72d7c685dcceb3a429d3075523007d6951a4555 100644 (file)
@@ -14705,7 +14705,7 @@ func rewriteValuegeneric_OpStore(v *Value, config *Config) bool {
        }
        // match: (Store dst (StructMake2 <t> f0 f1) mem)
        // cond:
-       // result: (Store [t.FieldType(1).Size()]     (OffPtr <t.FieldType(1).PtrTo()> [t.FieldOff(1)] dst)     f1     (Store [t.FieldType(0).Size()]       (OffPtr <t.FieldType(0)> [0] dst)         f0 mem))
+       // result: (Store [t.FieldType(1).Size()]     (OffPtr <t.FieldType(1).PtrTo()> [t.FieldOff(1)] dst)     f1     (Store [t.FieldType(0).Size()]       (OffPtr <t.FieldType(0).PtrTo()> [0] dst)         f0 mem))
        for {
                dst := v.Args[0]
                v_1 := v.Args[1]
@@ -14725,7 +14725,7 @@ func rewriteValuegeneric_OpStore(v *Value, config *Config) bool {
                v.AddArg(f1)
                v1 := b.NewValue0(v.Pos, OpStore, TypeMem)
                v1.AuxInt = t.FieldType(0).Size()
-               v2 := b.NewValue0(v.Pos, OpOffPtr, t.FieldType(0))
+               v2 := b.NewValue0(v.Pos, OpOffPtr, t.FieldType(0).PtrTo())
                v2.AuxInt = 0
                v2.AddArg(dst)
                v1.AddArg(v2)