Skip to content

Commit b298494

Browse files
committed
Not checking for zero divisions anymore
1 parent eb73c6d commit b298494

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/cmd/compile/internal/ssagen/intrinsics.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,8 +1242,8 @@ func initIntrinsics(cfg *intrinsicBuildConfig) {
12421242
addF("math/bits", "Div64",
12431243
func(s *state, n *ir.CallExpr, args []*ssa.Value) *ssa.Value {
12441244
// check for divide-by-zero/overflow and panic with appropriate message
1245-
cmpZero := s.newValue2(s.ssaOp(ir.ONE, types.Types[types.TUINT64]), types.Types[types.TBOOL], args[2], s.zeroVal(types.Types[types.TUINT64]))
1246-
s.check(cmpZero, ir.Syms.Panicdivide)
1245+
// cmpZero := s.newValue2(s.ssaOp(ir.ONE, types.Types[types.TUINT64]), types.Types[types.TBOOL], args[2], s.zeroVal(types.Types[types.TUINT64]))
1246+
// s.check(cmpZero, ir.Syms.Panicdivide) // temporarily commented out
12471247
cmpOverflow := s.newValue2(s.ssaOp(ir.OLT, types.Types[types.TUINT64]), types.Types[types.TBOOL], args[0], args[2])
12481248
s.check(cmpOverflow, ir.Syms.Panicoverflow)
12491249
return s.newValue3(ssa.OpDiv128u, types.NewTuple(types.Types[types.TUINT64], types.Types[types.TUINT64]), args[0], args[1], args[2])

src/cmd/compile/internal/ssagen/ssa.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5378,8 +5378,8 @@ func (s *state) intDivide(n ir.Node, a, b *ssa.Value) *ssa.Value {
53785378
}
53795379
if needcheck {
53805380
// do a size-appropriate check for zero
5381-
cmp := s.newValue2(s.ssaOp(ir.ONE, n.Type()), types.Types[types.TBOOL], b, s.zeroVal(n.Type()))
5382-
s.check(cmp, ir.Syms.Panicdivide)
5381+
// cmp := s.newValue2(s.ssaOp(ir.ONE, n.Type()), types.Types[types.TBOOL], b, s.zeroVal(n.Type()))
5382+
// s.check(cmp, ir.Syms.Panicdivide) // temporarily commented out
53835383
}
53845384

53855385
return s.newValue2(s.ssaOp(n.Op(), n.Type()), a.Type, a, b)
@@ -5825,8 +5825,8 @@ func (s *state) intDiv(n ir.Node, a, b *ssa.Value) *ssa.Value {
58255825
}
58265826
}
58275827
if needcheck {
5828-
cmp := s.newValue2(s.ssaOp(ir.ONE, n.Type()), types.Types[types.TBOOL], b, s.zeroVal(n.Type()))
5829-
s.check(cmp, ir.Syms.Panicdivide)
5828+
// cmp := s.newValue2(s.ssaOp(ir.ONE, n.Type()), types.Types[types.TBOOL], b, s.zeroVal(n.Type()))
5829+
// s.check(cmp, ir.Syms.Panicdivide) // temporarily commented out
58305830
}
58315831
return s.newValue2(s.ssaOp(n.Op(), n.Type()), a.Type, a, b)
58325832
}
@@ -5842,8 +5842,8 @@ func (s *state) intDiv(n ir.Node, a, b *ssa.Value) *ssa.Value {
58425842
}
58435843
if needcheck {
58445844
// do a size-appropriate check for zero
5845-
cmp := s.newValue2(s.ssaOp(ir.ONE, n.Type()), types.Types[types.TBOOL], b, s.zeroVal(n.Type()))
5846-
s.check(cmp, ir.Syms.Panicdivide)
5845+
// cmp := s.newValue2(s.ssaOp(ir.ONE, n.Type()), types.Types[types.TBOOL], b, s.zeroVal(n.Type()))
5846+
// s.check(cmp, ir.Syms.Panicdivide) // temporarily commented out
58475847
}
58485848

58495849
// If overflow detection is disabled, just perform the division

0 commit comments

Comments
 (0)