Skip to content

F# compiler bug in release mode in VS2015 Update 1 #759

Closed

Description

In F# compound loops where the sequences are defined locally, in release mode only, F# generates a compile-time error saying that the name of the sequence being looped over is not found, generating error FS0971: Undefined value. Bizarrely this seems to be the case only when the outer loop is over the elements of a set.
I am using Visual Studio 2015 Update 1 RTM - 14.0.24720.00

I have managed to repro this in a few simple lines of code. Please see below.

Activity

  1. mjmckp commented on Dec 3, 2015

    @mjmckp
    Contributor

    Replacing 'set' with 'seq' above also causes the compile error.

  2. dsyme commented on Dec 3, 2015

    @dsyme
    Contributor

    This is the same as the bug fixed by #756. Let's use this as the tracking issue for the problem.

  3. KevinRansom commented on Dec 4, 2015

    @KevinRansom
    Contributor

    Fix merged:
    commit:
    c1e0bc8
    PR:
    #759

  4. KevinRansom commented on Dec 4, 2015

    @KevinRansom
    Contributor

    Thank you for reporting this. The fix is in, it will be in the next release of Visual F#.

  5. dsyme commented on Dec 5, 2015

    @dsyme
    Contributor

    f you do need to get your code to compile and you are using Update 1, it appears sufficient to place something benign prior to any loop where this problem is occurring, like this:

    // do something that doesn't get optimized away
    let workaround() = null |> ignore  
    
    let configure () =
     let aSequence = Microsoft.FSharp.Core.Operators.(..) 3 4
     let aString = new string('a',3)
     workaround()
     for _ in aSequence do
       System.Console.WriteLine(aString)
    
    configure ()
    
    

    That said I really hope a fix is made available as soon as possible.

    Obviously these calls should be removed as soon as a fix release is made available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Impact-High(Internal MS Team use only) Describes an issue with extreme impact on existing code.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions