aboutsummaryrefslogtreecommitdiffstats
path: root/prog/minimization.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2019-07-26 10:29:11 +0200
committerDmitry Vyukov <dvyukov@google.com>2019-07-26 10:29:36 +0200
commitcf49ed5769e95e2146c56883ebc957b22713381a (patch)
tree573a3997d46332dc2a89fe3f65d7c5606ebf2b15 /prog/minimization.go
parent091bb0070faa61066041adf59b088a7a873a480d (diff)
prog: don't minimize ProcType to 0
Default value for ProcType is 0 (same for all PID's). Usually 0 either does not make sense at all or make different PIDs collide (since we use ProcType to separate value ranges for different PIDs). So don't change ProcType to 0 unless the type is explicitly marked as opt (in that case we will also generate 0 anyway).
Diffstat (limited to 'prog/minimization.go')
-rw-r--r--prog/minimization.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/prog/minimization.go b/prog/minimization.go
index 9dad3a494..9a71dd067 100644
--- a/prog/minimization.go
+++ b/prog/minimization.go
@@ -185,6 +185,14 @@ func (typ *FlagsType) minimize(ctx *minimizeArgsCtx, arg Arg, path string) bool
}
func (typ *ProcType) minimize(ctx *minimizeArgsCtx, arg Arg, path string) bool {
+ if !typ.Optional() {
+ // Default value for ProcType is 0 (same for all PID's).
+ // Usually 0 either does not make sense at all or make different PIDs collide
+ // (since we use ProcType to separate value ranges for different PIDs).
+ // So don't change ProcType to 0 unless the type is explicitly marked as opt
+ // (in that case we will also generate 0 anyway).
+ return false
+ }
return minimizeInt(ctx, arg, path)
}