www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8650] New: SLice opOpAssign SLice with overlap does not throw

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8650

           Summary: SLice opOpAssign SLice with overlap does not throw
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: monarchdodra gmail.com


--- Comment #0 from monarchdodra gmail.com 2012-09-13 08:34:37 PDT ---
--------
void main()
{
  int[] b = new int[](10);
  b[] = 5;
  b[0..6] += b[4..10];
}
--------
Behavior: Runs until end of program.
Expected: A error to be thrown: Overlapping operations are illegal.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 13 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8650



--- Comment #1 from monarchdodra gmail.com 2012-09-15 06:40:47 PDT ---
Also, doesn't check length:

--------
void main()
{
    int[ 5] a;
    int[10] b;
    a[] += b[];
    b[] += a[];
}
--------
Behavior: Runs until end of program.
Expected: A error to be thrown: arrays have different length.
--------

The problem would seem to come from "arrayint.d" from druntime.
Apparently, the "in" tests are not executed, because the tests are in there.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 15 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8650


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc


--- Comment #2 from bearophile_hugs eml.cc 2012-09-15 06:44:59 PDT ---
(In reply to comment #1)

 The problem would seem to come from "arrayint.d" from druntime.
 Apparently, the "in" tests are not executed, because the tests are in there.

And replacing those asserts with "enforces" inside the function body is not a solution (it's just a way to try to kill D Contract Programming). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 15 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8650



--- Comment #3 from monarchdodra gmail.com 2012-09-15 07:01:03 PDT ---
(In reply to comment #2)
 (In reply to comment #1)
 
 The problem would seem to come from "arrayint.d" from druntime.
 Apparently, the "in" tests are not executed, because the tests are in there.

And replacing those asserts with "enforces" inside the function body is not a solution (it's just a way to try to kill D Contract Programming).

I don't seem to remember suggesting that... I was just stating where I think the problem comes from. I'm compiling in debug, so I expected the assert to be evaluated. As a matter of fact, if anything, given related issue 8651, I'd have placed asserts in the function body. NOT enforces. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 15 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8650


monarchdodra gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


--- Comment #4 from monarchdodra gmail.com 2012-11-22 22:51:24 PST ---
(In reply to comment #1)
 The problem would seem to come from "arrayint.d" from druntime.
 Apparently, the "in" tests are not executed, because the tests are in there.

Turns out the problem is that the in/assert cases are removed from the druntime libs, since it is compiled in release when distributed. It would be *nice* for these tests to be run depending on the current program's compilation flags, and no druntimes. Changing to ER. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 22 2012