public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/32353]  New: [4.1/4.2 Regression] Miscompilation with RESULT_DECL
@ 2007-06-15 12:23 jakub at gcc dot gnu dot org
  2007-06-15 14:48 ` [Bug tree-optimization/32353] " jakub at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-06-15 12:23 UTC (permalink / raw)
  To: gcc-bugs

extern "C" void abort ();

struct A
{
  int f;
  A (int x) : f (x) {}
};

A
foo (const A &x, const A &y)
{
  A r (0);
  r = x.f == -111 ? y : (y.f == -111 || x.f > y.f) ? x : y;
  A s (0);
  r = r.f == -111 ? s : (r.f > s.f) ? r : s;
  return r;
}

int
main ()
{
  A a (A(0));
  int b[] = { 1, 2, 9 };
  for (int i = 0; i < 3; i++)
    {
      A c (b[i]);
      if (foo (a, c).f != b[i])
        abort ();
      a = c;
    }
}

is miscompiled on i?86-linux with -O2 -m32.  From quick glance at the dumps,
dce3 removes a needed statement:
<retval>.fD.2005 = SR.23D.2103_26;
but already *.alias1 seems to be wrong:
  # BLOCK 11
  # PRED: 10 (true)
<L8>:;
  iftmp.3D.2049_27 = &<retval>;
  goto <bb 13> (<L10>);
  # SUCC: 13 (fallthru)

  # BLOCK 12
  # PRED: 10 (false)
<L9>:;
  iftmp.3D.2049_28 = &sD.2036;
  # SUCC: 13 (fallthru)

  # BLOCK 13
  # PRED: 11 (fallthru) 12 (fallthru)
  # iftmp.3D.2049_2 = PHI <iftmp.3D.2049_27(11), iftmp.3D.2049_28(12)>;
<L10>:;
  iftmp.2D.2047_29 = iftmp.3D.2049_2;
  goto <bb 15> (<L12>);
  # SUCC: 15 (fallthru)

  # BLOCK 14
  # PRED: 9 (false)
<L11>:;
  iftmp.2D.2047_30 = &sD.2036;
  # SUCC: 15 (fallthru)

  # BLOCK 15
  # PRED: 13 (fallthru) 14 (fallthru)
  # iftmp.2D.2047_1 = PHI <iftmp.2D.2047_29(13), iftmp.2D.2047_30(14)>;
<L12>:;
  #   D.2051_32 = V_MUST_DEF <D.2051_31>;
  #   VUSE <SFT.6D.2086_23>;
  D.2051 = *iftmp.2D.2047_1;

Note that iftmp.2D.2047_1 can be either &sD.2036 (in that case it really VUSEs
SFT.6D.2086_23), but it can also be &<retval> and that's not stored anywhere.


-- 
           Summary: [4.1/4.2 Regression] Miscompilation with RESULT_DECL
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org
GCC target triplet: i386-linux


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


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

* [Bug tree-optimization/32353] [4.1/4.2 Regression] Miscompilation with RESULT_DECL
  2007-06-15 12:23 [Bug tree-optimization/32353] New: [4.1/4.2 Regression] Miscompilation with RESULT_DECL jakub at gcc dot gnu dot org
@ 2007-06-15 14:48 ` jakub at gcc dot gnu dot org
  2007-06-18 11:27 ` rguenth at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-06-15 14:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jakub at gcc dot gnu dot org  2007-06-15 14:47 -------
--- gcc/tree-ssa-structalias.c.jj       2007-06-11 11:12:27.000000000 +0200
+++ gcc/tree-ssa-structalias.c  2007-06-15 16:40:29.000000000 +0200
@@ -4343,7 +4343,8 @@ set_uids_in_ptset (tree ptr, bitmap into
            bitmap_set_bit (into, DECL_UID (sv->var));
        }
       else if (TREE_CODE (vi->decl) == VAR_DECL
-              || TREE_CODE (vi->decl) == PARM_DECL)
+              || TREE_CODE (vi->decl) == PARM_DECL
+              || TREE_CODE (vi->decl) == RESULT_DECL)
        {
          if (var_can_have_subvars (vi->decl)
              && get_subvars_for_var (vi->decl))

seems to cure this, will try to bootstrap/regtest it now.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dberlin at gcc dot gnu dot
                   |                            |org


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


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

* [Bug tree-optimization/32353] [4.1/4.2 Regression] Miscompilation with RESULT_DECL
  2007-06-15 12:23 [Bug tree-optimization/32353] New: [4.1/4.2 Regression] Miscompilation with RESULT_DECL jakub at gcc dot gnu dot org
  2007-06-15 14:48 ` [Bug tree-optimization/32353] " jakub at gcc dot gnu dot org
@ 2007-06-18 11:27 ` rguenth at gcc dot gnu dot org
  2007-06-19  9:09 ` jakub at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-06-18 11:27 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-06-18 11:26:54
               date|                            |


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


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

* [Bug tree-optimization/32353] [4.1/4.2 Regression] Miscompilation with RESULT_DECL
  2007-06-15 12:23 [Bug tree-optimization/32353] New: [4.1/4.2 Regression] Miscompilation with RESULT_DECL jakub at gcc dot gnu dot org
  2007-06-15 14:48 ` [Bug tree-optimization/32353] " jakub at gcc dot gnu dot org
  2007-06-18 11:27 ` rguenth at gcc dot gnu dot org
@ 2007-06-19  9:09 ` jakub at gcc dot gnu dot org
  2007-06-19  9:11 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-06-19  9:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2007-06-19 09:08 -------
Subject: Bug 32353

Author: jakub
Date: Tue Jun 19 09:08:39 2007
New Revision: 125841

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=125841
Log:
        PR tree-optimization/32353
        * tree-ssa-structalias.c (set_uids_in_ptset): Also handle RESULT_DECL.

        * g++.dg/opt/nrv13.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/opt/nrv13.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-structalias.c


-- 


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


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

* [Bug tree-optimization/32353] [4.1/4.2 Regression] Miscompilation with RESULT_DECL
  2007-06-15 12:23 [Bug tree-optimization/32353] New: [4.1/4.2 Regression] Miscompilation with RESULT_DECL jakub at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-06-19  9:09 ` jakub at gcc dot gnu dot org
@ 2007-06-19  9:11 ` jakub at gcc dot gnu dot org
  2007-06-19  9:18 ` jakub at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-06-19  9:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2007-06-19 09:11 -------
Subject: Bug 32353

Author: jakub
Date: Tue Jun 19 09:11:22 2007
New Revision: 125842

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=125842
Log:
        PR tree-optimization/32353
        * tree-ssa-structalias.c (set_uids_in_ptset): Also handle RESULT_DECL.

        * g++.dg/opt/nrv13.C: New test.

Added:
    branches/gcc-4_2-branch/gcc/testsuite/g++.dg/opt/nrv13.C
Modified:
    branches/gcc-4_2-branch/gcc/ChangeLog
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_2-branch/gcc/tree-ssa-structalias.c


-- 


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


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

* [Bug tree-optimization/32353] [4.1/4.2 Regression] Miscompilation with RESULT_DECL
  2007-06-15 12:23 [Bug tree-optimization/32353] New: [4.1/4.2 Regression] Miscompilation with RESULT_DECL jakub at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-06-19  9:11 ` jakub at gcc dot gnu dot org
@ 2007-06-19  9:18 ` jakub at gcc dot gnu dot org
  2007-06-19  9:19 ` jakub at gcc dot gnu dot org
  2008-04-03  1:03 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-06-19  9:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jakub at gcc dot gnu dot org  2007-06-19 09:18 -------
Subject: Bug 32353

Author: jakub
Date: Tue Jun 19 09:18:13 2007
New Revision: 125843

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=125843
Log:
        PR tree-optimization/32353
        * tree-ssa-structalias.c (set_uids_in_ptset): Also handle RESULT_DECL.

        * g++.dg/opt/nrv13.C: New test.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/opt/nrv13.C
Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_1-branch/gcc/tree-ssa-structalias.c


-- 


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


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

* [Bug tree-optimization/32353] [4.1/4.2 Regression] Miscompilation with RESULT_DECL
  2007-06-15 12:23 [Bug tree-optimization/32353] New: [4.1/4.2 Regression] Miscompilation with RESULT_DECL jakub at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-06-19  9:18 ` jakub at gcc dot gnu dot org
@ 2007-06-19  9:19 ` jakub at gcc dot gnu dot org
  2008-04-03  1:03 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-06-19  9:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jakub at gcc dot gnu dot org  2007-06-19 09:19 -------
Fixed.


-- 

jakub at gcc dot gnu dot org changed:

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


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


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

* [Bug tree-optimization/32353] [4.1/4.2 Regression] Miscompilation with RESULT_DECL
  2007-06-15 12:23 [Bug tree-optimization/32353] New: [4.1/4.2 Regression] Miscompilation with RESULT_DECL jakub at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2007-06-19  9:19 ` jakub at gcc dot gnu dot org
@ 2008-04-03  1:03 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-04-03  1:03 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.1.3


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


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

end of thread, other threads:[~2008-04-03  1:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-15 12:23 [Bug tree-optimization/32353] New: [4.1/4.2 Regression] Miscompilation with RESULT_DECL jakub at gcc dot gnu dot org
2007-06-15 14:48 ` [Bug tree-optimization/32353] " jakub at gcc dot gnu dot org
2007-06-18 11:27 ` rguenth at gcc dot gnu dot org
2007-06-19  9:09 ` jakub at gcc dot gnu dot org
2007-06-19  9:11 ` jakub at gcc dot gnu dot org
2007-06-19  9:18 ` jakub at gcc dot gnu dot org
2007-06-19  9:19 ` jakub at gcc dot gnu dot org
2008-04-03  1:03 ` pinskia at gcc dot gnu dot 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).