[SR-4579] String.append method causes malloc error, but appending by "+=" does not #47156
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
crash
Bug: A crash, i.e., an abnormal termination of software
optimized only
Flag: An issue whose reproduction requires optimized compilation
run-time crash
Bug → crash: Swift code crashed during execution
Attachment: Download
Environment
macOS Sierra 10.12.4
MacBook Pro (Retina, 13-inch, Early 2015)
2,9 GHz Intel Core i5
8 GB 1867 Mhz DDR3
Intel Iris Graphics 6100 1536 MB
Xcode 8.3.1
Additional Detail from JIRA
md5: fe2d0d52861310b8aba1d67eb1e583e2
duplicates:
Issue Description:
Hi!
I wrote a simple Swift program for college and ran into a problem. After compiling it for Release it started crashing on line 58 with the following error:
MNP3(4498,0x1008b53c0) malloc: *** error for object 0x10200e600: incorrect checksum for freed object - object was probably modified after being freed.
The strange thing is, when I replace the line 58 with:
predictedPoints += [(distanceWeDontKnowHeightFor, searchedHeight)]
so basically use "+=" instead of ".append" to append an element, the problem vanishes.
I attached two files in this ticket, the first one is obviously the source code. The second contains data needed for my program to run. If you want to try it by yourself you should specify the path to the second file in the line 12 of the source code.
The text was updated successfully, but these errors were encountered: