Bug 52866 - F# sprintf AOT bug still exists
Summary: F# sprintf AOT bug still exists
Status: VERIFIED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Mono runtime / AOT compiler (show other bugs)
Version: XI 10.4 (C9)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: 15.2
Assignee: Alex Soto [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2017-02-27 20:43 UTC by Y Wu
Modified: 2017-04-17 09:34 UTC (History)
7 users (show)

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


Attachments
Test case (9.21 KB, application/zip)
2017-02-27 21:33 UTC, Alex Soto [MSFT]
Details

Description Y Wu 2017-02-27 20:43:25 UTC
sprintf is AOTed incorrectly when it takes 5 or more than 5 arguments. 

Sample code:

  let a = 1111
  let b = 2222
  let c = 3333
  let d = 4444
  let e = 5555

  // This won't return "1111 2222 3333 4444 5555", but instead some random numbers for the second and the forth argument.
  // For example, one of my runs get "1111 715383768 3333 72446864 5555".
  let actual = sprintf "%d %d %d %d %d" a b c d e

The result is correct in mac and simulator, and only wrong in device. Note, this is not a duplicate bug as #21973 and #31060, which caused crash and are now marked as solved. This bug doesn't cause crash, but just produces wrong result.

My current machine setup:

Xamarin Studio Community
Version 6.2 (build 1821)
Installation UUID: f1a3a079-ea72-4e91-83f7-2b4e3c84ebfa
Runtime:
	Mono 4.8.0 (mono-4.8.0-branch/e4a3cf3) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 408000495

NuGet
Version: 3.5.0.0

Apple Developer Tools
Xcode 8.2.1 (11766.1)
Build 8C1002

Xamarin.iOS
Version: 10.4.0.123 (Xamarin Studio Community)
Hash: 35d1ccd
Branch: cycle9
Build date: 2017-02-16 17:40:00-0500

Build Information
Release ID: 602001821
Git revision: d41b6e51f3fa46a1943f2e31a778d28a7c73d069
Build date: 2017-02-17 15:18:19-05
Xamarin addins: 1363a8d943bab7700c93a97474060b6734aa7f94
Build lane: monodevelop-lion-cycle9

Operating System
Mac OS X 10.12.3
Darwin Amandas-iMac.local 16.4.0 Darwin Kernel Version 16.4.0
    Thu Dec 22 22:53:21 PST 2016
    root:xnu-3789.41.3~3/RELEASE_X86_64 x86_64
Comment 1 Alex Soto [MSFT] 2017-02-27 21:32:18 UTC
I can confirm this issue using current stable, I get 1111 60463048 3333 93898264 5555

=== Xamarin Studio Enterprise ===

Version 6.2 (build 1821)
Installation UUID: 48af9690-0e4c-4b21-b82d-5c9cce64d17e
Runtime:
	Mono 4.8.0 (mono-4.8.0-branch/e4a3cf3) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 408000495

=== Apple Developer Tools ===

Xcode 8.2 (11766)
Build 8C38

=== Xamarin.iOS ===

Version: 10.4.0.123 (Visual Studio Enterprise)
Hash: 35d1ccd
Branch: cycle9
Build date: 2017-02-16 17:40:00-0500

=== Build Information ===

Release ID: 602001821
Git revision: d41b6e51f3fa46a1943f2e31a778d28a7c73d069
Build date: 2017-02-17 15:18:19-05
Xamarin addins: 1363a8d943bab7700c93a97474060b6734aa7f94
Build lane: monodevelop-lion-cycle9

=== Operating System ===

Mac OS X 10.12.3
Darwin iAlexRet.lan 16.4.0 Darwin Kernel Version 16.4.0
    Thu Dec 22 22:53:21 PST 2016
    root:xnu-3789.41.3~3/RELEASE_X86_64 x86_64
Comment 2 Alex Soto [MSFT] 2017-02-27 21:33:10 UTC
Created attachment 20016 [details]
Test case
Comment 3 Zoltan Varga 2017-03-06 19:04:52 UTC
Should be fixed by mono master b37a2639e9ce31098056db930112439ce793a9ba.
Comment 4 Rolf Bjarne Kvinge [MSFT] 2017-03-07 06:18:44 UTC
@Zoltan, can this be back ported to 2017-02 and/or 4.8?
Comment 5 Zoltan Varga 2017-03-07 07:01:27 UTC
Backported to 2017-02 as 44560f1e67963d2bf0b0e6e0c8e3f3df3bfbf1c1.
Comment 6 Rolf Bjarne Kvinge [MSFT] 2017-03-07 10:50:14 UTC
I've bumped mono in the xamarin-macios/mono-2017-02 branch: https://github.com/xamarin/xamarin-macios/commit/ab82bea597a5c27bc606ff678f7131095b3cc4ff

@Alex, can you add an F# unit test for this failure (https://github.com/xamarin/xamarin-macios/blob/mono-2017-02/tests/fsharp/FSharpTests.fs), since it seems to be popping up at regular intervals?
Comment 7 Alex Soto [MSFT] 2017-03-22 03:04:01 UTC Comment hidden (obsolete)
Comment 8 Rolf Bjarne Kvinge [MSFT] 2017-03-22 09:47:03 UTC
F# Test PR: https://github.com/xamarin/xamarin-macios/pull/1892
Comment 10 Swati Gangrade 2017-04-14 12:43:16 UTC
@Y Wu , @Alex Soto, @Zoltan Varga and @Rolf Bjarne Kvinge - Can anyone please provide steps to reproduce this bug or please verify this issue as it is an unit testing related bug
Comment 11 GouriKumari 2017-04-14 15:17:03 UTC
@Swati:
You can verify this bug using the test case attached to the bug report. 

>> please verify this issue as it is an unit testing related bug
This issue wasn't logged as  a failure related to unit test. But AlexSoto has added a unit test  in comment #8 which is merged to d15-2, so that further regressions can be found.
Comment 12 Rolf Bjarne Kvinge [MSFT] 2017-04-17 09:34:36 UTC
There's no need for QA to verify this, since we added a unit test.

Note You need to log in before you can comment on or make changes to this bug.