From cf49ed5769e95e2146c56883ebc957b22713381a Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 26 Jul 2019 10:29:11 +0200 Subject: 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). --- prog/minimization.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'prog/minimization.go') 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) } -- cgit mrf-deployment