D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7042 - Allocation of 'creal' array with 'new' fails when linking without /noi switch
Summary: Allocation of 'creal' array with 'new' fails when linking without /noi switch
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: tools (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-01 03:51 UTC by Taco
Modified: 2017-07-21 04:14 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Taco 2011-12-01 03:51:52 UTC
Consider the following code:

main.d:
import std.stdio;

int main()
{      
    alias creal T;

    writeln("alloc");
    T[] x = new T[4];
    writeln("done");
    return 0;
}

This runs fine when compiled with:
dmd main.d
main

However, it never displays "done" (it hangs) when compiled with:
dmd -c main.d
link main.obj
main

This is the case ONLY if T is 'double', 'idouble', 'creal'. I tried all other types, but they work fine. Even a struct with one member of type double.

I use the binary package for windows of D2.056, at a Win7 32bit system. If you need more info, please ask.
Comment 1 Taco 2011-12-01 03:55:38 UTC
Might be duplicate of http://d.puremagic.com/issues/show_bug.cgi?id=3683
Except the linker links fine, the final executable does not.
Comment 2 Andrej Mitrovic 2013-03-11 20:38:39 UTC
The issue is with how the linker is invoked, not with DMD itself. Reduced test-case:

void main()
{
    creal[] x = new creal[4];
}

$ dmd -c test.d

OK:

$ link test.obj /noi
$ test.exe

Hangs:

$ link test.obj
$ test.exe

/noi is short for /noignorecase

Perhaps we must always use /noi, in which case this is an invalid bug report. Walter?
Comment 3 Vladimir Panteleev 2017-07-21 04:14:49 UTC
(In reply to Andrej Mitrovic from comment #2)
> Perhaps we must always use /noi, in which case this is an invalid bug
> report.

It's certainly weird that the Microsoft linker defaults to case-insensitivity even though C is case-sensitive, but it's no surprise if weird bugs arise from said case-insensitivity.

In any case, I don't see why wrong link settings need to be DMD's burden. Though it's not impossible that a workaround in DMD in theory might exist, the primary cause of this problem is clearly user error.