Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why do floating point arguments get wrong result under debugging in Core 3.0? #1321

Closed
zmjack opened this issue Dec 27, 2019 · 4 comments
Closed
Assignees
Milestone

Comments

@zmjack
Copy link

zmjack commented Dec 27, 2019

Scenario

Firstly, create a simple console application which is only include one other function except Main with a floating point argument.

Then, write simple code and set breakpoints as follows:

    class Program
    {
        public static float GetSingle(float instance) => instance;

        static void Main(string[] args)
        {
[breakpoint]            var ret = GetSingle(3.14f);
            Console.WriteLine(ret);
        }
    }

The breakpoints is necessary, that is the culprit for the wrong result.

Run it, wait for the program to stop at the breakpoint, and then continue.

The correct output is 3.14.

I use either Core 2.0 or Core 2.2, everything is fine.
ncore22

But I change it to Core 3.0, the result is going wrong.
ncore30

So, what might cause the problem?

@scalablecory scalablecory transferred this issue from dotnet/core Jan 6, 2020
@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Jan 6, 2020
@jkotas
Copy link
Member

jkotas commented Jan 6, 2020

This is difference between the behavior with breakpoint set vs. breakpoint not set.

@sdmaclea You have been looking into this class of issues recently. Is this one a known one?

@sdmaclea sdmaclea added this to the 5.0 milestone Jan 6, 2020
@sdmaclea sdmaclea self-assigned this Jan 6, 2020
@sdmaclea
Copy link
Contributor

sdmaclea commented Jan 6, 2020

This was fixed by dotnet/coreclr#25958. It was fixed after 3.0 was released, and should be fixed in 3.1.

So far, we have not backported the fix to 3.0.

@sdmaclea sdmaclea modified the milestones: 5.0, 3.1.x Jan 6, 2020
@sdmaclea
Copy link
Contributor

sdmaclea commented Jan 6, 2020

I'm going to close this. Feel free to reopen if we think there is a strong need to discuss backporting to 3.0.

@sdmaclea sdmaclea closed this as completed Jan 6, 2020
@tommcdon tommcdon removed the untriaged New issue has not been triaged by the area owner label Mar 7, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants