Thread overview
[Issue 4599] New: Error messages with missing memory for array operations
Aug 09, 2010
Andrej Mitrovic
Aug 09, 2010
Don
August 08, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4599

           Summary: Error messages with missing memory for array
                    operations
           Product: D
           Version: D1 & D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@eml.cc 2010-08-08 14:29:12 PDT ---
(I don't know where to file this, so I open a new bug report, sorry if it is a
duplicated.)

I'd like DMD 2.047 to catch this bug at compile time (so this is more an
enhancement request):

import std.stdio: writeln;
void main() {
    double[] a = [1];
    writeln(a[] + 1); // access violation
}

----------------

This prints nothing and raises no compile-time or run-time errors (this is more
like a bug):

import std.stdio: writeln;
void main() {
    int[] a1 = [1, 2];
    int[] a2 = [3, 4];
    int[] a3;
    a3[] = a1[] + a2[];
    writeln(a3);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 09, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4599


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2010-08-08 17:54:43 PDT ---
Isn't the second one similar to what I've reported in Issue 4521 ?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 09, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4599



--- Comment #2 from bearophile_hugs@eml.cc 2010-08-08 18:55:32 PDT ---
I think it is not, because here you aren't setting the items of a3 to a certain value, you are assigning a certain number of values coming from the vector operation. And there is not enough space for them.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 09, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4599


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug@yahoo.com.au
         Resolution|                            |DUPLICATE


--- Comment #3 from Don <clugdbug@yahoo.com.au> 2010-08-09 00:05:25 PDT ---
The first case is a dup of regression bug 4578, which is fixed in the beta of
2.048.
The second case is a dup of bug 2547.

*** This issue has been marked as a duplicate of issue 2547 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------