php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78545 Obsessive 'long' to 'double' warning while compiling on macOS
Submitted: 2019-09-15 21:22 UTC Modified: 2019-09-16 17:29 UTC
From: stas@php.net Assigned: nikic (profile)
Status: Closed Package: Compile Warning
PHP Version: master-Git-2019-09-15 (Git) OS: macOS
Private report: No CVE-ID: None
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
16 - 10 = ?
Subscribe to this entry?

 
 [2019-09-15 21:22 UTC] stas@php.net
Description:
------------
I've noticed that recently I've been getting tons of warnings compiling PHP, which are the same warning essentially:

/src/php-src/Zend/zend_API.c:333:21: warning: implicit conversion from 'long' to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Wimplicit-int-float-conversion]
                                if (UNEXPECTED(!ZEND_DOUBLE_FITS_LONG(d))) {
                                                ^~~~~~~~~~~~~~~~~~~~~~~~
Zend/zend_operators.h:93:45: note: expanded from macro 'ZEND_DOUBLE_FITS_LONG'
#       define ZEND_DOUBLE_FITS_LONG(d) (!((d) >= ZEND_LONG_MAX || (d) < ZEND_LONG_MIN))
                                               ~~ ^~~~~~~~~~~~~
Zend/zend_long.h:34:24: note: expanded from macro 'ZEND_LONG_MAX'
# define ZEND_LONG_MAX INT64_MAX
                       ^~~~~~~~~
/usr/include/stdint.h:163:22: note: expanded from macro 'INT64_MAX'
# define INT64_MAX              (__INT64_C(9223372036854775807))
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/stdint.h:145:24: note: expanded from macro '__INT64_C'
#  define __INT64_C(c)  c ## L
                        ^~~~~~
<scratch space>:32:1: note: expanded from here
9223372036854775807L
^~~~~~~~~~~~~~~~~~~~
Zend/zend_portability.h:323:52: note: expanded from macro 'UNEXPECTED'
# define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
                                                   ^~~~~~~~~

This seems to have something to do with how we do ZEND_DOUBLE_FITS_LONG and it's extremely annoying and makes it hard to watch for other warnings. 

The compiler is standard one coming with macOS Mojave:

Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0

but other clang versions, like on Linux:
clang version 10.0.0 (trunk 371202)

produce the same. 


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-09-16 13:01 UTC] nikic@php.net
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2f6efd835d794222d42196ae51fa8294f9b9a992
Log: Fixed bug #78545
 [2019-09-16 13:01 UTC] nikic@php.net
-Status: Open +Status: Closed
 [2019-09-16 13:02 UTC] nikic@php.net
-Assigned To: +Assigned To: nikic
 [2019-09-16 13:02 UTC] nikic@php.net
Not seeing this myself on clang 9, but I think this should be fixed now.
 [2019-09-16 17:29 UTC] stas@php.net
Yes, clang does not complain anymore.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 14 06:01:27 2024 UTC