public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/52693] New: Wrong code with SRA and arrays
@ 2012-03-23 20:51 pinskia at gcc dot gnu.org
  2012-03-23 20:56 ` [Bug middle-end/52693] " pinskia at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-03-23 20:51 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52693
           Summary: Wrong code with SRA and arrays
    Classification: Unclassified
           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


With the attach testcase, SRA does the following replacement which seems wrong:
  value = stack.l[D.4470_102];
With
  value_77 = MEM[(struct exprList_s *)&stack];
  value$u_620 = MEM[(struct exprList_s *)&stack].u;

At -O1.


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

* [Bug middle-end/52693] Wrong code with SRA and arrays
  2012-03-23 20:51 [Bug middle-end/52693] New: Wrong code with SRA and arrays pinskia at gcc dot gnu.org
@ 2012-03-23 20:56 ` pinskia at gcc dot gnu.org
  2012-03-23 21:18 ` pinskia at gcc dot gnu.org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-03-23 20:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-03-23 20:51:40 UTC ---
Created attachment 26970
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26970
Testcase


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

* [Bug middle-end/52693] Wrong code with SRA and arrays
  2012-03-23 20:51 [Bug middle-end/52693] New: Wrong code with SRA and arrays pinskia at gcc dot gnu.org
  2012-03-23 20:56 ` [Bug middle-end/52693] " pinskia at gcc dot gnu.org
@ 2012-03-23 21:18 ` pinskia at gcc dot gnu.org
  2012-03-23 22:46 ` jamborm at gcc dot gnu.org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-03-23 21:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-03-23 20:55:42 UTC ---
The correct output should be 120 which is what happens at -O0.


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

* [Bug middle-end/52693] Wrong code with SRA and arrays
  2012-03-23 20:51 [Bug middle-end/52693] New: Wrong code with SRA and arrays pinskia at gcc dot gnu.org
  2012-03-23 20:56 ` [Bug middle-end/52693] " pinskia at gcc dot gnu.org
  2012-03-23 21:18 ` pinskia at gcc dot gnu.org
@ 2012-03-23 22:46 ` jamborm at gcc dot gnu.org
  2012-03-23 22:49 ` jamborm at gcc dot gnu.org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jamborm at gcc dot gnu.org @ 2012-03-23 22:46 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Jambor <jamborm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|mjambor at suse dot cz      |jamborm at gcc dot gnu.org

--- Comment #3 from Martin Jambor <jamborm at gcc dot gnu.org> 2012-03-23 22:30:08 UTC ---
(In reply to comment #0)
> With the attach testcase, SRA does the following replacement which seems wrong:
>   value = stack.l[D.4470_102];
> With
>   value_77 = MEM[(struct exprList_s *)&stack];
>   value$u_620 = MEM[(struct exprList_s *)&stack].u;
> 

It is confusing but I do not think it is wrong.  When you disable the
special handling of enumeral types in analyze_access_subtree, you get
(in this case IMHO equivalent):

  value$type_621 = MEM[(struct exprList_s *)&stack].type;
  value$u_622 = MEM[(struct exprList_s *)&stack].u;

which is exactly what we'd expect when breaking value into the two
components it consists of.  And the testcase still fails.

It is equivalent because the first MEM_REF is of type unsigned int,
whereas the second one loads the whole structure and then there's a
COMPONENT_REF to load only the second integer from it.


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

* [Bug middle-end/52693] Wrong code with SRA and arrays
  2012-03-23 20:51 [Bug middle-end/52693] New: Wrong code with SRA and arrays pinskia at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2012-03-23 22:46 ` jamborm at gcc dot gnu.org
@ 2012-03-23 22:49 ` jamborm at gcc dot gnu.org
  2012-03-23 23:05 ` pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jamborm at gcc dot gnu.org @ 2012-03-23 22:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Martin Jambor <jamborm at gcc dot gnu.org> 2012-03-23 22:45:47 UTC ---
OTOH, I can confirm that the problematic variable is value, just not
SRAing that one makes the testcase to return 120.  (In the same
function, SRA creates replacements also for stack and fifo variables
and that thus seems fine.)


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

* [Bug middle-end/52693] Wrong code with SRA and arrays
  2012-03-23 20:51 [Bug middle-end/52693] New: Wrong code with SRA and arrays pinskia at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2012-03-23 22:49 ` jamborm at gcc dot gnu.org
@ 2012-03-23 23:05 ` pinskia at gcc dot gnu.org
  2012-03-24  0:52 ` jamborm at gcc dot gnu.org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-03-23 23:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-03-23 23:00:47 UTC ---
Wait a minute,
  value = stack.l[D.4470_102];
With
  value_77 = MEM[(struct exprList_s *)&stack];
  value$u_620 = MEM[(struct exprList_s *)&stack].u;

Where is D.4470_102 being taken into account?  I don't see it in the dumps.


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

* [Bug middle-end/52693] Wrong code with SRA and arrays
  2012-03-23 20:51 [Bug middle-end/52693] New: Wrong code with SRA and arrays pinskia at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2012-03-23 23:05 ` pinskia at gcc dot gnu.org
@ 2012-03-24  0:52 ` jamborm at gcc dot gnu.org
  2012-03-24  3:10 ` jamborm at gcc dot gnu.org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jamborm at gcc dot gnu.org @ 2012-03-24  0:52 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Jambor <jamborm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2012-03-24
         AssignedTo|unassigned at gcc dot       |jamborm at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1

--- Comment #6 from Martin Jambor <jamborm at gcc dot gnu.org> 2012-03-24 00:50:09 UTC ---
Right, sorry, the square brackets of MEM_REF made me feel the array
reference was still there even though it actually disappears.  When I
realized that, analyzing the issue was actually easy.


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

* [Bug middle-end/52693] Wrong code with SRA and arrays
  2012-03-23 20:51 [Bug middle-end/52693] New: Wrong code with SRA and arrays pinskia at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2012-03-24  0:52 ` jamborm at gcc dot gnu.org
@ 2012-03-24  3:10 ` jamborm at gcc dot gnu.org
  2012-03-27 18:40 ` jamborm at gcc dot gnu.org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jamborm at gcc dot gnu.org @ 2012-03-24  3:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Martin Jambor <jamborm at gcc dot gnu.org> 2012-03-24 00:51:38 UTC ---
Created attachment 26971
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26971
Proposed untested fix

I'm currently bootstrapping and testing this patch.


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

* [Bug middle-end/52693] Wrong code with SRA and arrays
  2012-03-23 20:51 [Bug middle-end/52693] New: Wrong code with SRA and arrays pinskia at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2012-03-24  3:10 ` jamborm at gcc dot gnu.org
@ 2012-03-27 18:40 ` jamborm at gcc dot gnu.org
  2012-03-28 15:25 ` jamborm at gcc dot gnu.org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jamborm at gcc dot gnu.org @ 2012-03-27 18:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Martin Jambor <jamborm at gcc dot gnu.org> 2012-03-27 18:22:44 UTC ---
Author: jamborm
Date: Tue Mar 27 18:22:39 2012
New Revision: 185891

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185891
Log:
2012-03-27  Martin Jambor  <mjambor@suse.cz>

    PR middle-end/52693
    * tree-sra.c (sra_modify_assign): Do not call
    load_assign_lhs_subreplacements when working with an unscalarizable
    region.

    * testsuite/gcc.dg/torture/pr52693.c: New test.


Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr52693.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-sra.c


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

* [Bug middle-end/52693] Wrong code with SRA and arrays
  2012-03-23 20:51 [Bug middle-end/52693] New: Wrong code with SRA and arrays pinskia at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2012-03-27 18:40 ` jamborm at gcc dot gnu.org
@ 2012-03-28 15:25 ` jamborm at gcc dot gnu.org
  2012-03-28 18:21 ` jamborm at gcc dot gnu.org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jamborm at gcc dot gnu.org @ 2012-03-28 15:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Martin Jambor <jamborm at gcc dot gnu.org> 2012-03-28 15:04:53 UTC ---
Author: jamborm
Date: Wed Mar 28 15:04:45 2012
New Revision: 185920

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185920
Log:
2012-03-28  Martin Jambor  <mjambor@suse.cz>

    PR middle-end/52693
    * tree-sra.c (sra_modify_assign): Do not call
    load_assign_lhs_subreplacements when working with an unscalarizable
    region.

    * testsuite/gcc.dg/torture/pr52693.c: New test.


Added:
    branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/torture/pr52693.c
Modified:
    branches/gcc-4_7-branch/gcc/ChangeLog
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_7-branch/gcc/tree-sra.c


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

* [Bug middle-end/52693] Wrong code with SRA and arrays
  2012-03-23 20:51 [Bug middle-end/52693] New: Wrong code with SRA and arrays pinskia at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2012-03-28 15:25 ` jamborm at gcc dot gnu.org
@ 2012-03-28 18:21 ` jamborm at gcc dot gnu.org
  2012-03-28 18:23 ` jamborm at gcc dot gnu.org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jamborm at gcc dot gnu.org @ 2012-03-28 18:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Martin Jambor <jamborm at gcc dot gnu.org> 2012-03-28 18:03:34 UTC ---
Author: jamborm
Date: Wed Mar 28 18:03:28 2012
New Revision: 185921

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185921
Log:
2012-03-28  Martin Jambor  <mjambor@suse.cz>

    PR middle-end/52693
    * tree-sra.c (sra_modify_assign): Do not call
    load_assign_lhs_subreplacements when working with an unscalarizable
    region.

    * testsuite/gcc.dg/torture/pr52693.c: New test.


Added:
    branches/gcc-4_6-branch/gcc/testsuite/gcc.dg/torture/pr52693.c
Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_6-branch/gcc/tree-sra.c


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

* [Bug middle-end/52693] Wrong code with SRA and arrays
  2012-03-23 20:51 [Bug middle-end/52693] New: Wrong code with SRA and arrays pinskia at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2012-03-28 18:21 ` jamborm at gcc dot gnu.org
@ 2012-03-28 18:23 ` jamborm at gcc dot gnu.org
  2012-03-28 19:04 ` jamborm at gcc dot gnu.org
  2012-04-18 13:15 ` jamborm at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: jamborm at gcc dot gnu.org @ 2012-03-28 18:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Martin Jambor <jamborm at gcc dot gnu.org> 2012-03-28 18:20:28 UTC ---
Author: jamborm
Date: Wed Mar 28 18:20:20 2012
New Revision: 185923

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185923
Log:
2012-03-28  Martin Jambor  <mjambor@suse.cz>

    PR middle-end/52693
    * tree-sra.c (sra_modify_assign): Do not call
    load_assign_lhs_subreplacements when working with an unscalarizable
    region.

    * testsuite/gcc.dg/torture/pr52693.c: New test.


Added:
    branches/gcc-4_5-branch/gcc/testsuite/gcc.dg/torture/pr52693.c
Modified:
    branches/gcc-4_5-branch/gcc/ChangeLog
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_5-branch/gcc/tree-sra.c


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

* [Bug middle-end/52693] Wrong code with SRA and arrays
  2012-03-23 20:51 [Bug middle-end/52693] New: Wrong code with SRA and arrays pinskia at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2012-03-28 18:23 ` jamborm at gcc dot gnu.org
@ 2012-03-28 19:04 ` jamborm at gcc dot gnu.org
  2012-04-18 13:15 ` jamborm at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: jamborm at gcc dot gnu.org @ 2012-03-28 19:04 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Jambor <jamborm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-p
                   |                            |atches/2012-03/msg01708.htm
                   |                            |l

--- Comment #12 from Martin Jambor <jamborm at gcc dot gnu.org> 2012-03-28 18:22:49 UTC ---
Patch (http://gcc.gnu.org/ml/gcc-patches/2012-03/msg01708.html)
applied to all affected branches (4.5, 4.6 and 4.7) and trunk.
Thus, fixed.


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

* [Bug middle-end/52693] Wrong code with SRA and arrays
  2012-03-23 20:51 [Bug middle-end/52693] New: Wrong code with SRA and arrays pinskia at gcc dot gnu.org
                   ` (11 preceding siblings ...)
  2012-03-28 19:04 ` jamborm at gcc dot gnu.org
@ 2012-04-18 13:15 ` jamborm at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: jamborm at gcc dot gnu.org @ 2012-04-18 13:15 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Jambor <jamborm at gcc dot gnu.org> changed:

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

--- Comment #13 from Martin Jambor <jamborm at gcc dot gnu.org> 2012-04-18 13:13:44 UTC ---
Damn it, I said fixed.


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

end of thread, other threads:[~2012-04-18 13:15 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-23 20:51 [Bug middle-end/52693] New: Wrong code with SRA and arrays pinskia at gcc dot gnu.org
2012-03-23 20:56 ` [Bug middle-end/52693] " pinskia at gcc dot gnu.org
2012-03-23 21:18 ` pinskia at gcc dot gnu.org
2012-03-23 22:46 ` jamborm at gcc dot gnu.org
2012-03-23 22:49 ` jamborm at gcc dot gnu.org
2012-03-23 23:05 ` pinskia at gcc dot gnu.org
2012-03-24  0:52 ` jamborm at gcc dot gnu.org
2012-03-24  3:10 ` jamborm at gcc dot gnu.org
2012-03-27 18:40 ` jamborm at gcc dot gnu.org
2012-03-28 15:25 ` jamborm at gcc dot gnu.org
2012-03-28 18:21 ` jamborm at gcc dot gnu.org
2012-03-28 18:23 ` jamborm at gcc dot gnu.org
2012-03-28 19:04 ` jamborm at gcc dot gnu.org
2012-04-18 13:15 ` jamborm 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).