summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlia Mirkin <imirkin@alum.mit.edu>2016-01-04 23:28:52 -0500
committerIlia Mirkin <imirkin@alum.mit.edu>2016-01-05 12:07:53 -0500
commit6531ccb7056f80c32a29e07fe05381b0fd6557dc (patch)
tree7fe9c9393d708f8f6db67c72b4567932008f088f
parent777d1453f1053af7e051fa701b9440061bc27dce (diff)
downloadexternal_mesa3d-6531ccb7056f80c32a29e07fe05381b0fd6557dc.zip
external_mesa3d-6531ccb7056f80c32a29e07fe05381b0fd6557dc.tar.gz
external_mesa3d-6531ccb7056f80c32a29e07fe05381b0fd6557dc.tar.bz2
i965: quieten compiler warning about out-of-bounds access
gcc 4.9.3 shows the following error: brw_vue_map.c:260:20: warning: array subscript is above array bounds [-Warray-bounds] return brw_names[slot - VARYING_SLOT_MAX]; This is because BRW_VARYING_SLOT_COUNT is a valid value for the enum type. Adding an assert will generate no additional code but will teach the compiler to not complain. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
-rw-r--r--src/mesa/drivers/dri/i965/brw_vue_map.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vue_map.c b/src/mesa/drivers/dri/i965/brw_vue_map.c
index 09eadbc..fea2436 100644
--- a/src/mesa/drivers/dri/i965/brw_vue_map.c
+++ b/src/mesa/drivers/dri/i965/brw_vue_map.c
@@ -257,6 +257,7 @@ varying_name(brw_varying_slot slot)
[BRW_VARYING_SLOT_PNTC - VARYING_SLOT_MAX] = "BRW_VARYING_SLOT_PNTC",
};
+ assert(slot < BRW_VARYING_SLOT_COUNT);
return brw_names[slot - VARYING_SLOT_MAX];
}