php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70340 use of abs() instead of llabs() for long long
Submitted: 2015-08-24 12:12 UTC Modified: 2020-04-16 12:49 UTC
Votes:4
Avg. Score:2.8 ± 1.1
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:2 (66.7%)
From: andreas at fink dot org Assigned: derick (profile)
Status: Closed Package: Compile Warning
PHP Version: 7.0.0RC1 OS: OS X 10.11
Private report: No CVE-ID: None
View Add Comment Developer Edit
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:
18 - 6 = ?
Subscribe to this entry?

 
 [2015-08-24 12:12 UTC] andreas at fink dot org
Description:
------------
While compiling under OS X, the compiler warns us about a probably unwanted type conversion:

php-7.0.0RC1/ext/date/php_date.c:2196:6: warning: absolute value function 'abs' given an argument of type
      'long long' but has parameter of type 'int' which may cause truncation of value [-Wabsolute-value]
                                        abs(utc_offset / 60),
                                        ^
php-7.0.0RC1/ext/date/php_date.c:2196:6: note: use function 'llabs' instead
                                        abs(utc_offset / 60),
                                        ^~~
                                        llabs


given input is long long, we probably want output to be long long too or we might have a year 2038 problem (https://en.wikipedia.org/wiki/Year_2038_problem)


Test script:
---------------
./configure



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-08-24 13:12 UTC] laruence@php.net
-Assigned To: +Assigned To: ab
 [2015-08-24 13:19 UTC] laruence@php.net
-Assigned To: ab +Assigned To: derick
 [2015-08-24 13:31 UTC] ab@php.net
Yeah, that was seen actually in the build logs all the time. But not critical IMHO in first place as the TZ offset can't grow that much. Still the warning should be probably fixed.

Thanks.
 [2020-04-16 12:49 UTC] nikic@php.net
-Status: Assigned +Status: Closed
 [2020-04-16 12:49 UTC] nikic@php.net
This has been fixed in the meantime.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 15:01:30 2024 UTC