Skip to content

Commit b559a17

Browse files
nsajkoianlancetaylor
authored andcommitted
internal/xcoff: fix wrong bit masking comparisons
I do not know much about xcoff, but this was probably the intended behavior. (The comparison is tautologically false, as is.) Also note: does any other code even depend on the changed code existing? Maybe it should just be removed, as I did not find any uses of fields that are written to if the branch condition tests true. Change-Id: I1f23d33764df40e87f3e64460d63f6efc51a2a78 GitHub-Last-Rev: 2689091 GitHub-Pull-Request: #37733 Reviewed-on: https://go-review.googlesource.com/c/go/+/222478 Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Clément Chigot <clement.chigot%[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 43c6ada commit b559a17

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/internal/xcoff/file.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -412,10 +412,10 @@ func NewFile(r io.ReaderAt) (*File, error) {
412412
sect.Relocs[i].Type = rel.Rtype
413413
sect.Relocs[i].Length = rel.Rsize&0x3F + 1
414414

415-
if rel.Rsize&0x80 == 1 {
415+
if rel.Rsize&0x80 != 0 {
416416
sect.Relocs[i].Signed = true
417417
}
418-
if rel.Rsize&0x40 == 1 {
418+
if rel.Rsize&0x40 != 0 {
419419
sect.Relocs[i].InstructionFixed = true
420420
}
421421

@@ -428,10 +428,10 @@ func NewFile(r io.ReaderAt) (*File, error) {
428428
sect.Relocs[i].Symbol = idxToSym[int(rel.Rsymndx)]
429429
sect.Relocs[i].Type = rel.Rtype
430430
sect.Relocs[i].Length = rel.Rsize&0x3F + 1
431-
if rel.Rsize&0x80 == 1 {
431+
if rel.Rsize&0x80 != 0 {
432432
sect.Relocs[i].Signed = true
433433
}
434-
if rel.Rsize&0x40 == 1 {
434+
if rel.Rsize&0x40 != 0 {
435435
sect.Relocs[i].InstructionFixed = true
436436
}
437437
}

0 commit comments

Comments
 (0)