[Bug translator/5111] translator silently ignores "then" instead of "{"

joshua dot i dot stone at intel dot com sourceware-bugzilla@sourceware.org
Fri Oct 5 00:02:00 GMT 2007


------- Additional Comments From joshua dot i dot stone at intel dot com  2007-10-05 00:02 -------
Several features of the language are conspiring to bite you here: implicit
variable declarations, optional braces around a single statement, and optional
statement terminators.  So this:

>         if (func() < 0) then
>                 print("why no syntax error\n")

is effectively parsed as this:

    if (func() < 0) {
        then;
    }
    print("why no syntax error\n")

The parser thinks that 'then' is a variable, and the optimizer determines that
'then;' has no effect, so it is thrown away.  If you pass '-u' to stap, it will
throw an unresolved type for 'then'.

We may need a translator warning when it encounters such statements, with no
assigments and no function calls.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=5111

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the Systemtap mailing list