-Wunused-but-set-variable -Warray-bounds warnings
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
Percona Server moved to https://jira.percona.com/projects/PS | Status tracked in 5.7 | |||||
5.5 |
Fix Released
|
Low
|
Laurynas Biveinis | |||
5.6 |
Invalid
|
Undecided
|
Unassigned | |||
5.7 |
Invalid
|
Undecided
|
Unassigned |
Bug Description
5.5 trunk:
/mnt/workspace/
/mnt/workspace/
/mnt/workspace/
/mnt/workspace/
/mnt/workspace/
/mnt/workspace/
For fix, partially backport
commit bccdbcba25ec4fe
Author: Tor Didriksen <email address hidden>
Date: Fri Feb 13 10:02:59 2015 +0100
Bug#20458574 FIX ALL THE ARRAY BOUNDS WARNINGS
Remove compiler warnings when building in optimized mode:
In strings/decimal.c fix numerous warnings of the type:
array subscript is below array bounds [-Werror=
This part of the patch is based on a patch
from https:/
That patch added some bounds-checks for loops, and worked for
gcc4.8.3 but not for gcc 4.9.1 so it was re-written to unroll the loops instead.
In other source files, fix numerous warnings of the type:
variable XX set but not used [-Werror=
variable XX may be used uninitialized in this function [-Werror=
These were variables used only for debugging purposes,
or variables not proven to be set by all execution paths.
Compiled with gcc 4.7.2 4.8.3 4.9.1 in optimized mode, with -Wall -Werror
description: | updated |
tags: | added: upstream |
The same backport also fixes
/mnt/workspace/ percona- server- 5.5-trunk/ BUILD_TYPE/ release/ Host/debian- jessie- 64bit/strings/ decimal. c: In function ‘do_div_mod’: percona- server- 5.5-trunk/ BUILD_TYPE/ release/ Host/debian- jessie- 64bit/strings/ decimal. c:2145: 55: warning: array subscript is below array bounds [-Warray-bounds]
^ percona- server- 5.5-trunk/ BUILD_TYPE/ release/ Host/debian- jessie- 64bit/strings/ decimal. c:2160: 52: warning: array subscript is below array bounds [-Warray-bounds]
^ percona- server- 5.5-trunk/ BUILD_TYPE/ release/ Host/debian- jessie- 64bit/strings/ decimal. c:2145: 55: warning: array subscript is below array bounds [-Warray-bounds]
^ percona- server- 5.5-trunk/ BUILD_TYPE/ release/ Host/debian- jessie- 64bit/strings/ decimal. c:2160: 52: warning: array subscript is below array bounds [-Warray-bounds]
/mnt/workspace/
for (i= (prec2 - 1) % DIG_PER_DEC1; *buf2 < powers10[i--]; prec2--) ;
/mnt/workspace/
for (i=(prec1-1) % DIG_PER_DEC1; *buf1 < powers10[i--]; prec1--) ;
/mnt/workspace/
for (i= (prec2 - 1) % DIG_PER_DEC1; *buf2 < powers10[i--]; prec2--) ;
/mnt/workspace/
for (i=(prec1-1) % DIG_PER_DEC1; *buf1 < powers10[i--]; prec1--) ;
/mnt/workspace/ percona- server- 5.5-trunk/ BUILD_TYPE/ release/ Host/debian- jessie- 64bit/strings/ decimal. c: In function ‘decimal_ actual_ fraction’ : percona- server- 5.5-trunk/ BUILD_TYPE/ release/ Host/debian- jessie- 64bit/strings/ decimal. c:300:26: warning: array subscript is above array bounds [-Warray-bounds]
^ percona- server- 5.5-trunk/ BUILD_TYPE/ release/ Host/debian- jessie- 64bit/strings/ decimal. c:300:26: warning: array subscript is above array bounds [-Warray-bounds] CMakeFiles/ strings. dir/longlong2st r.c.o percona- server- 5.5-trunk/ BUILD_TYPE/ release/ Host/debian- jessie- 64bit/strings/ decimal. c: In function ‘decimal2string’: percona- server- 5.5-trunk/ BUILD_TYPE/ release/ Host/debian- jessie- 64bit/strings/ decimal. c:264:56: warning: array subscript is below array bounds [-Warray-bounds]
^ percona- server- 5.5-trunk/ BUILD_TYPE/ release/ Host/debian- jessie- 64bit/strings/ decimal. c:264:56: warning: array subscript is below array bounds [-Warray-bounds] CMakeFiles/ strings. dir/my_ strtoll10. c.o CMakeFiles/ strings. dir/my_ vsnprintf. c.o CMakeFiles/ strings. dir/str2int. c.o percona- server- 5.5-trunk/ BUILD_TYPE/ release/ Host/debian- jessie- 64bit/strings/ decimal. c: In function ‘decimal2bin’: percona- server- 5.5-trunk/ BUILD_TYPE/ release/ Host/debian- jessie- 64bit/strings/ decimal. c:264:56: warning: array subscript is below array bounds [-Warray-bounds] percona- server- 5.5-trunk/ BUILD_TYPE/ re...
/mnt/workspace/
*buf0 % powers10[i++] == 0;
/mnt/workspace/
[ 12%] Building C object strings/
/mnt/workspace/
/mnt/workspace/
for (i= (intg - 1) % DIG_PER_DEC1; *buf0 < powers10[i--]; intg--) ;
/mnt/workspace/
[ 12%] Building C object strings/
[ 12%] Building C object strings/
[ 12%] Building C object strings/
/mnt/workspace/
/mnt/workspace/
for (i= (intg - 1) % DIG_PER_DEC1; *buf0 < powers10[i--]; intg--) ;q
/mnt/workspace/