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: 2015-08-24 13:31 UTC
Votes:2
Avg. Score:2.5 ± 1.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: andreas at fink dot org Assigned: derick (profile)
Status: Assigned Package: Compile Warning
PHP Version: 7.0.0RC1 OS: OS X 10.11
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [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.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC