Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.3.2 build warnings #75

Open
devrimgunduz opened this issue Jul 12, 2024 · 3 comments
Open

2.3.2 build warnings #75

devrimgunduz opened this issue Jul 12, 2024 · 3 comments

Comments

@devrimgunduz
Copy link

Hi,

2.3.2 is throwing some warnings on my Fedora 40 box (GCC 14.1). Can you please take a look? Thanks!

g++ -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wno-unused-variable -fPIC -Wall -g -I/usr/pgsql-16/include/server -I/etc/alternatives/java_sdk_openjdk/include -I/etc/alternatives/java_sdk_openjdk/include/linux/ -Ijdbc -c -o jdbc/data.o jdbc/data.cpp
jdbc/hiveclient.cpp: In function ‘Initialize’:
jdbc/hiveclient.cpp:101:12: warning: ‘operator delete(void*, unsigned long)’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete]
101 | delete libjvm;
| ^~~~~~
jdbc/hiveclient.cpp:93:31: note: returned from ‘operator new[](unsigned long)’
93 | libjvm = new char[len + 15];
| ^
jdbc/hiveclient.cpp:121:16: warning: ‘operator delete(void*, unsigned long)’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete]
121 | delete options;
| ^~~~~~~
jdbc/hiveclient.cpp:105:33: note: returned from ‘operator new[](unsigned long)’
105 | options = new JavaVMOption[1];
| ^


and:

/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -Wno-format-truncation -O2 -Wno-unused-variable -I/etc/alternatives/java_sdk_openjdk/include -I/etc/alternatives/java_sdk_openjdk/include/linux/ -Ilibhive -DHAVE_NETINET_IN_H -DHAVE_INTTYPES_H -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -DWITH_GZFILEOP -I/usr/include -flto=thin -emit-llvm -c -o hdfs_fdw.bc hdfs_fdw.c
hdfs_query.c:75:2: warning: array index 51 is past the end of the array (that has type 'char[51]') [-Warray-bounds]
75 | row_count[51] = '\0';
| ^ ~~
hdfs_query.c:59:2: note: array 'row_count' declared here
59 | char row_count[51];
| ^
1 warning generated.
In function ‘hdfs_find_row_count’,
inlined from ‘hdfs_rowcount’ at hdfs_query.c:105:9:
hdfs_query.c:75:18: warning: array subscript 51 is above array bounds of ‘char[51]’ [-Warray-bounds=]
75 | row_count[51] = '\0';
| ~~~~~~~~~^~~~
hdfs_query.c: In function ‘hdfs_rowcount’:
hdfs_query.c:59:25: note: while referencing ‘row_count’
59 | char row_count[51];
| ^~~~~~~~~
hdfs_query.c:91:25: warning: ‘rc’ may be used uninitialized [-Wmaybe-uninitialized]
91 | double rc;
| ^~
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fPIC -fvisibility=hidden -shared -o hdfs_fdw.so hdfs_client.o hdfs_query.o hdfs_option.o hdfs_deparse.o hdfs_connection.o hdfs_fdw.o -L/usr/pgsql-16/lib -Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld-errors -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -L/usr/lib64 -L/usr/lib64 -Wl,--as-needed -Wl,-rpath,'/usr/pgsql-16/lib',--enable-new-dtags -fvisibility=hidden -Llibhive -lhive -lstdc++ -L/etc/alternatives/java_sdk_openjdk/include -Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld-errors -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes
In function ‘hdfs_find_row_count’,
inlined from ‘hdfs_rowcount’ at hdfs_query.c:105:9,
inlined from ‘hdfsGetForeignRelSize’ at hdfs_fdw.c:553:19:
hdfs_query.c:75:23: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
75 | row_count[51] = '\0';
| ^
hdfs_query.c: In function ‘hdfsGetForeignRelSize’:
hdfs_query.c:59:25: note: at offset 51 into destination object ‘row_count’ of size 51
59 | char row_count[51];
| ^

@devrimgunduz
Copy link
Author

devrimgunduz commented Jul 16, 2024

GCC 13 is throwing warnings (RHEL 9)

`/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2 -Wno-unused-variable -I/etc/alternatives/java_sdk_openjdk/include -I/etc/alternatives/java_sdk_openjdk/include/linux/ -Ilibhive -DHAVE_NETINET_IN_H -DHAVE_INTTYPES_H -I. -I./ -I/usr/pgsql-17/include/server -I/usr/pgsql-17/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o hdfs_fdw.bc hdfs_fdw.c
hdfs_query.c:75:2: warning: array index 51 is past the end of the array (that has type 'char[51]') [-Warray-bounds]
75 | row_count[51] = '\0';
| ^ ~~
hdfs_query.c:59:2: note: array 'row_count' declared here
59 | char row_count[51];
| ^
1 warning generated.
hdfs_query.c: In function 'hdfs_rowcount':
hdfs_query.c:75:18: warning: array subscript 51 is above array bounds of 'char[51]' [-Warray-bounds]
75 | row_count[51] = '\0';
| ~~~~~~~~~^~~~
hdfs_query.c:59:25: note: while referencing 'row_count'
59 | char row_count[51];
| ^~~~~~~~~
hdfs_query.c:119:33: warning: 'rc' may be used uninitialized in this function [-Wmaybe-uninitialized]
119 | return (rc > 1000) ? rc : 1000;
| ~~~~~~~~~~~~~~~~~^~~~~~
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -fvisibility=hidden -shared -o hdfs_fdw.so hdfs_client.o hdfs_query.o hdfs_option.o hdfs_deparse.o hdfs_connection.o hdfs_fdw.o -L/usr/pgsql-17/lib -Wl,--as-needed -L/usr/lib64 -L/usr/lib64 -Wl,--as-needed -Wl,-rpath,'/usr/pgsql-17/lib',--enable-new-dtags -fvisibility=hidden -Llibhive -lhive -lstdc++ -L/etc/alternatives/java_sdk_openjdk/include
In function 'hdfs_find_row_count',
inlined from 'hdfs_rowcount' at hdfs_query.c:105:9,
inlined from 'hdfsGetForeignRelSize' at hdfs_fdw.c:553:19:
hdfs_query.c:75:23: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
75 | row_count[51] = '\0';
| ^
hdfs_fdw.c: In function 'hdfsGetForeignRelSize':
hdfs_query.c:59:25: note: at offset 51 into destination object 'row_count' of size 51
59 | char row_count[51];
| ^

`

@devrimgunduz
Copy link
Author

GCC 8.5.0 (RHEL 8) is throwing these warnings:

/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2 -Wno-unused-variable -I/etc/alternatives/java_sdk_openjdk/include -I/etc/alternatives/java_sdk_openjdk/include/linux/ -Ilibhive -DHAVE_NETINET_IN_H -DHAVE_INTTYPES_H -I. -I./ -I/usr/pgsql-17/include/server -I/usr/pgsql-17/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o hdfs_fdw.bc hdfs_fdw.c
hdfs_query.c:75:2: warning: array index 51 is past the end of the array (that has type 'char[51]') [-Warray-bounds]
75 | row_count[51] = '\0';
| ^ ~~
hdfs_query.c:59:2: note: array 'row_count' declared here
59 | char row_count[51];
| ^
1 warning generated.
hdfs_query.c: In function 'hdfs_rowcount':
hdfs_query.c:75:11: warning: array subscript 51 is above array bounds of 'char[51]' [-Warray-bounds]
row_count[51] = '\0';

hdfs_query.c:119:26: warning: 'rc' may be used uninitialized in this function [-Wmaybe-uninitialized]
return (rc > 1000) ? rc : 1000;
       ~~~~~~~~~~~~~~~~~^~~~~~

@jeevanchalke
Copy link
Contributor

Thanks, Devrim.

We have taken note of it and will surely fix it before the next release.

jeevanchalke added a commit that referenced this issue Aug 22, 2024
Reported on GitHub through issue #75 by Devrim Gündüz (devrimgunduz).

FDW-702, Sravan Velagandula.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants