Uploaded image for project: 'Swift'
  1. Swift
  2. SR-9771

Playgrounds not Trapping during Bad Access

    XMLWordPrintable

    Details

      Description

      As per this Swift Forums topic, the following code should trap due to overlapping read/write access.

      var stepSize = 1
      
      func increment(_ number: inout Int) {
          number += stepSize
      }
      
      increment(&stepSize)
      

      As specified on the docs,

      > The read and write accesses refer to the same memory and they overlap, producing a conflict.

      However, I put the code in a playground like such:

      ![](https://github.com/SafelySwift/images/blob/master/Screen%20Shot%202019-01-26%20at%204.30.06%20PM.png)

      And nothing happens

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              SafelySwift Ethan Uppal
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: