public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/49671] New: volatile goes missing after inlining
@ 2011-07-07 21:39 pinskia at gcc dot gnu.org
  2011-07-07 21:41 ` [Bug middle-end/49671] [4.6/4.7 Regression] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-07-07 21:39 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49671

           Summary: volatile goes missing after inlining
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: pinskia@gcc.gnu.org


Take:
volatile int t;
static inline int cvmx_atomic_get32(volatile int *ptr)
{
    return *ptr;
}
void f(void)
{
  while (!cvmx_atomic_get32(&t))
    ;
}

Nothing fancy but after inlining, we have:
  D.2699_5 = t;
Which is wrong as t is volatile


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

* [Bug middle-end/49671] [4.6/4.7 Regression] volatile goes missing after inlining
  2011-07-07 21:39 [Bug middle-end/49671] New: volatile goes missing after inlining pinskia at gcc dot gnu.org
@ 2011-07-07 21:41 ` pinskia at gcc dot gnu.org
  2011-07-07 22:49 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-07-07 21:41 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49671

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
      Known to work|                            |4.5.1
   Target Milestone|---                         |4.6.2
            Summary|volatile goes missing after |[4.6/4.7 Regression]
                   |inlining                    |volatile goes missing after
                   |                            |inlining
      Known to fail|                            |4.6.1, 4.7.0

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-07-07 21:41:35 UTC ---
It was broken since at least "GCC: (GNU) 4.6.0 20110210 (experimental) [trunk
revision 170025]"


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

* [Bug middle-end/49671] [4.6/4.7 Regression] volatile goes missing after inlining
  2011-07-07 21:39 [Bug middle-end/49671] New: volatile goes missing after inlining pinskia at gcc dot gnu.org
  2011-07-07 21:41 ` [Bug middle-end/49671] [4.6/4.7 Regression] " pinskia at gcc dot gnu.org
@ 2011-07-07 22:49 ` pinskia at gcc dot gnu.org
  2011-07-07 23:07 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-07-07 22:49 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49671

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2011.07.07 22:48:48
         AssignedTo|unassigned at gcc dot       |pinskia at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-07-07 22:48:48 UTC ---
Note the following is also broken:
int t;
static inline int cvmx_atomic_get32(int *ptr)
{
    return *(volatile int*)ptr;
}
void f(void)
{
  while (!cvmx_atomic_get32(&t))
    ;
}
--- CUT ----
But that is caused by IPA-SRA.
I have a fix for both issues.


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

* [Bug middle-end/49671] [4.6/4.7 Regression] volatile goes missing after inlining
  2011-07-07 21:39 [Bug middle-end/49671] New: volatile goes missing after inlining pinskia at gcc dot gnu.org
  2011-07-07 21:41 ` [Bug middle-end/49671] [4.6/4.7 Regression] " pinskia at gcc dot gnu.org
  2011-07-07 22:49 ` pinskia at gcc dot gnu.org
@ 2011-07-07 23:07 ` pinskia at gcc dot gnu.org
  2011-07-08 10:31 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-07-07 23:07 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49671

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-07-07 23:07:02 UTC ---
Created attachment 24708
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24708
Fix which I am going to test


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

* [Bug middle-end/49671] [4.6/4.7 Regression] volatile goes missing after inlining
  2011-07-07 21:39 [Bug middle-end/49671] New: volatile goes missing after inlining pinskia at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-07-07 23:07 ` pinskia at gcc dot gnu.org
@ 2011-07-08 10:31 ` rguenth at gcc dot gnu.org
  2011-07-26  5:29 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-07-08 10:31 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49671

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-07-08 10:30:32 UTC ---
Doesn't the outermost component also need TREE_THIS_VOLATILE?  So I suppose
sink the

  TREE_THIS_VOLATILE (*tp) = TREE_THIS_VOLATILE (old);

from the else branch as well.


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

* [Bug middle-end/49671] [4.6/4.7 Regression] volatile goes missing after inlining
  2011-07-07 21:39 [Bug middle-end/49671] New: volatile goes missing after inlining pinskia at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2011-07-08 10:31 ` rguenth at gcc dot gnu.org
@ 2011-07-26  5:29 ` pinskia at gcc dot gnu.org
  2011-07-26  7:52 ` pinskia at gcc dot gnu.org
  2011-07-26  7:53 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-07-26  5:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49671

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-07-26 05:28:50 UTC ---
Author: pinskia
Date: Tue Jul 26 05:28:45 2011
New Revision: 176782

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=176782
Log:
2011-07-25  Andrew Pinski  <apinski@cavium.com>

    PR tree-opt/49671
    * tree-inline.c (remap_gimple_op_r): Copy TREE_THIS_VOLATILE and
    TREE_THIS_NOTRAP into the inner most MEM_REF.
    Always copy TREE_THIS_VOLATILE.
    * tree-sra.c (ptr_parm_has_direct_uses): Check that the lhs, rhs and
    arguments are not volatile references.

2011-07-25  Andrew Pinski  <apinski@cavium.com>

    PR tree-opt/49671
    * gcc.dg/tree-ssa/pr49671-1.c: New testcase.
    * gcc.dg/tree-ssa/pr49671-2.c: New testcase.


Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/pr49671-1.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/pr49671-2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-inline.c
    trunk/gcc/tree-sra.c


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

* [Bug middle-end/49671] [4.6/4.7 Regression] volatile goes missing after inlining
  2011-07-07 21:39 [Bug middle-end/49671] New: volatile goes missing after inlining pinskia at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2011-07-26  5:29 ` pinskia at gcc dot gnu.org
@ 2011-07-26  7:52 ` pinskia at gcc dot gnu.org
  2011-07-26  7:53 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-07-26  7:52 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49671

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-07-26 07:52:27 UTC ---
Author: pinskia
Date: Tue Jul 26 07:52:24 2011
New Revision: 176785

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=176785
Log:
2011-07-25  Andrew Pinski  <apinski@cavium.com>

    PR tree-opt/49671
    * tree-inline.c (remap_gimple_op_r): Copy TREE_THIS_VOLATILE and
    TREE_THIS_NOTRAP into the inner most MEM_REF.
    Always copy TREE_THIS_VOLATILE.
    * tree-sra.c (ptr_parm_has_direct_uses): Check that the lhs, rhs and
    arguments are not volatile references.

2011-07-25  Andrew Pinski  <apinski@cavium.com>

    PR tree-opt/49671
    * gcc.dg/tree-ssa/pr49671-1.c: New testcase.
    * gcc.dg/tree-ssa/pr49671-2.c: New testcase.


Added:
    branches/gcc-4_6-branch/gcc/testsuite/gcc.dg/tree-ssa/pr49671-1.c
      - copied unchanged from r176782,
trunk/gcc/testsuite/gcc.dg/tree-ssa/pr49671-1.c
    branches/gcc-4_6-branch/gcc/testsuite/gcc.dg/tree-ssa/pr49671-2.c
      - copied unchanged from r176782,
trunk/gcc/testsuite/gcc.dg/tree-ssa/pr49671-2.c
Modified:
    branches/gcc-4_6-branch/   (props changed)
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/config/rs6000/rs6000.c   (props changed)
    branches/gcc-4_6-branch/gcc/config/rs6000/rs6000.h   (props changed)
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_6-branch/gcc/tree-inline.c
    branches/gcc-4_6-branch/gcc/tree-sra.c

Propchange: branches/gcc-4_6-branch/
            ('svn:mergeinfo' modified)

Propchange: branches/gcc-4_6-branch/gcc/config/rs6000/rs6000.c
            ('svn:mergeinfo' modified)

Propchange: branches/gcc-4_6-branch/gcc/config/rs6000/rs6000.h
            ('svn:mergeinfo' modified)


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

* [Bug middle-end/49671] [4.6/4.7 Regression] volatile goes missing after inlining
  2011-07-07 21:39 [Bug middle-end/49671] New: volatile goes missing after inlining pinskia at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2011-07-26  7:52 ` pinskia at gcc dot gnu.org
@ 2011-07-26  7:53 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-07-26  7:53 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49671

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

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

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-07-26 07:53:25 UTC ---
Fixed.


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

end of thread, other threads:[~2011-07-26  7:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-07 21:39 [Bug middle-end/49671] New: volatile goes missing after inlining pinskia at gcc dot gnu.org
2011-07-07 21:41 ` [Bug middle-end/49671] [4.6/4.7 Regression] " pinskia at gcc dot gnu.org
2011-07-07 22:49 ` pinskia at gcc dot gnu.org
2011-07-07 23:07 ` pinskia at gcc dot gnu.org
2011-07-08 10:31 ` rguenth at gcc dot gnu.org
2011-07-26  5:29 ` pinskia at gcc dot gnu.org
2011-07-26  7:52 ` pinskia at gcc dot gnu.org
2011-07-26  7:53 ` pinskia 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).