public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug jit/66700] New: Bogus gimplification of jit code using ptrs to functions
@ 2015-06-30  1:40 dmalcolm at gcc dot gnu.org
  2015-06-30  1:43 ` [Bug jit/66700] " dmalcolm at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-06-30  1:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66700

            Bug ID: 66700
           Summary: Bogus gimplification of jit code using ptrs to
                    functions
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: jit
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: dmalcolm at gcc dot gnu.org
            Blocks: 66627
  Target Milestone: ---

https://gcc.gnu.org/ml/jit/2015-q2/msg00131.html noted a problem where a ptr to
a local was being passed as an argument in a function call built using
libgccjit, where the function was a prebuilt one that writes back through the
ptr to the local, but where the local wasn't changing.

The issue seems to be that during gimplification, the argument changes from
  &local
to:
  &local.0

and then "local" gets used later on in the caller, not "local.0".


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66627
[Bug 66627] Tracker bug for jit bugs affecting ravi


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

* [Bug jit/66700] Bogus gimplification of jit code using ptrs to functions
  2015-06-30  1:40 [Bug jit/66700] New: Bogus gimplification of jit code using ptrs to functions dmalcolm at gcc dot gnu.org
@ 2015-06-30  1:43 ` dmalcolm at gcc dot gnu.org
  2015-06-30  1:50 ` dmalcolm at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-06-30  1:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66700

--- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Created attachment 35875
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35875&action=edit
Minimal reproducer

This gimplifies to:

test_caller_of_write_back_through_ptr ()
{
  <float:64> d.0;
  <float:64> D.59;
  <float:64> d;

  <D.57>:
  d = 4.0e+0;
  d.0 = d;
  write_back_through_ptr (&d.0);
  D.59 = d;
  return D.59;
}

where write_back_through_ptr modifies "d.0", but the return value uses "d",
hence the result is "4.0", rather than the expected value of "5.600000".


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

* [Bug jit/66700] Bogus gimplification of jit code using ptrs to functions
  2015-06-30  1:40 [Bug jit/66700] New: Bogus gimplification of jit code using ptrs to functions dmalcolm at gcc dot gnu.org
  2015-06-30  1:43 ` [Bug jit/66700] " dmalcolm at gcc dot gnu.org
@ 2015-06-30  1:50 ` dmalcolm at gcc dot gnu.org
  2015-06-30  2:13 ` dmalcolm at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-06-30  1:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66700

--- Comment #2 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Created attachment 35876
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35876&action=edit
Dump of initial GENERIC form of function


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

* [Bug jit/66700] Bogus gimplification of jit code using ptrs to functions
  2015-06-30  1:40 [Bug jit/66700] New: Bogus gimplification of jit code using ptrs to functions dmalcolm at gcc dot gnu.org
  2015-06-30  1:43 ` [Bug jit/66700] " dmalcolm at gcc dot gnu.org
  2015-06-30  1:50 ` dmalcolm at gcc dot gnu.org
@ 2015-06-30  2:13 ` dmalcolm at gcc dot gnu.org
  2015-06-30  2:16 ` dmalcolm at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-06-30  2:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66700

--- Comment #3 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Looks like we're not setting
  TREE_ADDRESSABLE (x) = 1
when taking the address of something.


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

* [Bug jit/66700] Bogus gimplification of jit code using ptrs to functions
  2015-06-30  1:40 [Bug jit/66700] New: Bogus gimplification of jit code using ptrs to functions dmalcolm at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2015-06-30  2:13 ` dmalcolm at gcc dot gnu.org
@ 2015-06-30  2:16 ` dmalcolm at gcc dot gnu.org
  2015-07-01 12:51 ` dmalcolm at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-06-30  2:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66700

--- Comment #4 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Created attachment 35877
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35877&action=edit
Crude patch that fixes the testcase


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

* [Bug jit/66700] Bogus gimplification of jit code using ptrs to functions
  2015-06-30  1:40 [Bug jit/66700] New: Bogus gimplification of jit code using ptrs to functions dmalcolm at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2015-06-30  2:16 ` dmalcolm at gcc dot gnu.org
@ 2015-07-01 12:51 ` dmalcolm at gcc dot gnu.org
  2015-07-01 14:49 ` dmalcolm at gcc dot gnu.org
  2015-07-01 15:10 ` dmalcolm at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-07-01 12:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66700

--- Comment #5 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Author: dmalcolm
Date: Wed Jul  1 12:50:50 2015
New Revision: 225248

URL: https://gcc.gnu.org/viewcvs?rev=225248&root=gcc&view=rev
Log:
PR jit/66700: set TREE_ADDRESSABLE when building an ADDR_EXPR

gcc/jit/ChangeLog:
        PR jit/66700
        * jit-playback.c (jit_mark_addressable): New function.
        (gcc::jit::playback::lvalue::get_address): Call
        jit_mark_addressable on the underlying tree.

gcc/testsuite/ChangeLog:
        PR jit/66700
        * jit.dg/all-non-failing-tests.h: Add
        test-pr66700-observing-write-through-ptr.c.
        * jit.dg/test-pr66700-observing-write-through-ptr.c: New testcase.


Added:
    trunk/gcc/testsuite/jit.dg/test-pr66700-observing-write-through-ptr.c
Modified:
    trunk/gcc/jit/ChangeLog
    trunk/gcc/jit/jit-playback.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/jit.dg/all-non-failing-tests.h


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

* [Bug jit/66700] Bogus gimplification of jit code using ptrs to functions
  2015-06-30  1:40 [Bug jit/66700] New: Bogus gimplification of jit code using ptrs to functions dmalcolm at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2015-07-01 12:51 ` dmalcolm at gcc dot gnu.org
@ 2015-07-01 14:49 ` dmalcolm at gcc dot gnu.org
  2015-07-01 15:10 ` dmalcolm at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-07-01 14:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66700

--- Comment #6 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Author: dmalcolm
Date: Wed Jul  1 14:48:55 2015
New Revision: 225258

URL: https://gcc.gnu.org/viewcvs?rev=225258&root=gcc&view=rev
Log:
PR jit/66700: set TREE_ADDRESSABLE when building an ADDR_EXPR

Backport of r225248 (f410e1f5b44007c6cf6609df0afc16e7dcfeabd2)
from trunk

gcc/jit/ChangeLog:
        Backport from mainline r225248
        2015-07-01  David Malcolm  <dmalcolm@redhat.com>

        PR jit/66700
        * jit-playback.c (jit_mark_addressable): New function.
        (gcc::jit::playback::lvalue::get_address): Call
        jit_mark_addressable on the underlying tree.

gcc/testsuite/ChangeLog:
        Backport from mainline r225248
        2015-07-01  David Malcolm  <dmalcolm@redhat.com>

        PR jit/66700
        * jit.dg/all-non-failing-tests.h: Add
        test-pr66700-observing-write-through-ptr.c.
        * jit.dg/test-pr66700-observing-write-through-ptr.c: New testcase.

Added:
   
branches/gcc-5-branch/gcc/testsuite/jit.dg/test-pr66700-observing-write-through-ptr.c
Modified:
    branches/gcc-5-branch/gcc/jit/ChangeLog
    branches/gcc-5-branch/gcc/jit/jit-playback.c
    branches/gcc-5-branch/gcc/testsuite/ChangeLog
    branches/gcc-5-branch/gcc/testsuite/jit.dg/all-non-failing-tests.h


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

* [Bug jit/66700] Bogus gimplification of jit code using ptrs to functions
  2015-06-30  1:40 [Bug jit/66700] New: Bogus gimplification of jit code using ptrs to functions dmalcolm at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2015-07-01 14:49 ` dmalcolm at gcc dot gnu.org
@ 2015-07-01 15:10 ` dmalcolm at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-07-01 15:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66700

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Fixed in trunk as r225248.
Fixed in gcc-5-branch (for gcc 5.2) as r225258.
Resolving as fixed.


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

end of thread, other threads:[~2015-07-01 15:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-30  1:40 [Bug jit/66700] New: Bogus gimplification of jit code using ptrs to functions dmalcolm at gcc dot gnu.org
2015-06-30  1:43 ` [Bug jit/66700] " dmalcolm at gcc dot gnu.org
2015-06-30  1:50 ` dmalcolm at gcc dot gnu.org
2015-06-30  2:13 ` dmalcolm at gcc dot gnu.org
2015-06-30  2:16 ` dmalcolm at gcc dot gnu.org
2015-07-01 12:51 ` dmalcolm at gcc dot gnu.org
2015-07-01 14:49 ` dmalcolm at gcc dot gnu.org
2015-07-01 15:10 ` dmalcolm at gcc dot gnu.org

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