Skip to content

Commit

Permalink
[dev.fuzz] all: merge master (af72ddf) into dev.fuzz
Browse files Browse the repository at this point in the history
This now includes the fix in CL 350729, which means
we no longer need to skip the test in dev.fuzz.

Conflicts:

- src/cmd/compile/internal/noder/unified_test.go

Merge List:

+ 2021-09-20 af72ddf cmd/compile: extend dump-to-file to handle "genssa" (asm) case.
+ 2021-09-20 3c764ba cmd/go: write go.mod requirements more consistently for go 1.17+
+ 2021-09-20 6268468 cmd/link: generate DIE for types referenced only through dictionaries
+ 2021-09-20 6acac8b cmd/compile: delay all transforms for generic funcs/methods
+ 2021-09-20 988f18d go/types: export Named._Orig as Named.Origin
+ 2021-09-20 b6dddac cmd/compile: fix transform.AssignOp to deal with tricky case
+ 2021-09-20 9e60c37 cmd/compile: document register-based ABI for ppc64
+ 2021-09-20 79159f2 cmd/compile: fix simplification rules on arm/arm64
+ 2021-09-20 eff27e8 cmd/compile: ensure constant shift amounts are in range for arm
+ 2021-09-20 9ebe7c8 go/test: add a test for issue 48344
+ 2021-09-20 6f35430 cmd/compile: allow rotates to be merged with logical ops on arm64
+ 2021-09-20 2d9b486 cmd/compile: update doc at top of iexport.go on the changes for typeparams
+ 2021-09-20 a81b0dc cmd/compile: rename instType -> instanceType
+ 2021-09-20 1192135 cmd/cgo: remove hardcoded '-pie' ldflag for linux/arm
+ 2021-09-20 a83a558 cmd/compile: fix export/import of range loop.
+ 2021-09-19 315dbd1 cmd/compile: fold double negate on arm64
+ 2021-09-19 83b36ff cmd/compile: implement constant rotates on arm64
+ 2021-09-19 771b8ea cmd/compile: fix missing markHiddenClosureDead in deadcode pass
+ 2021-09-18 c894b44 net/rpc: remove warnings on incompatible methods at registration
+ 2021-09-17 4b654c0 cmd/compile: SSA ".this" variable
+ 2021-09-17 f01721e cmd/compile: remove self copies in tail-call wrappers
+ 2021-09-17 163871f time: re-add space-padded day of year to docs
+ 2021-09-17 ac7c347 time: support fractional timezone minutes in MarshalBinary
+ 2021-09-17 07b30a4 cmd/compile: delay transformAssign if lhs/rhs have typeparam
+ 2021-09-17 c10b980 cmd/compile: restore tail call for method wrappers
+ 2021-09-17 50e4508 cmd/compile: fix import/export of Init and Def fields.
+ 2021-09-17 3fa35b5 go/types: ensure that we always get a new signature in expandNamed
+ 2021-09-17 3fa7dbe cmd/go: fix GOARCH value in GOAMD64 docs
+ 2021-09-17 974b016 syscall: implement Pipe using pipe2 syscall on all linux platforms
+ 2021-09-17 1a49dcb syscall: remove //sysnb comment generating Setreuid for linux/arm64
+ 2021-09-17 cea7a71 cmd/compile: fix generic type handling in crawler
+ 2021-09-17 74e384f internal/poll: inject a hook into the runtime finalizer to count the closed pipes
+ 2021-09-17 323c6f7 log: don't format if writing to io.Discard
+ 2021-09-17 7f36ef0 cmd/compile/internal/noder: hide TestUnifiedCompare behind -cmp flag
+ 2021-09-17 70493b3 runtime/cgo: save and restore X3 (aka GP) for crosscall1 on riscv64
+ 2021-09-17 6d02ce8 runtime: fix prettyprinting of parametric types in gdb
+ 2021-09-17 6602c86 cmd/internal/obj/riscv: improve instruction validation
+ 2021-09-17 14e812b syscall: do not use handle lists on windows when NoInheritHandles is true
+ 2021-09-16 8d2a9c3 all: remove incorrectly repeated words in comments
+ 2021-09-16 af9da13 A+C: update name to real name and add to AUTHORS
+ 2021-09-16 265b59a cmd/cgo: for godefs, don't let field prefix removal cause duplicates
+ 2021-09-16 4efdaa7 testing: skip panics when picking the line number for decoration
+ 2021-09-16 e09dcc2 go/types, types2: add an additional shift test case
+ 2021-09-16 5402b43 spec: fix incorrect type in a shift example
+ 2021-09-16 d09e09b cmd/compile: fixing writebarrier.go for -G=3
+ 2021-09-16 bcdc61d cmd/compile: preserve statements better in expandCalls
+ 2021-09-16 48e2b1e cmd/compile: fix LocResults formatting
+ 2021-09-16 b1bedc0 cmd/go: add GOAMD64 environment variable
+ 2021-09-16 04f5116 cmd/go: clean paths before checking same directory
+ 2021-09-16 e7dbe39 cmd/cgo: add missing tab in exports for a result of void
+ 2021-09-15 cfa233d cmd/compile: remove unneeded early transforms, with dictionary change
+ 2021-09-15 59a9a03 cmd/compile: switch to computing dict format on instantiated functions
+ 2021-09-15 0edc6c4 cmd/internal/obj/ppc64: generate prologue code compatible with new ABI
+ 2021-09-15 03df68d runtime: fix setting of cpu features for amd64
+ 2021-09-15 6196979 cmd/go/internal/modload: prevent tidy downgrading disambiguating modules
+ 2021-09-15 72bb818 cmd/compile: emit DWARF info about dictionary entries
+ 2021-09-15 5b48fca cmd/compile: mark wrapper functions with DW_AT_trampoline
+ 2021-09-15 e4dfd78 go/internal/gcimporter,cmd/compile: minor clean-up in iimport.go
+ 2021-09-15 4847c47 cmd/compile/internal/types2: eliminate Named.instPos
+ 2021-09-15 3100f54 cmd/compile/internal/types2: merge Named type loading and expansion
+ 2021-09-15 738cebb cmd/compile/internal/types2: implement Identical for *Union types
+ 2021-09-15 b26d325 cmd/compile/internal/types2: remove some unnecessary loading/expansion of Named types
+ 2021-09-15 9fc2889 cmd/compile/internal/types2: export TypeHash, return value without blanks
+ 2021-09-15 2da3375 runtime: in adjustTimers back up as far as necessary
+ 2021-09-15 c7f2f51 cmd/go: remove subcommand prefix from error messages
+ 2021-09-15 0bb40b0 go/types: implement Identical for *Union types
+ 2021-09-15 cb4e1de go/types: minor cleanup of instantiation
+ 2021-09-15 a0f3129 go/types: instantiate methods when instantiating Named types
+ 2021-09-14 bf26e43 go/types: eliminate Named.instPos
+ 2021-09-14 2933c45 go/types: merge Named type loading and expansion
+ 2021-09-14 137543b cmd/compile: set IsShape based on type being in the Shapes pkg
+ 2021-09-14 3a72175 cmd/compile: fix test/typeparam/mdempsky/4.go for -G=3
+ 2021-09-14 b2c04f0 runtime: avoid loop variable capture in test
+ 2021-09-14 181e8cd go/internal/gcimporter: remove outdated comment
+ 2021-09-14 8699425 syscall: remove use of IN_KUBERNETES in test
+ 2021-09-14 b3c6de9 cmd/internal/obj/ppc64: allow VR register arguments to VS registers
+ 2021-09-14 ee91bb8 cmd/compile: prevent typecheck importer reading type parameter twice
+ 2021-09-14 2953cd0 go/internal/gcimporter: prevent importReader reading type parameter twice
+ 2021-09-14 b8c802b cmd/compile: prevent importReader reading type parameter twice
+ 2021-09-14 4a4221e all: remove some unused code
+ 2021-09-14 71adc65 runtime: change time.now to ABIInternal
+ 2021-09-14 146e8d4 reflect: use Value.Len instead of conversion to slice header
+ 2021-09-13 9a58aa2 spec: fix prose about terminating statements
+ 2021-09-13 42057e9 cmd/compile: save the note of fields when translating struct
+ 2021-09-13 960d036 cmd/go: add missing parenthesis in a call to "PrintVersion"
+ 2021-09-13 81a4fe6 cmd/link/internal/ld: re-enable DWARF tests on solaris/illumos
+ 2021-09-13 f93a63a reflect: add a floating point section to DeepEqual tests
+ 2021-09-13 a0c409c reflect: add fast paths for common, simple Kinds to DeepEqual
+ 2021-09-13 ac40c98 reflect: fix _faststr optimization
+ 2021-09-13 c8a58f2 cmd/go: add test to check for a potential workspace loading issue
+ 2021-09-13 e74e363 strings: add Clone function
+ 2021-09-13 bced369 cmd/link: minor code cleanup in dwarf gen
+ 2021-09-13 c3b217a cmd/go: document 'go install cmd@version' ignores vendor directories
+ 2021-09-12 ad97d20 go/types: remove some unnecessary loading/expansion of Named types
+ 2021-09-12 0d8a4bf bufio: add Writer.AvailableBuffer
+ 2021-09-11 23832ba reflect: optimize for maps with string keys
+ 2021-09-11 a50225a bufio: make Reader.Reset and Writer.Reset work on the zero value
+ 2021-09-10 cf2fe5d doc/asm: fix HTML markup
+ 2021-09-10 1bf2cd1 debug/elf: retain original error message when getSymbols fails.
+ 2021-09-10 5a4b9f9 time: reference -tags=timetzdata in testing panic
+ 2021-09-10 025308f testing: increase alternation precedence
+ 2021-09-10 5a94a90 cmd/compile/internal/types2: better error message for invalid array decls
+ 2021-09-10 da1aa65 cmd/compile/internal/syntax: correct follow token for type parameter lists
+ 2021-09-10 96ab854 cmd/compile/internal: better AST line highlight in ssa.html
+ 2021-09-10 90c5660 embed: guarantee the returned file of FS.Open implements io.Seeker
+ 2021-09-10 c69f5c0 cmd/compile: add support for Abs and Copysign intrinsics on riscv64
+ 2021-09-10 2091bd3 cmd/compile: simiplify arm64 bitfield optimizations
+ 2021-09-09 b32209d cmd/compile: fix test case for unified IR (fix build)
+ 2021-09-09 1a708bc cmd/compile: don't crash while reporting invalid alias cycle
+ 2021-09-09 426ff37 cmd/cgo, runtime/cgo: avoid GCC/clang conversion warnings
+ 2021-09-09 73483df cmd/compile/internal/syntax: better error message for missing type constraint
+ 2021-09-09 e1c3f21 time: propagate "," separator for fractional seconds into Format
+ 2021-09-09 c981874 cmd/compile: fix implement for closure in a global assignment
+ 2021-09-09 2c4f389 cmd/link: enable internal linker in more cases for ppc64le
+ 2021-09-09 fb84e99 test: add compiler regress tests for #46461
+ 2021-09-09 b9e1a24 cmd/compile: fix case where init info of OAS node is dropped
+ 2021-09-09 f9271e4 go/types, types2: rename RParams -> RecvTypeParams
+ 2021-09-09 ea43445 reflect: add hooks for dealing with narrow width floats
+ 2021-09-09 a53e3d5 net: deprecate (net.Error).Temporary
+ 2021-09-09 19457a5 cmd/compile: stenciled conversions might be NOPs
+ 2021-09-09 a295b3c test: re-enable AsmCheck tests for types2-based frontends
+ 2021-09-09 66f0d35 go/types: reduce number of delayed functions
+ 2021-09-09 d2a77f1 go/types: handle recursive type parameter constraints
+ 2021-09-09 9e1eea6 go/types: detect constraint type inference cycles
+ 2021-09-09 b86e8dd test/typeparam: fix issue48094b test build
+ 2021-09-09 c84f3a4 syscall: drop fallback to pipe in Pipe on linux/arm
+ 2021-09-09 376a079 cmd/compile: fix unified IR panic when expanding nested inline function
+ 2021-09-09 6edc579 internal/poll: report open fds when TestSplicePipePool fails
+ 2021-09-09 2481f6e cmd/compile: fix wrong instantiated type for embedded receiver
+ 2021-09-09 d62866e cmd/compile: move checkptr alignment to SSA generation
+ 2021-09-09 8fad81c cmd/compile: fold handling OCONV logic to separate function
+ 2021-09-09 9cbc76b cmd/internal/obj/arm64: add checks for incorrect use of REGTMP register
+ 2021-09-09 42563f8 cmd/compile: remove 'ext' fields from unified IR reader/writer types
+ 2021-09-09 4c52eac cmd/compile: simplify value coding for unified IR
+ 2021-09-09 e30a090 cmd/compile: extrapolate $GOROOT in unified IR
+ 2021-09-08 a1f6208 go/types, types2: add Environment to Config
+ 2021-09-08 f5f8a91 cmd/compile/internal/types2: spell out 'Type' in type parameter APIs
+ 2021-09-08 bff39cf cmd/compile: add automated rewrite cycle detection
+ 2021-09-08 b61e1ed cmd/compile/internal/types2: temporarily pin the Checker to Interface during checking
+ 2021-09-08 47f3e1e cmd/compile/internal/types2: move NewTypeParam off of Checker
+ 2021-09-08 ccc927b cmd/compile/internal/types2: move typeHash to environment.go
+ 2021-09-08 30e9bfb cmd/compile/internal/types2: implement deduplication of instances using the Environment
+ 2021-09-08 0406d3a go/ast: rename MultiIndexExpr to IndexListExpr

Change-Id: I7f917d45b0507c122c212305144b0b455618ff54
  • Loading branch information
katiehockman committed Sep 20, 2021
2 parents 51ca570 + af72ddf commit c6c884b
Show file tree
Hide file tree
Showing 434 changed files with 8,145 additions and 3,887 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -1479,6 +1479,7 @@ Zheng Dayu <[email protected]>
Zhongtao Chen <[email protected]>
Zhou Peng <[email protected]>
Ziad Hatahet <[email protected]>
Zizhao Zhang <[email protected]>
Zorion Arrizabalaga <[email protected]>
Максим Федосеев <[email protected]>
Роман Хавроненко <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,6 @@ Ian Lance Taylor <[email protected]>
Ian Leue <[email protected]>
Ian Mckay <[email protected]>
Ian Tay <[email protected]>
Ian Woolf <[email protected]>
Ian Zapolsky <[email protected]>
Ibrahim AshShohail <[email protected]>
Icarus Sparry <[email protected]>
Expand Down Expand Up @@ -2749,6 +2748,7 @@ Zhongwei Yao <[email protected]>
Zhou Peng <[email protected]>
Ziad Hatahet <[email protected]>
Ziheng Liu <[email protected]>
Zizhao Zhang <[email protected]>
Zorion Arrizabalaga <[email protected]>
Zvonimir Pavlinovic <[email protected]>
Zyad A. Ali <[email protected]>
Expand Down
6 changes: 2 additions & 4 deletions doc/asm.html
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ <h3 id="constants">Constants</h3>
One is in constant evaluation.
Constant expressions in the assembler are parsed using Go's operator
precedence, not the C-like precedence of the original.
Thus <code>3&amp;1<<2</code> is 4, not 0—it parses as <code>(3&amp;1)<<2</code>
not <code>3&amp;(1<<2)</code>.
Thus <code>3&amp;1&lt;&lt;2</code> is 4, not 0—it parses as <code>(3&amp;1)&lt;&lt;2</code>
not <code>3&amp;(1&lt;&lt;2)</code>.
Also, constants are always evaluated as 64-bit unsigned integers.
Thus <code>-2</code> is not the integer value minus two,
but the unsigned 64-bit integer with the same bit pattern.
Expand Down Expand Up @@ -914,8 +914,6 @@ <h3 id="ppc64">PPC64</h3>
Reference: <a href="/pkg/cmd/internal/obj/ppc64">Go PPC64 Assembly Instructions Reference Manual</a>
</p>

</ul>

<h3 id="s390x">IBM z/Architecture, a.k.a. s390x</h3>

<p>
Expand Down
9 changes: 4 additions & 5 deletions doc/go_spec.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--{
"Title": "The Go Programming Language Specification",
"Subtitle": "Version of Aug 23, 2021",
"Subtitle": "Version of Sep 16, 2021",
"Path": "/ref/spec"
}-->

Expand Down Expand Up @@ -3614,7 +3614,7 @@ <h3 id="Operators">Operators</h3>
var j int32 = 1&lt;&lt;s // 1 has type int32; j == 0
var k = uint64(1&lt;&lt;s) // 1 has type uint64; k == 1&lt;&lt;33
var m int = 1.0&lt;&lt;s // 1.0 has type int; m == 1&lt;&lt;33
var n = 1.0&lt;&lt;s == j // 1.0 has type int; n == true
var n = 1.0&lt;&lt;s == j // 1.0 has type int32; n == true
var o = 1&lt;&lt;s == 2&lt;&lt;s // 1 and 2 have type int; o == false
var p = 1&lt;&lt;s == 1&lt;&lt;33 // 1 has type int; p == true
var u = 1.0&lt;&lt;s // illegal: 1.0 has type float64, cannot shift
Expand Down Expand Up @@ -4561,9 +4561,8 @@ <h2 id="Statements">Statements</h2>
<h3 id="Terminating_statements">Terminating statements</h3>

<p>
A <i>terminating statement</i> prevents execution of all statements that lexically
appear after it in the same <a href="#Blocks">block</a>. The following statements
are terminating:
A <i>terminating statement</i> interrupts the regular flow of control in
a <a href="#Blocks">block</a>. The following statements are terminating:
</p>

<ol>
Expand Down
18 changes: 18 additions & 0 deletions misc/cgo/testgodefs/testdata/issue48396.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
// +build ignore

package main

/*
// from <linux/kcm.h>
struct issue48396 {
int fd;
int bpf_fd;
};
*/
import "C"

type Issue48396 C.struct_issue48396
3 changes: 3 additions & 0 deletions misc/cgo/testgodefs/testdata/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ var v7 = S{}
// Test that #define'd type is fully defined
var _ = issue38649{X: 0}

// Test that prefixes do not cause duplicate field names.
var _ = Issue48396{Fd: 1, Bpf_fd: 2}

func main() {
pass := true

Expand Down
1 change: 1 addition & 0 deletions misc/cgo/testgodefs/testgodefs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var filePrefixes = []string{
"issue37621",
"issue38649",
"issue39534",
"issue48396",
}

func TestGoDefs(t *testing.T) {
Expand Down
18 changes: 18 additions & 0 deletions src/bufio/bufio.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ func (b *Reader) Size() int { return len(b.buf) }

// Reset discards any buffered data, resets all state, and switches
// the buffered reader to read from r.
// Calling Reset on the zero value of Reader initializes the internal buffer
// to the default size.
func (b *Reader) Reset(r io.Reader) {
if b.buf == nil {
b.buf = make([]byte, defaultBufSize)
}
b.reset(b.buf, r)
}

Expand Down Expand Up @@ -590,7 +595,12 @@ func (b *Writer) Size() int { return len(b.buf) }

// Reset discards any unflushed buffered data, clears any error, and
// resets b to write its output to w.
// Calling Reset on the zero value of Writer initializes the internal buffer
// to the default size.
func (b *Writer) Reset(w io.Writer) {
if b.buf == nil {
b.buf = make([]byte, defaultBufSize)
}
b.err = nil
b.n = 0
b.wr = w
Expand Down Expand Up @@ -623,6 +633,14 @@ func (b *Writer) Flush() error {
// Available returns how many bytes are unused in the buffer.
func (b *Writer) Available() int { return len(b.buf) - b.n }

// AvailableBuffer returns an empty buffer with b.Available() capacity.
// This buffer is intended to be appended to and
// passed to an immediately succeeding Write call.
// The buffer is only valid until the next write operation on b.
func (b *Writer) AvailableBuffer() []byte {
return b.buf[b.n:][:0]
}

// Buffered returns the number of bytes that have been written into the current buffer.
func (b *Writer) Buffered() int { return b.n }

Expand Down
58 changes: 57 additions & 1 deletion src/bufio/bufio_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"errors"
"fmt"
"io"
"math/rand"
"strconv"
"strings"
"testing"
"testing/iotest"
Expand Down Expand Up @@ -608,6 +610,37 @@ func TestWriter(t *testing.T) {
}
}

func TestWriterAppend(t *testing.T) {
got := new(bytes.Buffer)
var want []byte
rn := rand.New(rand.NewSource(0))
w := NewWriterSize(got, 64)
for i := 0; i < 100; i++ {
// Obtain a buffer to append to.
b := w.AvailableBuffer()
if w.Available() != cap(b) {
t.Fatalf("Available() = %v, want %v", w.Available(), cap(b))
}

// While not recommended, it is valid to append to a shifted buffer.
// This forces Write to copy the the input.
if rn.Intn(8) == 0 && cap(b) > 0 {
b = b[1:1:cap(b)]
}

// Append a random integer of varying width.
n := int64(rn.Intn(1 << rn.Intn(30)))
want = append(strconv.AppendInt(want, n, 10), ' ')
b = append(strconv.AppendInt(b, n, 10), ' ')
w.Write(b)
}
w.Flush()

if !bytes.Equal(got.Bytes(), want) {
t.Errorf("output mismatch:\ngot %s\nwant %s", got.Bytes(), want)
}
}

// Check that write errors are returned properly.

type errorWriterTest struct {
Expand Down Expand Up @@ -1312,6 +1345,7 @@ func TestReaderReset(t *testing.T) {
if string(buf) != "foo" {
t.Errorf("buf = %q; want foo", buf)
}

r.Reset(strings.NewReader("bar bar"))
all, err := io.ReadAll(r)
if err != nil {
Expand All @@ -1320,12 +1354,23 @@ func TestReaderReset(t *testing.T) {
if string(all) != "bar bar" {
t.Errorf("ReadAll = %q; want bar bar", all)
}

*r = Reader{} // zero out the Reader
r.Reset(strings.NewReader("bar bar"))
all, err = io.ReadAll(r)
if err != nil {
t.Fatal(err)
}
if string(all) != "bar bar" {
t.Errorf("ReadAll = %q; want bar bar", all)
}
}

func TestWriterReset(t *testing.T) {
var buf1, buf2 bytes.Buffer
var buf1, buf2, buf3 bytes.Buffer
w := NewWriter(&buf1)
w.WriteString("foo")

w.Reset(&buf2) // and not flushed
w.WriteString("bar")
w.Flush()
Expand All @@ -1335,6 +1380,17 @@ func TestWriterReset(t *testing.T) {
if buf2.String() != "bar" {
t.Errorf("buf2 = %q; want bar", buf2.String())
}

*w = Writer{} // zero out the Writer
w.Reset(&buf3) // and not flushed
w.WriteString("bar")
w.Flush()
if buf1.String() != "" {
t.Errorf("buf1 = %q; want empty", buf1.String())
}
if buf3.String() != "bar" {
t.Errorf("buf3 = %q; want bar", buf3.String())
}
}

func TestReaderDiscard(t *testing.T) {
Expand Down
12 changes: 12 additions & 0 deletions src/bufio/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ func ExampleWriter() {
// Output: Hello, world!
}

func ExampleWriter_AvailableBuffer() {
w := bufio.NewWriter(os.Stdout)
for _, i := range []int64{1, 2, 3, 4} {
b := w.AvailableBuffer()
b = strconv.AppendInt(b, i, 10)
b = append(b, ' ')
w.Write(b)
}
w.Flush()
// Output: 1 2 3 4
}

// The simplest use of a Scanner, to read standard input as a set of lines.
func ExampleScanner_lines() {
scanner := bufio.NewScanner(os.Stdin)
Expand Down
21 changes: 14 additions & 7 deletions src/cmd/asm/internal/asm/testdata/arm64error.s
Original file line number Diff line number Diff line change
Expand Up @@ -406,21 +406,28 @@ TEXT errors(SB),$0
VBIF V0.D2, V1.D2, V2.D2 // ERROR "invalid arrangement"
VUADDW V9.B8, V12.H8, V14.B8 // ERROR "invalid arrangement"
VUADDW2 V9.B8, V12.S4, V14.S4 // ERROR "operand mismatch"
VUMAX V1.D2, V2.D2, V3.D2 // ERROR "invalid arrangement"
VUMIN V1.D2, V2.D2, V3.D2 // ERROR "invalid arrangement"
VUMAX V1.D2, V2.D2, V3.D2 // ERROR "invalid arrangement"
VUMIN V1.D2, V2.D2, V3.D2 // ERROR "invalid arrangement"
VUMAX V1.B8, V2.B8, V3.B16 // ERROR "operand mismatch"
VUMIN V1.H4, V2.S4, V3.H4 // ERROR "operand mismatch"
VSLI $64, V7.D2, V8.D2 // ERROR "shift out of range"
VUSRA $0, V7.D2, V8.D2 // ERROR "shift out of range"
VUSRA $0, V7.D2, V8.D2 // ERROR "shift out of range"
CASPD (R3, R4), (R2), (R8, R9) // ERROR "source register pair must start from even register"
CASPD (R2, R3), (R2), (R9, R10) // ERROR "destination register pair must start from even register"
CASPD (R2, R4), (R2), (R8, R9) // ERROR "source register pair must be contiguous"
CASPD (R2, R3), (R2), (R8, R10) // ERROR "destination register pair must be contiguous"
ADD R1>>2, RSP, R3 // ERROR "illegal combination"
ADDS R2<<3, R3, RSP // ERROR "unexpected SP reference"
CMP R1<<5, RSP // ERROR "the left shift amount out of range 0 to 4"
MOVD.P y+8(FP), R1 // ERROR "illegal combination"
MOVD.W x-8(SP), R1 // ERROR "illegal combination"
LDP.P x+8(FP), (R0, R1) // ERROR "illegal combination"
LDP.W x+8(SP), (R0, R1) // ERROR "illegal combination"
MOVD.P y+8(FP), R1 // ERROR "illegal combination"
MOVD.W x-8(SP), R1 // ERROR "illegal combination"
LDP.P x+8(FP), (R0, R1) // ERROR "illegal combination"
LDP.W x+8(SP), (R0, R1) // ERROR "illegal combination"
ADD $0x1234567, R27, R3 // ERROR "cannot use REGTMP as source"
ADD $0x3fffffffc000, R27, R5 // ERROR "cannot use REGTMP as source"
AND $0x22220000, R27, R4 // ERROR "cannot use REGTMP as source"
ANDW $0x6006000060060, R27, R5 // ERROR "cannot use REGTMP as source"
STP (R3, R4), 0x1234567(R27) // ERROR "REGTMP used in large offset store"
LDP 0x1234567(R27), (R3, R4) // ERROR "REGTMP used in large offset load"
STP (R26, R27), 700(R2) // ERROR "cannot use REGTMP as source"
RET
15 changes: 15 additions & 0 deletions src/cmd/asm/internal/asm/testdata/ppc64.s
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,8 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$0
LXVB16X (R3)(R4), VS1 // 7c241ed8
LXVW4X (R3)(R4), VS1 // 7c241e18
LXV 16(R3), VS1 // f4230011
LXV 16(R3), VS33 // f4230019
LXV 16(R3), V1 // f4230019
LXVL R3, R4, VS1 // 7c23221a
LXVLL R3, R4, VS1 // 7c23225a
LXVX R3, R4, VS1 // 7c232218
Expand All @@ -668,8 +670,13 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$0
MTFPRD R3, F0 // 7c030166
MFVRD V0, R3 // 7c030067
MFVSRLD VS63,R4 // 7fe40267
MFVSRLD V31,R4 // 7fe40267
MFVSRWZ VS33,R4 // 7c2400e7
MFVSRWZ V1,R4 // 7c2400e7
MTVSRD R3, VS1 // 7c230166
MTVSRDD R3, R4, VS1 // 7c232366
MTVSRDD R3, R4, VS33 // 7c232367
MTVSRDD R3, R4, V1 // 7c232367
MTVRD R3, V13 // 7da30167
MTVSRWA R4, VS31 // 7fe401a6
MTVSRWS R4, VS32 // 7c040327
Expand All @@ -678,6 +685,8 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$0
XXBRW VS1, VS2 // f04f0f6c
XXBRH VS2, VS3 // f067176c
XXLAND VS1, VS2, VS3 // f0611410
XXLAND V1, V2, V3 // f0611417
XXLAND VS33, VS34, VS35 // f0611417
XXLANDC VS1, VS2, VS3 // f0611450
XXLEQV VS0, VS1, VS2 // f0400dd0
XXLNAND VS0, VS1, VS2 // f0400d90
Expand All @@ -687,11 +696,17 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$0
XXLORQ VS1, VS2, VS3 // f0611490
XXLXOR VS1, VS2, VS3 // f06114d0
XXSEL VS1, VS2, VS3, VS4 // f08110f0
XXSEL VS33, VS34, VS35, VS36 // f08110ff
XXSEL V1, V2, V3, V4 // f08110ff
XXMRGHW VS1, VS2, VS3 // f0611090
XXMRGLW VS1, VS2, VS3 // f0611190
XXSPLTW VS1, $1, VS2 // f0410a90
XXSPLTW VS33, $1, VS34 // f0410a93
XXSPLTW V1, $1, V2 // f0410a93
XXPERM VS1, VS2, VS3 // f06110d0
XXSLDWI VS1, VS2, $1, VS3 // f0611110
XXSLDWI V1, V2, $1, V3 // f0611117
XXSLDWI VS33, VS34, $1, VS35 // f0611117
XSCVDPSP VS1, VS2 // f0400c24
XVCVDPSP VS1, VS2 // f0400e24
XSCVSXDDP VS1, VS2 // f0400de0
Expand Down
2 changes: 2 additions & 0 deletions src/cmd/asm/internal/asm/testdata/riscv64.s
Original file line number Diff line number Diff line change
Expand Up @@ -382,10 +382,12 @@ start:
SNEZ X15, X15 // b337f000

// F extension
FABSS F0, F1 // d3200020
FNEGS F0, F1 // d3100020
FNES F0, F1, X7 // d3a300a093c31300

// D extension
FABSD F0, F1 // d3200022
FNEGD F0, F1 // d3100022
FNED F0, F1, X5 // d3a200a293c21200
FLTD F0, F1, X5 // d39200a2
Expand Down
25 changes: 25 additions & 0 deletions src/cmd/cgo/gcc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3030,6 +3030,31 @@ func upper(s string) string {
// so that all fields are exported.
func godefsFields(fld []*ast.Field) {
prefix := fieldPrefix(fld)

// Issue 48396: check for duplicate field names.
if prefix != "" {
names := make(map[string]bool)
fldLoop:
for _, f := range fld {
for _, n := range f.Names {
name := n.Name
if name == "_" {
continue
}
if name != prefix {
name = strings.TrimPrefix(n.Name, prefix)
}
name = upper(name)
if names[name] {
// Field name conflict: don't remove prefix.
prefix = ""
break fldLoop
}
names[name] = true
}
}
}

npad := 0
for _, f := range fld {
for _, n := range f.Names {
Expand Down
Loading

0 comments on commit c6c884b

Please sign in to comment.