Bug 25487 - Arithmetics bug on 64bit
Summary: Arithmetics bug on 64bit
Status: VERIFIED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 8.4.0
Hardware: PC Windows
: Normal normal
Target Milestone: 8.6.0
Assignee: Zoltan Varga
URL:
: 25458 ()
Depends on:
Blocks:
 
Reported: 2014-12-18 02:38 UTC by Grigory (Playtika)
Modified: 2015-01-06 12:25 UTC (History)
5 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Zipped project (4.00 KB, application/zip)
2014-12-18 05:02 UTC, Rolf Bjarne Kvinge [MSFT]
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Grigory (Playtika) 2014-12-18 02:38:58 UTC
(Int32)-255 * (float)1 = Bullshit
(long)-255 * (float)1 = -255

Classic api works OK.
Probably higher bits in register are not reset (when casted to Int32) and old values are multiplicated.
Comment 1 Rolf Bjarne Kvinge [MSFT] 2014-12-18 05:02:44 UTC
Created attachment 9119 [details]
Zipped project

Attaching test project.
Comment 2 Rolf Bjarne Kvinge [MSFT] 2014-12-18 05:04:44 UTC
Zoltan, this looks like incorrect arm64 codegen.

IMO this is an important issue, since we'll silently do the wrong math.
Comment 3 Rolf Bjarne Kvinge [MSFT] 2014-12-18 05:05:50 UTC
*** Bug 25458 has been marked as a duplicate of this bug. ***
Comment 4 Ram Chandra 2014-12-18 11:29:23 UTC
I have checked this issue with attached sample and I am also getting the same behavior.

Observations: 

Ipad Mini (8.0.2) : Classic API

 -255 * 1f = -255
 255 * 1f = 255

Ipad Mini ( 8.0.2) : Unified API

-255 * 1f = 4.294967E+09
255 * 1f = 255

Screencast: http://www.screencast.com/t/OR9Yh075kY

Additional Info: I am not getting this issue with classic api project.

Environment Info:

Mac Info:

Mac OS X 10.9.5
Xamarin Studio: 5.5.4 (build 15)
Mono 3.10.0 ((detached/92c4884)
GTK+ 2.24.23 (Raleigh theme)
Package version: 310000031
Xcode 6.1 (6604)
Build 6A1052d
Xamarin.iOS : 8.4.0.47 (Business Edition)
=== Build Information ===
Release ID: 505040015
Git revision: f93940a35458a18052f1a25e106e62ca970d9c40
Build date: 2014-11-19 15:32:41-05
Xamarin addins: dc23cbd91a3a0e1d326328e1229e86c942a49ec8


Windows Info:

Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.50938
Installed Version: Professional
Xamarin   3.8.150.0 (10cfd178d55287f09c85f5a1e604dfe20889a40f)
Xamarin.Android   4.20.0.28 (ba9bbbdd44cfdc4bf485e8885bd2ad24fba525f7)
Xamarin.iOS   8.4.0.0 (840a925103a0bf4a856507f13d5eaee3c1579c2f)
Comment 5 Zoltan Varga 2015-01-03 02:19:45 UTC
Fixed in mono-extensions ac8352691c92ea4a3145efc2cf3fcf4e39bfbce1.
Comment 6 Rolf Bjarne Kvinge [MSFT] 2015-01-05 04:28:17 UTC
Sebastien, this might be a candidate for inclusion in 8.6.
Comment 7 Sebastien Pouliot 2015-01-05 09:00:25 UTC
@Rolf, might be hard as it should be released today. OTOH it's a candidate as it's Target Milestone was (and still is) set to 8.6.0

@Zoltan let's not close bugs (maybe use IN_PROGRESS) until the fixes are committed to the final (milestone) branches. Otherwise QA will re-open the bug when verifying a newer build of 8.6.

If a fix cannot be backported for any reason then the milestone needs to be updated (along with the reason why).

From what I can see both ac8352691c92ea4a3145efc2cf3fcf4e39bfbce1 and 45185036aebd97b2e0ad42f7e3cdec9901b4c1d9 commits would need to be backported.
Comment 8 Sebastien Pouliot 2015-01-05 09:01:03 UTC
set to IN_PROGRESS as the fix is currently only on master and not on 8.6
Comment 9 Sebastien Pouliot 2015-01-05 12:42:43 UTC
Backported to monotouch-8.6.0-branch in cb9aa8428c4d41de5ee53797a6f05cacb43bc32c
Comment 10 Ram Chandra 2015-01-06 12:25:00 UTC
I have checked this issue with the following builds:

Windows Info:
Microsoft Visual Studio Professional 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.5.51641
Installed Version: Professional
Xamarin   3.9.235.0 (23e2325)
Xamarin.Android   4.20.0.34 (49a04b966feb40dfdba49d57ba16249b66d606a6)
Xamarin.iOS   8.6.0.0 (cb9aa8428c4d41de5ee53797a6f05cacb43bc32c)

Mac Info:
Mac OS X 10.9.4
Xamarin Studio: 5.5.4 (build 15)
Mono 3.12.0 ((detached/a813491)
GTK+ 2.24.23 (Raleigh theme)
Package version: 312000068
Xcode 6.1 (6604)
Build 6A1052d
Xamarin.iOS: 8.6.0.48 (Business Edition)
=== Build Information ===
Release ID: 505040015
Git revision: f93940a35458a18052f1a25e106e62ca970d9c40
Build date: 2014-11-19 15:32:41-05
Xamarin addins: dc23cbd91a3a0e1d326328e1229e86c942a49ec8


I have checked this issue with the both Classic and Unified API and observed that I am getting same result for both API. 

Output: 

Ipad Mini (8.0.2) : Classic API
-255 * 1f = -255
255 * 1f = 255

Ipad Mini (8.0.2) : Unified API
-255 * 1f = -255
 255 * 1f = 255

Screencast: http://www.screencast.com/t/ZkcDlWyUb

This issue has been fixed. Hence I am closing this issue.