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 729255 - Possible name conflicts in generated code
Possible name conflicts in generated code
Status: RESOLVED DUPLICATE of bug 472259
Product: vala
Classification: Core
Component: Code Generator
0.24.x
Other All
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
: 701885 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2014-04-30 11:04 UTC by Kyrylo V. Polezhaiev
Modified: 2018-02-19 09:18 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Kyrylo V. Polezhaiev 2014-04-30 11:04:59 UTC
For example:

int main(string [] args)
{
	int _tmp3_ = 0;
	for (int i = 4; i < 9; ++i)
	{
		_tmp3_ += i;
		stdout.printf("%d\n", _tmp3_);
	}
	stdout.printf("%d\n", _tmp3_);
	return _tmp3_;
}

Expected output:
4
9
15
22
30
30

Actual output:
4
5
6
7
8
0
Comment 1 Kyrylo V. Polezhaiev 2014-04-30 11:08:43 UTC
Obviously, the error caused by code generator which creates _tmp3_ variable inside for loop. That variable overlaps outer one inside block.
Comment 2 Kyrylo V. Polezhaiev 2014-05-05 18:57:45 UTC
Nobody cares? May be we can tweak tmp variables name choosing algorithm? Or just users shouldn't use such names?
Comment 3 Luca Bruno 2014-05-05 19:20:35 UTC
We are open to accepting patches for avoiding such name clashes, however it's really low priority. It's not a blocker if you can't use those names. I'm sure your code was written right for breaking the codegen, rather than writing real code.
Comment 4 Kyrylo V. Polezhaiev 2015-09-06 17:31:40 UTC
If you want C and Vala names to be in same namespace, at least let's warn users in such cases.
Comment 5 Rico Tzschichholz 2018-02-19 09:09:08 UTC
*** Bug 701885 has been marked as a duplicate of this bug. ***
Comment 6 Rico Tzschichholz 2018-02-19 09:18:16 UTC

*** This bug has been marked as a duplicate of bug 472259 ***