[MDEV-12644] compile warnings in Connect potentially causing incorrect code Created: 2017-04-30  Updated: 2017-05-03  Resolved: 2017-05-03

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - Connect
Fix Version/s: 10.0.31, 10.2.6

Type: Task Priority: Major
Reporter: Daniel Black Assignee: Olivier Bertrand
Resolution: Fixed Votes: 0
Labels: connect-engine


 Description   

gcc-6

https://travis-ci.org/MariaDB/server/jobs/227069549#L4675

/home/travis/build/MariaDB/server/storage/connect/ha_connect.cc: In member function ‘CONDFIL* ha_connect::CheckCond(PGLOBAL, PCFIL, const Item*)’:
/home/travis/build/MariaDB/server/storage/connect/ha_connect.cc:2744:10: warning: ‘ph2’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       ph1= ph2 + strlen(ph2);
       ~~~^~~~~~~~~~~~~~~~~~~
/home/travis/build/MariaDB/server/storage/connect/ha_connect.cc:2695:41: note: ‘ph2’ was declared here
     char      *pb0, *pb1, *pb2, *ph0, *ph1, *ph2;
                                         ^~~
/home/travis/build/MariaDB/server/storage/connect/ha_connect.cc:2768:10: warning: ‘ph0’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     *ph0 = 0;
     ~~~~~^~~
/home/travis/build/MariaDB/server/storage/connect/ha_connect.cc:2695:29: note: ‘ph0’ was declared here
     char      *pb0, *pb1, *pb2, *ph0, *ph1, *ph2;
                             ^~~

https://travis-ci.org/MariaDB/server/jobs/227069549#L4714

/home/travis/build/MariaDB/server/storage/connect/filamdbf.cpp: In member function ‘uint _dbfheader::Records() const’:
/home/travis/build/MariaDB/server/storage/connect/filamdbf.cpp:91:73: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
   uint   Records(void) const {return uint4korr(m_RecordsBuf);}
                                                                         ^
/home/travis/build/MariaDB/server/storage/connect/filamdbf.cpp: In member function ‘ushort _dbfheader::Headlen() const’:
/home/travis/build/MariaDB/server/storage/connect/filamdbf.cpp:92:75: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
   ushort Headlen(void) const {return uint2korr(m_HeadlenBuf);}
                                                                           ^
/home/travis/build/MariaDB/server/storage/connect/filamdbf.cpp: In member function ‘ushort _dbfheader::Reclen() const’:
/home/travis/build/MariaDB/server/storage/connect/filamdbf.cpp:93:73: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
   ushort Reclen(void)  const {return uint2korr(m_ReclenBuf);}
                                                                         ^
/home/travis/build/MariaDB/server/storage/connect/filamdbf.cpp: In member function ‘ushort _dbfheader::Fields() const’:
/home/travis/build/MariaDB/server/storage/connect/filamdbf.cpp:94:73: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
   ushort Fields(void)  const {return uint2korr(m_FieldsBuf);}
                                                                         ^

Clang 4.0.0:

https://travis-ci.org/MariaDB/server/jobs/227069553#L2811

In file included from /home/travis/build/MariaDB/server/storage/connect/ha_connect.cc:129:
/home/travis/build/MariaDB/server/storage/connect/tabext.h:9:9: warning: '__TABEXT_H' is used as a header guard here, followed by #define of a different macro [-Wheader-guard]
#ifndef __TABEXT_H
        ^~~~~~~~~~
/home/travis/build/MariaDB/server/storage/connect/tabext.h:10:9: note: '__TABEXTF_H' is defined here; did you mean '__TABEXT_H'?
#define __TABEXTF_H
        ^~~~~~~~~~~
        __TABEXT_H

https://travis-ci.org/MariaDB/server/jobs/227069553#L2872

/home/travis/build/MariaDB/server/storage/connect/filamdbf.cpp:450:47: warning: format specifies type 'short' but the argument has type 'int' [-Wformat]
                        sprintf(g->Message, MSG(BAD_LRECL), Lrecl, rln);
                                            ~~~~~~~~~~~~~          ^~~
/home/travis/build/MariaDB/server/storage/connect/filamdbf.cpp:968:47: warning: format specifies type 'short' but the argument has type 'int' [-Wformat]
                        sprintf(g->Message, MSG(BAD_LRECL), Lrecl, rln);
                                            ~~~~~~~~~~~~~          ^~~
2 warnings generated.

https://travis-ci.org/MariaDB/server/jobs/227069553#L3109

/home/travis/build/MariaDB/server/storage/connect/jdbconn.cpp:575:48: warning: expression which evaluates to zero treated as a null pointer constant of type 'jboolean *' (aka 'unsigned char *') [-Wnon-literal-null-conversion]
                        const char *utf = env->GetStringUTFChars(s, (jboolean)false);
                                                                    ^~~~~~~~~~~~~~~
/home/travis/build/MariaDB/server/storage/connect/jdbconn.cpp:584:42: warning: expression which evaluates to zero treated as a null pointer constant of type 'jboolean *' (aka 'unsigned char *') [-Wnon-literal-null-conversion]
                Msg = (char*)env->GetStringUTFChars(s, (jboolean)false);
                                                       ^~~~~~~~~~~~~~~
/home/travis/build/MariaDB/server/storage/connect/jdbconn.cpp:875:3: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
                delete options;    // we then no longer need the initialisation options.
                ^
                      []
/home/travis/build/MariaDB/server/storage/connect/jdbconn.cpp:836:27: note: allocated with 'new[]' here
                JavaVMOption* options = new JavaVMOption[N];   // JVM invocation options
                                        ^
/home/travis/build/MariaDB/server/storage/connect/jdbconn.cpp:1042:49: warning: expression which evaluates to zero treated as a null pointer constant of type 'jboolean *' (aka 'unsigned char *') [-Wnon-literal-null-conversion]
                        char *qch = (char*)env->GetStringUTFChars(s, (jboolean)false);
                                                                     ^~~~~~~~~~~~~~~
/home/travis/build/MariaDB/server/storage/connect/jdbconn.cpp:1046:43: warning: expression which evaluates to zero treated as a null pointer constant of type 'jboolean *' (aka 'unsigned char *') [-Wnon-literal-null-conversion]
                        Msg = (char*)env->GetStringUTFChars(s, (jboolean)false);
                                                               ^~~~~~~~~~~~~~~
/home/travis/build/MariaDB/server/storage/connect/jdbconn.cpp:1238:51: warning: expression which evaluates to zero treated as a null pointer constant of type 'jboolean *' (aka 'unsigned char *') [-Wnon-literal-null-conversion]
                        const char *field = env->GetStringUTFChars(cn, (jboolean)false);
                                                                       ^~~~~~~~~~~~~~~
/home/travis/build/MariaDB/server/storage/connect/jdbconn.cpp:1716:41: warning: expression which evaluates to zero treated as a null pointer constant of type 'jboolean *' (aka 'unsigned char *') [-Wnon-literal-null-conversion]
                        name = env->GetStringUTFChars(label, (jboolean)false);
                                                             ^~~~~~~~~~~~~~~

https://travis-ci.org/MariaDB/server/jobs/227069553#L3146

/home/travis/build/MariaDB/server/storage/connect/filamzip.cpp:344:22: warning: suggest braces around initialization of subobject [-Wmissing-braces]
        zip_fileinfo zi = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                            ^~~~~~~~~~~~~~~~
                            {               }
1 warning generated.


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