After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 667452 - Vala array.move assume overlapping regions
Vala array.move assume overlapping regions
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Arrays
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks: 679587
 
 
Reported: 2012-01-07 03:29 UTC by Maciej (Matthew) Piechotka
Modified: 2012-07-12 12:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
0001-Allow-move-array-elements-even-in-case-when-the-area.patch (3.70 KB, patch)
2012-01-07 03:29 UTC, Maciej (Matthew) Piechotka
none Details | Review

Description Maciej (Matthew) Piechotka 2012-01-07 03:29:56 UTC
Created attachment 204795 [details] [review]
0001-Allow-move-array-elements-even-in-case-when-the-area.patch

The code for array.move assumes overlapping regions. Compare output for following program:

int main() {
	int[] items = new int[10];
	for(int i = 0; i < 10; i++)
		items[i] = i + 1;
	items.move(0, 3, 2);
	items.move(5, 6, 3);
	for(int i = 0; i < 10; i++)
		stdout.printf("%d: %d\n", i + 1, items[i]);
	return 0;
}

patched:

1: 0
2: 0
3: 3
4: 1
5: 2
6: 0
7: 6
8: 7
9: 8
10: 10

unpatched:

1: 0
2: 0
3: 0
4: 1
5: 2
6: 0
7: 6
8: 7
9: 8
10: 10
Comment 1 Jürg Billeter 2012-07-12 12:02:42 UTC
commit b3ade40b8afd69c171ea435ebfb92ae9b6a643e5
Author: Maciej Piechotka <uzytkownik2@gmail.com>
Date:   Sat Jan 7 04:19:25 2012 +0100

    codegen: Fix array move when the areas don't overlap
    
    Fixes bug 667452.