[MDEV-21940] 10.4 Build warning (debug only): error: 'error_num' may be used uninitialized in this function Created: 2020-03-14  Updated: 2020-03-14

Status: Open
Project: MariaDB Server
Component/s: Compiling
Affects Version/s: 10.4
Fix Version/s: 10.4

Type: Bug Priority: Minor
Reporter: Roel Van de Paar Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Build 10.4 in debug, and compilation will fail with:

In file included from /data/git/10.4_dbg/include/my_global.h:1067:0,
                 from /data/git/10.4_dbg/storage/spider/spd_db_conn.cc:18:
/data/git/10.4_dbg/include/my_dbug.h: In function 'int spider_db_simple_action(uint, spider_db_handler*, int)':
/data/git/10.4_dbg/include/my_dbug.h:79:71: error: 'error_num' may be used uninitialized in this function [-Werror=maybe-uninitialized]
 #define DBUG_RETURN(a1) do { _db_stack_frame_.line=__LINE__; return(a1);} while(0)
                                                                       ^
/data/git/10.4_dbg/storage/spider/spd_db_conn.cc:5727:7: note: 'error_num' was declared here
   int error_num;
       ^~~~~~~~~

Optimized build works fine.

Setting -DMYSQL_MAINTAINER_MODE=0 fixes the issue on debug.



 Comments   
Comment by Roel Van de Paar [ 2020-03-14 ]

Adding -DMYSQL_MAINTAINER_MODE=0 to QA build scripts creates a risk that future (other) warnings may be unseen.

Comment by Sergei Golubchik [ 2020-03-14 ]

what's the cmake command line line that you've used?

Comment by Sergei Golubchik [ 2020-03-14 ]

As discussed on slack, this was caused by -DCMAKE_BUILD_TYPE=Debug -DBUILD_CONFIG=mysql_release combo

Generated at Thu Feb 08 09:10:59 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.