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

MinGW: std.math.{sin, tan} crash/garbage #432

Closed
dnadlinger opened this issue Jul 28, 2013 · 1 comment
Closed

MinGW: std.math.{sin, tan} crash/garbage #432

dnadlinger opened this issue Jul 28, 2013 · 1 comment

Comments

@dnadlinger
Copy link
Member

bearophile reported the following issue with the 0.11.0 MinGW32 build on dm.D.ldc:

———

Maybe I have found some more problems. The program:

import core.stdc.stdio, std.math;

void test(in double nLoops) nothrow {
    double rsin = 0.0;
    double rtan = 0.0;

    double i = 0.0;
    while (i < nLoops) {
        rsin = sin(i);
        rtan = tan(i);
        i++;
    }

    printf("i: %f\n", i);
    printf("sin: %f\n", rsin);
    printf("tan: %f\n", rtan);
}

void main() {
    test(2_000_000);
}

DMD seems to print the correct values:

i: 2000000.000000
sin: -0.989602
tan: 6.880292

The program compiled with ldmd2 (on a 32 bit Windows system, with no switches) crashes when it tries to print "i". If I comment out the printf line of "i" then the program prints:

sin: -0.000000
tan: nan
@dnadlinger
Copy link
Member Author

This was also caused by the Win64-specific longdouble (i.e. real functions), and is fixed in Git master. (cc @bearophile)

redstar pushed a commit that referenced this issue Sep 27, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant