GNOME Bugzilla – Bug 729255
Possible name conflicts in generated code
Last modified: 2018-02-19 09:18:16 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
Obviously, the error caused by code generator which creates _tmp3_ variable inside for loop. That variable overlaps outer one inside block.
Nobody cares? May be we can tweak tmp variables name choosing algorithm? Or just users shouldn't use such names?
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.
If you want C and Vala names to be in same namespace, at least let's warn users in such cases.
*** Bug 701885 has been marked as a duplicate of this bug. ***
*** This bug has been marked as a duplicate of bug 472259 ***