public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug translator/18079] New: autocast doesn't work with @defined
@ 2015-03-03 22:11 jistone at redhat dot com
  2015-03-03 22:25 ` [Bug translator/18079] " jistone at redhat dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: jistone at redhat dot com @ 2015-03-03 22:11 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=18079

            Bug ID: 18079
           Summary: autocast doesn't work with @defined
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: translator
          Assignee: systemtap at sourceware dot org
          Reporter: jistone at redhat dot com

The "autocast" feature of type propagation doesn't work with @defined.  For
example, "@defined(@task(0)->mm)" is 1 since mm does exist in this @cast
task_struct.  But "@defined(task_current()->mm)" becomes 0, even though
task_current() also returns a @task() value.

This is because const-folding, including @defined, happens in
semantic_pass_optimize1 before the type propagation and autocast expansion in
semantic_pass_types.  An un-expanded @defined is assumed to be bad.  But
there's tricky interplay here, as some types might not be possible to resolve
until other @defined have been resolved to simplify things, so we can't just
reorder these.

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

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

* [Bug translator/18079] autocast doesn't work with @defined
  2015-03-03 22:11 [Bug translator/18079] New: autocast doesn't work with @defined jistone at redhat dot com
@ 2015-03-03 22:25 ` jistone at redhat dot com
  2016-05-27 14:25 ` dsmith at redhat dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jistone at redhat dot com @ 2015-03-03 22:25 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=18079

--- Comment #1 from Josh Stone <jistone at redhat dot com> ---
Added testsuite/semok/autocast14.stp for this PR.

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

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

* [Bug translator/18079] autocast doesn't work with @defined
  2015-03-03 22:11 [Bug translator/18079] New: autocast doesn't work with @defined jistone at redhat dot com
  2015-03-03 22:25 ` [Bug translator/18079] " jistone at redhat dot com
@ 2016-05-27 14:25 ` dsmith at redhat dot com
  2016-05-27 17:24 ` jistone at redhat dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: dsmith at redhat dot com @ 2016-05-27 14:25 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=18079

David Smith <dsmith at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dsmith at redhat dot com

--- Comment #2 from David Smith <dsmith at redhat dot com> ---
Created attachment 9288
  --> https://sourceware.org/bugzilla/attachment.cgi?id=9288&action=edit
workaround patch

Here's a patch that attempts to workaround this bug. It adds an error message
when autocast operators are used with @define. Using this error message, I used
the buildok test to check for errors in the tapset. The only problems I found
were in tapset/linux/nfs_proc.stp. Fixes for that tapset are included in the
patch.

With this patch, I then ran the entire testsuite. The only other time the new
error message was printed was in semok/autocast14.stp.

Here's what the error message looks like in use:

====
semantic error: autocast operators don't work with @defined: operator
'@defined' at /root/src/testsuite/semok/autocast14.stp:14:10
        source:     if (!@defined(task_current()->mm)) {
                         ^

Pass 2: analysis failed.  [man error::pass2]^M
====

Should this be an error or warning?

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

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

* [Bug translator/18079] autocast doesn't work with @defined
  2015-03-03 22:11 [Bug translator/18079] New: autocast doesn't work with @defined jistone at redhat dot com
  2015-03-03 22:25 ` [Bug translator/18079] " jistone at redhat dot com
  2016-05-27 14:25 ` dsmith at redhat dot com
@ 2016-05-27 17:24 ` jistone at redhat dot com
  2016-06-22 15:48 ` fche at redhat dot com
  2016-06-24 17:43 ` jistone at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: jistone at redhat dot com @ 2016-05-27 17:24 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=18079

--- Comment #3 from Josh Stone <jistone at redhat dot com> ---
Ideally this *should* work, so I'm not sure I like making it a hard error. 
That seems to blame the user for our shortcoming.  But a warning will let it
pass through while almost certainly not acting as the user desires.

So... I guess an error is better, but the message should make it clear this is
a bug, not the user's fault.

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

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

* [Bug translator/18079] autocast doesn't work with @defined
  2015-03-03 22:11 [Bug translator/18079] New: autocast doesn't work with @defined jistone at redhat dot com
                   ` (2 preceding siblings ...)
  2016-05-27 17:24 ` jistone at redhat dot com
@ 2016-06-22 15:48 ` fche at redhat dot com
  2016-06-24 17:43 ` jistone at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: fche at redhat dot com @ 2016-06-22 15:48 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=18079

Frank Ch. Eigler <fche at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fche at redhat dot com

--- Comment #4 from Frank Ch. Eigler <fche at redhat dot com> ---
Please see the commit on branch fche/pr18079 for a possible fix to this.  I'd
appreciate a review.

commit 056cb27baac1ce3ab4d675dbbe4881afde801ca3
Author: Frank Ch. Eigler <fche@redhat.com>
Date:   Wed Jun 22 11:43:33 2016 -0400

    PR18079: support nested autocast / @defined

    We now perform const-folding & dead-code-elision during the type
    resolution loop, whenever an autocast expression gets evaluated.  This
    way, @defined(foo()->mm) type expressions can work as nature intended.

    This requires @defined() not to be short-circuit evaluated to 0 during
    a random const_folding process, so a flag is introduced to control its
    preservation or collapsing.  For the last (assert_resolvability) pass
    in the type resolution loop, this flag is set to true, so that
    genuinely unresolvable @defined($expressions) do get mapped to 0 in
    time for a last elision.

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

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

* [Bug translator/18079] autocast doesn't work with @defined
  2015-03-03 22:11 [Bug translator/18079] New: autocast doesn't work with @defined jistone at redhat dot com
                   ` (3 preceding siblings ...)
  2016-06-22 15:48 ` fche at redhat dot com
@ 2016-06-24 17:43 ` jistone at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: jistone at redhat dot com @ 2016-06-24 17:43 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=18079

Josh Stone <jistone at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|systemtap at sourceware dot org    |jistone at redhat dot com

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

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

end of thread, other threads:[~2016-06-24 17:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-03 22:11 [Bug translator/18079] New: autocast doesn't work with @defined jistone at redhat dot com
2015-03-03 22:25 ` [Bug translator/18079] " jistone at redhat dot com
2016-05-27 14:25 ` dsmith at redhat dot com
2016-05-27 17:24 ` jistone at redhat dot com
2016-06-22 15:48 ` fche at redhat dot com
2016-06-24 17:43 ` jistone 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).