www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12198] New: Catch some wrong overlapping array operations at compile time

https://d.puremagic.com/issues/show_bug.cgi?id=12198

           Summary: Catch some wrong overlapping array operations at
                    compile time
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2014-02-18 13:40:56 PST ---
void main() {
    int[1] a, b;
    a[] = a[];
    a[] = a[] + b[];
    a[] = a[] * 2;
}


With DMD 2.065rc1 that code compiles, and then it gives at run-time:

object.Error: Overlapping arrays in vector operation: 4 byte(s) overlap of 4

I suggest to catch similar basic cases at compile-time.

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