Clean compilation warning for InnoDB in 5.5.8

Bug #695273 reported by Vadim Tkachenko
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
Fix Released
High
Unassigned

Bug Description

I am having next warnings

/mnt/data/vadim/percona-patches/5.5.8/Percona-Server/storage/innobase/srv/srv0srv.c: In function ‘srv_conc_enter_innodb_timer_based’:
/mnt/data/vadim/percona-patches/5.5.8/Percona-Server/storage/innobase/srv/srv0srv.c:1195: warning: value computed is not used
/mnt/data/vadim/percona-patches/5.5.8/Percona-Server/storage/innobase/srv/srv0srv.c: In function ‘srv_conc_exit_innodb_timer_based’:
/mnt/data/vadim/percona-patches/5.5.8/Percona-Server/storage/innobase/srv/srv0srv.c:1225: warning: value computed is not used
/mnt/data/vadim/percona-patches/5.5.8/Percona-Server/storage/innobase/srv/srv0srv.c: In function ‘srv_conc_force_enter_innodb’:
/mnt/data/vadim/percona-patches/5.5.8/Percona-Server/storage/innobase/srv/srv0srv.c:1434: warning: value computed is not used
/mnt/data/vadim/percona-patches/5.5.8/Percona-Server/storage/innobase/srv/srv0srv.c: In function ‘srv_master_thread’:
/mnt/data/vadim/percona-patches/5.5.8/Percona-Server/storage/innobase/srv/srv0srv.c:2902: warning: ‘n_pages_flushed’ may be used uninitialized in this function

a lot like:
/mnt/data/vadim/percona-patches/5.5.8/Percona-Server/storage/innobase/handler/ha_innodb.cc:11932: warning: type-punning to incomplete type might break strict-aliasing rules
/mnt/data/vadim/percona-patches/5.5.8/Percona-Server/storage/innobase/handler/ha_innodb.cc:11933: warning: type-punning to incomplete type might break strict-aliasing rules

and
[ 35%] Building C object storage/innobase/CMakeFiles/innobase.dir/btr/btr0sea.c.o
/mnt/data/vadim/percona-patches/5.5.8/Percona-Server/storage/innobase/btr/btr0sea.c: In function ‘btr_search_drop_page_hash_index’:
/mnt/data/vadim/percona-patches/5.5.8/Percona-Server/storage/innobase/btr/btr0sea.c:1095: warning: assignment discards qualifiers from pointer target type
[ 35%] Building C object storage/innobase/CMakeFiles/innobase.dir/buf/buf0buddy.c.o
[ 35%] Building C object storage/innobase/CMakeFiles/innobase.dir/buf/buf0buf.c.o
/mnt/data/vadim/percona-patches/5.5.8/Percona-Server/storage/innobase/buf/buf0buf.c: In function ‘_increment_page_get_statistics’:
/mnt/data/vadim/percona-patches/5.5.8/Percona-Server/storage/innobase/buf/buf0buf.c:86: warning: comparison is always false due to limited range of data type
/mnt/data/vadim/percona-patches/5.5.8/Percona-Server/storage/innobase/buf/buf0buf.c: In function ‘buf_pool_init_instance’:
/mnt/data/vadim/percona-patches/5.5.8/Percona-Server/storage/innobase/buf/buf0buf.c:1639: warning: ‘chunk’ may be used uninitialized in this function
[ 36%] Building C object storage/innobase/CMakeFiles/innobase.dir/buf/buf0flu.c.o
[ 36%] Building C object storage/innobase/CMakeFiles/innobase.dir/buf/buf0lru.c.o
/mnt/data/vadim/percona-patches/5.5.8/Percona-Server/storage/innobase/buf/buf0lru.c: In function ‘buf_LRU_file_restore’:
/mnt/data/vadim/percona-patches/5.5.8/Percona-Server/storage/innobase/buf/buf0lru.c:2403: warning: ‘records’ may be used uninitialized in this function

Changed in percona-server:
assignee: nobody → Yasufumi Kinoshita (yasufumi-kinoshita)
importance: Undecided → High
milestone: none → 5.5-20beta
status: New → Confirmed
Revision history for this message
Yasufumi Kinoshita (yasufumi-kinoshita) wrote :

Only confirmed warnings will be fixed in following.

------------
"warning: value computed is not used"
#################################
Your build should be wrong as intended!
#################################
if HAVE_IB_GCC_ATOMIC_BUILTINS and HAVE_ATOMIC_BUILTINS defined,
os_atomic_increment_lint() should be as __sync_add_and_fetch() GCC internal function.
Basically, there are no value 'computed' in the source code.

Please build correctly.
~~~~~~~~~~~~~~~~~

you should check the startup message at .err file like
"InnoDB: Mutexes and rw_locks use GCC atomic builtins"

------------
"warning: 'n_pages_flushed' may be used uninitialized in this function"
* Confirmed to be introduced by innodb_io_patches.patch

------------
"warning: type-punning to incomplete type might break strict-aliasing rules"
I never meet such warnings.
It may be GCC version specific general warning can be ignored for now.
http://bugs.mysql.com/bug.php?id=42733

------------
"warning: assignment discards qualifiers from pointer target type"
* Confirmed to be introduced by innodb_adaptive_hash_index_partitions.patch

------------
"warning: comparison is always false due to limited range of data type"
buf0buf.c:86: No problem.
unsigned type compared with "< 0".
But avoiding future change to introduce the bug by changing the signement of the data type,
it should be ignored for now.

------------
"warning: ‘chunk’ may be used uninitialized in this function"
* Confirmed to be introduced by innodb_buffer_pool_shm.patch

------------
"warning: ‘records’ may be used uninitialized in this function"
* Confirmed to be introduced by innodb_lru_dump_restore.patch

Revision history for this message
Yasufumi Kinoshita (yasufumi-kinoshita) wrote :

Fixed only about "Confirmed" warnings.

Changed in percona-server:
status: Confirmed → Fix Committed
Revision history for this message
Vadim Tkachenko (vadim-tk) wrote :

Yasufumi,

I still have these

/mnt/data/vadim/percona-patches/5.5.8/Percona-Server/storage/innobase/srv/srv0srv.c: In function ‘srv_conc_enter_innodb_timer_based’:
/mnt/data/vadim/percona-patches/5.5.8/Percona-Server/storage/innobase/srv/srv0srv.c:1195: warning: value computed is not used
/mnt/data/vadim/percona-patches/5.5.8/Percona-Server/storage/innobase/srv/srv0srv.c: In function ‘srv_conc_exit_innodb_timer_based’:
/mnt/data/vadim/percona-patches/5.5.8/Percona-Server/storage/innobase/srv/srv0srv.c:1225: warning: value computed is not used
/mnt/data/vadim/percona-patches/5.5.8/Percona-Server/storage/innobase/srv/srv0srv.c: In function ‘srv_conc_force_enter_innodb’:
/mnt/data/vadim/percona-patches/5.5.8/Percona-Server/storage/innobase/srv/srv0srv.c:1434: warning: value computed is not used

Can we fix them also ?

Changed in percona-server:
status: Fix Committed → In Progress
Revision history for this message
Vadim Tkachenko (vadim-tk) wrote :

line 1195 is
os_atomic_increment_lint(&srv_conc_n_threads, -1);
1225 is
os_atomic_increment_lint(&srv_conc_n_threads, -1);

I use gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-48) on CentOS 5.5

Revision history for this message
Yasufumi Kinoshita (yasufumi-kinoshita) wrote :

Vadim,

I said,
"
you should check the startup message at .err file like
"InnoDB: Mutexes and rw_locks use GCC atomic builtins"
"

How is it?

And,

I meant, it is not MySQL/InnoDB matter.
It is GCC matter of the distribution.

The code is not wrong.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26632
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27825
might be related

Revision history for this message
Vadim Tkachenko (vadim-tk) wrote :

I do not have this problem in gcc4.4

I close this bug

Changed in percona-server:
status: In Progress → Fix Committed
Changed in percona-server:
status: Fix Committed → Fix Released
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-454

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.