D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4073 - core.cpuid crashes
Summary: core.cpuid crashes
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: druntime (show other issues)
Version: D2
Hardware: Other Mac OS X
: P2 normal
Assignee: Sean Kelly
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-08 06:29 UTC by biozic
Modified: 2014-02-15 02:46 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description biozic 2010-04-08 06:29:14 UTC
The following code crashes at runtime on Mac OS X, when executing 
---
import core.cpuid;
void main() {}
---

Trace:
0x00003405 D4core5cpuid8cpuidX86FZv + 37
0x00002a11 D4core5cpuid18_sharedStaticCtor1FZv + 29
0x000029af _D4core5cpuid15__modsharedctorFZv + 11
0x0000c1c2 D6object12_moduleCtor2FAPS6object10ModuleInfoiZv + 306
0x0000c236 D6object12_moduleCtor2FAPS6object10ModuleInfoiZv + 422
0x0000c02a _moduleCtor + 114
0x0000df7e D2rt6dmain24mainUiPPaZi6runAllMFZv + 26
0x0000dcde D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv + 42
0x0000dc6c main + 168
0x0000248d start + 53
Comment 1 Don 2010-06-09 08:01:20 UTC
I believe I have fixed this in druntime svn 313, but I don't have access to a mac. Could someone please check this, so that it can be mentioned in the changelog for the next release, if it is fixed?
(If it is genuinely fixed, then bug 4189 and bug 3658 are probably fixed as well).
Comment 2 Masahiro Nakagawa 2010-06-09 08:40:51 UTC
I tested following code using trunk on Mac OSX 10.6.3.

-----
import std.stdio, core.cpuid;

// from issue 4189
void main()
{
    auto vec = new double[10];

    foreach(i, ref x; vec) { x = cast(double) i; }

    vec[] *= 0.5;

    writeln(vec);
}
-----

It works! writeln prints "0 0.5 1 1.5 2 2.5 3 3.5 4 4.5".
Comment 3 Don 2010-06-09 11:54:26 UTC
(In reply to comment #2)
> I tested following code using trunk on Mac OSX 10.6.3.
> It works! writeln prints "0 0.5 1 1.5 2 2.5 3 3.5 4 4.5".
Thanks!

Fixed druntime svn 313.