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 698997 - Slicing conversion issue on non-x86 architectures
Slicing conversion issue on non-x86 architectures
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Arrays
0.20.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2013-04-26 20:38 UTC by Jens Georg
Modified: 2013-05-21 04:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Generated C code (7.23 KB, text/x-csrc)
2013-04-26 20:38 UTC, Jens Georg
  Details
Tentative patch (1.21 KB, patch)
2013-04-27 15:34 UTC, Jürg Billeter
committed Details | Review

Description Jens Georg 2013-04-26 20:38:22 UTC
Created attachment 242620 [details]
Generated C code

Executing the included code on e.g. armhf, the assertion fails. If I explicitly cast the uint64 to int in the generated code, it works there.

nemequ suggested as a work-around on IRC to use an unowned temporary variable, which works as well.

class Foo : Object {
	public signal void available(uint8[] data);

	public void run() {
		Timeout.add_seconds (1, () => {
			uint64 length = 65536;
			var data = new uint8[65537];

			this.available(data[0:length]);

			return false;
		});
	}
}

class Bar : Object {
	public Bar(Foo foo) {
		foo.available.connect((data) => {
			assert (data.length == 65536);
		});
	}
}

int main (string[] args)
{
	var foo = new Foo();
	var bar = new Bar(foo);
	foo.run();
	var loop = new MainLoop(null, false);
	loop.run();
	return 0;
}
Comment 1 Jürg Billeter 2013-04-27 15:34:28 UTC
Created attachment 242662 [details] [review]
Tentative patch

Can you please verify that the attached patch fixes the issue?
Comment 2 Jens Georg 2013-04-28 11:17:23 UTC
Yes, that seems to fix it here
Comment 3 Jürg Billeter 2013-05-21 04:40:26 UTC
commit d1145ab86d6eb11fab5d9d813300b57812b2ba18
Author: Jürg Billeter <j@bitron.ch>
Date:   Sat Apr 27 17:31:02 2013 +0200

    Set target_type for start and stop values of slice expressions
    
    This ensures type conversions are generated as needed.
    
    Fixes bug 698997.