Bug #78566 [Opn]: compiler warnings with GCC9
| From: | nikic@php.net | Date: | Fri, 03 Jan 2020 11:06:35 +0000 |
| Subject: | Bug #78566 [Opn]: compiler warnings with GCC9 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-224685@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78566&edit=1
ID: 78566
Updated by: nikic@php.net
Reported by: bugreports at gmail dot com
Summary: compiler warnings with GCC9
Status: Open
Type: Bug
Package: Compile Warning
PHP Version: 7.4Git-2019-09-19 (Git)
Block user comment: N
Private report: N
New Comment:
I've installed GCC 9.2.1 on Ubuntu and fixed one warning in https://github.com/php/php-src/commit/3e5675d730c6fb099ebb1b9f645bdb3ba6b86d85.
However, this is the only warning I get.
PS: The reason why you see an "unusual amount" of warnings, is that PHP is compiled with
-Wall since PHP 7.4.
Previous Comments:
------------------------------------------------------------------------
[2019-10-24 10:05:07] nikic@php.net
Related To: Bug #78437
------------------------------------------------------------------------
[2019-09-19 13:24:04] bugreports at gmail dot com
Description:
------------
current 7-4 HEAD throws an unusual amount of compiler warnings compared to 7.2 with GCC 9.2.1
In file included from /usr/include/string.h:494,
from /BUILD/php-7.4.0/main/php_config.h:2362,
from /BUILD/php-7.4.0/ext/date/lib/timelib_config.h:4,
from /BUILD/php-7.4.0/ext/date/lib/timelib.h:30,
from /BUILD/php-7.4.0/ext/date/lib/parse_tz.c:26:
In function 'strncpy',
inlined from 'create_location_table' at
/BUILD/php-7.4.0/ext/date/lib/parse_tz.c:604:9:
/usr/include/bits/string_fortified.h:106:10: warning: '__builtin_strncpy' specified bound
64 equals destination size [-Wstringop-truncation]
106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/BUILD/php-7.4.0/ext/openssl/xp_ssl.c: In function 'php_openssl_sockop_set_option':
/BUILD/php-7.4.0/ext/openssl/xp_ssl.c:2050:4: warning: 'peer_cert' may be used
uninitialized in this function [-Wmaybe-uninitialized]
2050 | X509_free(peer_cert);
| ^~~~~~~~~~~~~~~~~~~~
/BUILD/php-7.4.0/ext/openssl/xp_ssl.c:1923:8: note: 'peer_cert' was declared here
1923 | X509 *peer_cert;
| ^~~~~~~~~
In file included from /BUILD/php-7.4.0/Zend/zend_types.h:25,
from /BUILD/php-7.4.0/Zend/zend.h:27,
from /BUILD/php-7.4.0/main/php.h:33,
from /BUILD/php-7.4.0/main/SAPI.c:24:
/BUILD/php-7.4.0/main/SAPI.c: In function 'sapi_add_request_header':
/BUILD/php-7.4.0/Zend/zend_portability.h:365:10: warning: 'use_heap' may be used
uninitialized in this function [-Wmaybe-uninitialized]
365 | do { if (UNEXPECTED(use_heap)) efree(p); } while (0)
| ^
/BUILD/php-7.4.0/main/SAPI.c:1111:14: note: 'use_heap' was declared here
1111 | ALLOCA_FLAG(use_heap)
| ^~~~~~~~
/BUILD/php-7.4.0/Zend/zend_portability.h:357:12: note: in definition of macro
'ALLOCA_FLAG'
357 | zend_bool name;
| ^~~~
Zend/zend_ini_scanner.l: In function 'ini_lex':
Zend/zend_ini_scanner.c:520:18: warning: 'yych' may be used uninitialized in this function
[-Wmaybe-uninitialized]
520 | goto *yytarget[yych];
| ~~~~~~~~^~~~~~
Zend/zend_ini_scanner.c:388:10: note: 'yych' was declared here
388 | YYCTYPE yych;
| ^~~~
Zend/zend_language_scanner.l: In function 'lex_scan':
Zend/zend_language_scanner.c:1841:18: warning: 'yych' may be used uninitialized in this
function [-Wmaybe-uninitialized]
1841 | goto *yytarget[yych];
| ~~~~~~~~^~~~~~
Zend/zend_language_scanner.c:1255:10: note: 'yych' was declared here
1255 | YYCTYPE yych;
| ^~~~
In file included from /BUILD/php-7.4.0/Zend/zend_types.h:25,
from /BUILD/php-7.4.0/Zend/zend.h:27,
from /BUILD/php-7.4.0/main/php.h:33,
from /BUILD/php-7.4.0/ext/intl/collator/collator_is_numeric.h:21,
from /BUILD/php-7.4.0/ext/intl/collator/collator_is_numeric.c:18:
/BUILD/php-7.4.0/ext/intl/collator/collator_is_numeric.c: In function 'collator_u_strtod':
/BUILD/php-7.4.0/Zend/zend_portability.h:365:10: warning: 'use_heap' may be used
uninitialized in this function [-Wmaybe-uninitialized]
365 | do { if (UNEXPECTED(use_heap)) efree(p); } while (0)
| ^
/BUILD/php-7.4.0/ext/intl/collator/collator_is_numeric.c:74:15: note: 'use_heap' was
declared here
74 | ALLOCA_FLAG(use_heap);
| ^~~~~~~~
/BUILD/php-7.4.0/Zend/zend_portability.h:357:12: note: in definition of macro
'ALLOCA_FLAG'
357 | zend_bool name;
| ^~~~
In file included from /BUILD/php-7.4.0/Zend/zend.h:27,
from /BUILD/php-7.4.0/main/php.h:33,
from ext/intl/php_intl.h:23,
from /BUILD/php-7.4.0/ext/intl/spoofchecker/spoofchecker_main.c:21:
/BUILD/php-7.4.0/ext/intl/spoofchecker/spoofchecker_main.c: In function
'zim_Spoofchecker_areConfusable':
/BUILD/php-7.4.0/Zend/zend_types.h:776:18: warning: 'ret' may be used uninitialized in
this function [-Wmaybe-uninitialized]
776 | (b) ? IS_TRUE : IS_FALSE; \
| ^
/BUILD/php-7.4.0/ext/intl/spoofchecker/spoofchecker_main.c:61:6: note: 'ret' was declared
here
61 | int ret;
| ^~~
In file included from /usr/include/string.h:494,
from /BUILD/php-7.4.0/include/../main/php_config.h:2362,
from /BUILD/php-7.4.0/Zend/zend_config.h:1,
from /BUILD/php-7.4.0/Zend/zend_portability.h:43,
from /BUILD/php-7.4.0/Zend/zend_types.h:25,
from /BUILD/php-7.4.0/Zend/zend.h:27,
from /BUILD/php-7.4.0/main/php.h:33,
from /BUILD/php-7.4.0/ext/pdo/pdo_dbh.c:27:
In function 'strncpy',
inlined from 'pdo_raise_impl_error' at /BUILD/php-7.4.0/ext/pdo/pdo_dbh.c:59:2:
/usr/include/bits/string_fortified.h:106:10: warning: '__builtin_strncpy' specified bound
6 equals destination size [-Wstringop-truncation]
106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/bits/string_fortified.h:106:10: warning: '__builtin_strncpy' specified bound
6 equals destination size [-Wstringop-truncation]
In file included from /BUILD/php-7.4.0/main/php.h:33,
from /BUILD/php-7.4.0/ext/readline/readline_cli.c:24:
/BUILD/php-7.4.0/ext/readline/readline_cli.c: In function 'cli_get_prompt':
/BUILD/php-7.4.0/Zend/zend.h:214:12: warning: '__orig_bailout' may be used uninitialized
in this function [-Wmaybe-uninitialized]
214 | JMP_BUF *__orig_bailout = EG(bailout); \
| ^~~~~~~~~~~~~~
/BUILD/php-7.4.0/Zend/zend.h:214:12: note: '__orig_bailout' was declared here
214 | JMP_BUF *__orig_bailout = EG(bailout); \
| ^~~~~~~~~~~~~~
/BUILD/php-7.4.0/ext/readline/readline_cli.c:190:5: note: in expansion of macro 'zend_try'
190 | zend_try {
| ^~~~~~~~
/BUILD/php-7.4.0/ext/readline/readline_cli.c:184:10: warning: 'code' may be used
uninitialized in this function [-Wmaybe-uninitialized]
184 | char *code;
| ^~~~
/BUILD/php-7.4.0/ext/readline/readline_cli.c:183:10: warning: 'prompt_end' may be used
uninitialized in this function [-Wmaybe-uninitialized]
183 | char *prompt_end = strstr(prompt_spec + 1, "`");
| ^~~~~~~~~~
In file included from /BUILD/php-7.4.0/Zend/zend.h:27,
from /BUILD/php-7.4.0/main/php.h:33,
from /BUILD/php-7.4.0/ext/session/session.c:24:
/BUILD/php-7.4.0/ext/session/session.c: In function 'zif_session_create_id':
/BUILD/php-7.4.0/Zend/zend_types.h:1037:9: warning: 'new_id' may be used uninitialized in
this function [-Wmaybe-uninitialized]
1037 | return --(p->refcount);
| ^~~~~~~~~~~~~~~
/BUILD/php-7.4.0/ext/session/session.c:2272:31: note: 'new_id' was declared here
2272 | zend_string *prefix = NULL, *new_id;
| ^~~~~~
/BUILD/php-7.4.0/ext/sockets/sockets.c: In function 'zm_startup_sockets':
/BUILD/php-7.4.0/ext/sockets/sockets.c:853:13: warning: AI_IDN_ALLOW_UNASSIGNED is deprecated
853 | REGISTER_LONG_CONSTANT("AI_IDN_ALLOW_UNASSIGNED", AI_IDN_ALLOW_UNASSIGNED,
CONST_CS | CONST_PERSISTENT);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/BUILD/php-7.4.0/ext/sockets/sockets.c:854:13: warning: AI_IDN_USE_STD3_ASCII_RULES is deprecated
854 | REGISTER_LONG_CONSTANT("AI_IDN_USE_STD3_ASCII_RULES",
AI_IDN_USE_STD3_ASCII_RULES, CONST_CS | CONST_PERSISTENT);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/BUILD/php-7.4.0/ext/sockets/sockets.c: In function 'zif_socket_addrinfo_lookup':
/BUILD/php-7.4.0/ext/sockets/sockets.c:2578:13: warning: AI_IDN_ALLOW_UNASSIGNED is deprecated
2578 | if (flags & (AI_IDN_ALLOW_UNASSIGNED | AI_IDN_USE_STD3_ASCII_RULES)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/BUILD/php-7.4.0/ext/sockets/sockets.c:2578:13: warning: AI_IDN_USE_STD3_ASCII_RULES is deprecated
2578 | if (flags & (AI_IDN_ALLOW_UNASSIGNED | AI_IDN_USE_STD3_ASCII_RULES)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/BUILD/php-7.4.0/ext/sockets/conversions.c: In function 'from_zval_write_name':
/BUILD/php-7.4.0/ext/sockets/conversions.c:732:2: warning: 'family' may be used
uninitialized in this function [-Wmaybe-uninitialized]
732 | switch (family) {
| ^~~~~~
/BUILD/php-7.4.0/ext/sockets/conversions.c:708:7: note: 'family' was declared here
708 | int family;
| ^~~~~~
/BUILD/php-7.4.0/ext/sockets/conversions.c: In function 'from_zval_write_controllen':
/BUILD/php-7.4.0/ext/sockets/conversions.c:1117:11: warning: 'len' may be used
uninitialized in this function [-Wmaybe-uninitialized]
1117 | uint32_t len;
| ^~~
In file included from /BUILD/php-7.4.0/Zend/zend.h:30,
from /BUILD/php-7.4.0/main/php.h:33,
from /BUILD/php-7.4.0/ext/zip/php_zip.c:24:
/BUILD/php-7.4.0/ext/zip/php_zip.c: In function 'php_zip_extract_file.isra.0':
/BUILD/php-7.4.0/Zend/zend_alloc.h:161:26: warning: 'file_basename' may be used
uninitialized in this function [-Wmaybe-uninitialized]
161 | #define efree(ptr) _efree((ptr) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
| ^~~~~~
/BUILD/php-7.4.0/ext/zip/php_zip.c:152:15: note: 'file_basename' was declared here
152 | zend_string *file_basename;
| ^~~~~~~~~~~~~
In file included from /usr/include/string.h:494,
from /BUILD/php-7.4.0/include/../main/php_config.h:2362,
from /BUILD/php-7.4.0/Zend/zend_config.h:1,
from /BUILD/php-7.4.0/Zend/zend_portability.h:43,
from /BUILD/php-7.4.0/Zend/zend_types.h:25,
from /BUILD/php-7.4.0/Zend/zend.h:27,
from /BUILD/php-7.4.0/main/php.h:33,
from /BUILD/php-7.4.0/ext/zip/php_zip.c:24:
In function 'strncpy',
inlined from 'php_zip_glob' at /BUILD/php-7.4.0/ext/zip/php_zip.c:577:2:
/usr/include/bits/string_fortified.h:106:10: warning: '__builtin_strncpy' specified bound
4096 equals destination size [-Wstringop-truncation]
106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /BUILD/php-7.4.0/ext/mysqlnd/mysqlnd_wireprotocol.c:26:
/BUILD/php-7.4.0/ext/mysqlnd/mysqlnd_wireprotocol.c: In function
'php_mysqlnd_rowp_read_binary_protocol':
/BUILD/php-7.4.0/ext/mysqlnd/mysqlnd_statistics.h:90:11: warning: 'statistic' may be used
uninitialized in this function [-Wmaybe-uninitialized]
90 | if (_s1 != _p_s->count) MYSQLND_UPDATE_VALUE_AND_CALL_TRIGGER(_p_s, _s1, v1); \
| ^~
/BUILD/php-7.4.0/ext/mysqlnd/mysqlnd_wireprotocol.c:1470:32: note: 'statistic' was
declared here
1470 | enum_mysqlnd_collected_stats statistic;
| ^~~~~~~~~
/usr/bin/ld: ext/apcu/.libs/apc_mmap.o: in function `apc_mmap.cold':
apc_mmap.c:(.text.unlikely+0x3c): warning: the use of
mktemp' is dangerous, better use
mkstemp' or `mkdtemp'
copying selected object files to avoid basename conflicts...
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78566&edit=1