public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug translator/5111] New: translator silently ignores "then" instead of "{"
@ 2007-10-04 23:15 dcnltc at us dot ibm dot com
  2007-10-05  0:02 ` [Bug translator/5111] " joshua dot i dot stone at intel dot com
  2007-10-05  0:18 ` fche at redhat dot com
  0 siblings, 2 replies; 3+ messages in thread
From: dcnltc at us dot ibm dot com @ 2007-10-04 23:15 UTC (permalink / raw)
  To: systemtap

In the following tapscript I unwittingly inserted "then" in an if stmt.  The
translator accepted this without complaint, but basically ignored the if.

I was expecting a syntax error.  Is this a legal if stmt?

function func:long ()
%{
        THIS->__retvalue = -1;
%}

probe begin
{
        if (func() < 0) then
                print("why no syntax error\n")
        printf("after if stmt\n")
}

-- 
           Summary: translator silently ignores "then" instead of "{"
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P3
         Component: translator
        AssignedTo: systemtap at sources dot redhat dot com
        ReportedBy: dcnltc at us dot ibm dot com


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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug translator/5111] translator silently ignores "then" instead of "{"
  2007-10-04 23:15 [Bug translator/5111] New: translator silently ignores "then" instead of "{" dcnltc at us dot ibm dot com
@ 2007-10-05  0:02 ` joshua dot i dot stone at intel dot com
  2007-10-05  0:18 ` fche at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: joshua dot i dot stone at intel dot com @ 2007-10-05  0:02 UTC (permalink / raw)
  To: systemtap


------- 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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug translator/5111] translator silently ignores "then" instead of "{"
  2007-10-04 23:15 [Bug translator/5111] New: translator silently ignores "then" instead of "{" dcnltc at us dot ibm dot com
  2007-10-05  0:02 ` [Bug translator/5111] " joshua dot i dot stone at intel dot com
@ 2007-10-05  0:18 ` fche at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: fche at redhat dot com @ 2007-10-05  0:18 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From fche at redhat dot com  2007-10-05 00:18 -------
an oldie but goodie


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

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-10-05  0:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-04 23:15 [Bug translator/5111] New: translator silently ignores "then" instead of "{" dcnltc at us dot ibm dot com
2007-10-05  0:02 ` [Bug translator/5111] " joshua dot i dot stone at intel dot com
2007-10-05  0:18 ` fche at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).