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 Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: andreas at fink dot org
New email:
PHP Version: OS:

 

 [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

Pull Requests

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: Wed Dec 11 16:01:28 2024 UTC