public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/29984]  New: [Regression 4.2]: ppc 8540 g++ segfaults on valid C++ code.
@ 2006-11-26  6:53 raj dot khem at gmail dot com
  2006-11-26  7:24 ` [Bug target/29984] SPE GCC segfaults with some " pinskia at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: raj dot khem at gmail dot com @ 2006-11-26  6:53 UTC (permalink / raw)
  To: gcc-bugs

The following example is a reduced testcase from icewm. GCC when configured for
ppc-*-linux-gnuspe segfaults.

To reproduce the ICE compile like below 

g++ -c -O2 testcase.C

this works fine on gcc configured with powerpc-*-linux

testcase.C
============================================

class YRect {
public:
    YRect(int x, int y, int w, int h)
        :xx(x), yy(y), ww(w), hh(h)
    { }
    int x() const { return xx; }
    int y() const { return yy; }
    int width() const { return ww; }
    int height() const { return hh; }
private:
    int xx, yy, ww, hh;
};

void setGeometry(const YRect &r);
void resize(int xiscreen) {
    int dx, dy, dw, dh;
    int aWidth =
        (int) dw * 1/3;
    int tWidth=0;
    int w = aWidth;
    int h;
    if (h) {
        if (w >= 0)
            w = 0;
        int step;
        int maxHeight;
        if (h > maxHeight)
            h= maxHeight;
    } else{
        int iWidth;
        if (iWidth > aWidth)
            aWidth = iWidth;
        if (iWidth) {
            if (aWidth > w)
                w = aWidth;
        }
        if (h/*quickSwitchAllIcons*/)
            h += 1;
    }
    setGeometry(YRect(dx + ((dw - w) >> 1),
                      dy + ((dh - h) >> 1),
                      w, h));
}
====================================================


-- 
           Summary: [Regression 4.2]: ppc 8540 g++ segfaults on valid C++
                    code.
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: raj dot khem at gmail dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: powerpc-*-linux-gnuspe


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


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

* [Bug target/29984] SPE GCC segfaults with some C++ code
  2006-11-26  6:53 [Bug target/29984] New: [Regression 4.2]: ppc 8540 g++ segfaults on valid C++ code raj dot khem at gmail dot com
@ 2006-11-26  7:24 ` pinskia at gcc dot gnu dot org
  2006-11-26  7:43 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-11-26  7:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-11-26 07:23 -------
This works for me on the mainline.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|3.4.6                       |4.3.0


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


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

* [Bug target/29984] SPE GCC segfaults with some C++ code
  2006-11-26  6:53 [Bug target/29984] New: [Regression 4.2]: ppc 8540 g++ segfaults on valid C++ code raj dot khem at gmail dot com
  2006-11-26  7:24 ` [Bug target/29984] SPE GCC segfaults with some " pinskia at gcc dot gnu dot org
@ 2006-11-26  7:43 ` pinskia at gcc dot gnu dot org
  2006-11-26  7:59 ` [Bug target/29984] SPE GCC segfaults with MAX_EXPR <a, a> pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-11-26  7:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-11-26 07:43 -------
I get the following ICE on the 4.2 branch:
t.cc:15: internal compiler error: in rs6000_emit_minmax, at
config/rs6000/rs6000.c:12088


-- 


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


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

* [Bug target/29984] SPE GCC segfaults with MAX_EXPR <a, a>
  2006-11-26  6:53 [Bug target/29984] New: [Regression 4.2]: ppc 8540 g++ segfaults on valid C++ code raj dot khem at gmail dot com
  2006-11-26  7:24 ` [Bug target/29984] SPE GCC segfaults with some " pinskia at gcc dot gnu dot org
  2006-11-26  7:43 ` pinskia at gcc dot gnu dot org
@ 2006-11-26  7:59 ` pinskia at gcc dot gnu dot org
  2006-11-26  8:06 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-11-26  7:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2006-11-26 07:58 -------
MAX_EXPR <aWidthD.2267, aWidthD.2267>

:)


Reassiocation produces:
  aWidth_29 = MAX_EXPR <aWidth_7, aWidth_7>;
  w_30 = MAX_EXPR <aWidth_29, iWidth_14>;

From:
  aWidth_29 = MAX_EXPR <iWidth_14, aWidth_7>;
  w_30 = MAX_EXPR <aWidth_7, aWidth_29>;

The testcase you provided is undefined which is why it no longer ICEs in 4.3.0.

Here is a testcase that ICEs in 4.3.0:
void setGeometry(int w, int h);
void resize(int h, int dx, int dy, int dw, int dh, int maxHeight, int iWidth)
{
    int aWidth = (int) dw * 1/3;
    int w = aWidth;
    if (h) {
        if (w >= 0)
            w = 0;
        if (h > maxHeight)
            h= maxHeight;
    } else
    {
        if (iWidth > aWidth)
            aWidth = iWidth;
        if (iWidth) {
            if (aWidth > w)
                w = aWidth;
        }
        if (h)
          h += 1;
    }
    setGeometry(w, h);
}


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
      Known to work|4.3.0                       |
   Last reconfirmed|0000-00-00 00:00:00         |2006-11-26 07:58:50
               date|                            |
            Summary|SPE GCC segfaults with some |SPE GCC segfaults with
                   |C++ code                    |MAX_EXPR <a, a>


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


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

* [Bug target/29984] SPE GCC segfaults with MAX_EXPR <a, a>
  2006-11-26  6:53 [Bug target/29984] New: [Regression 4.2]: ppc 8540 g++ segfaults on valid C++ code raj dot khem at gmail dot com
                   ` (2 preceding siblings ...)
  2006-11-26  7:59 ` [Bug target/29984] SPE GCC segfaults with MAX_EXPR <a, a> pinskia at gcc dot gnu dot org
@ 2006-11-26  8:06 ` pinskia at gcc dot gnu dot org
  2006-11-26 19:52 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-11-26  8:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2006-11-26 08:05 -------
Here is a short testcase:
int f(int a, int b)
{
  int i;
  int c = a>=b?a:b;
  for(i = 0;i<1000;i++) ;  // Needed otherwise Jump threading gets in the way
  int d = c>=a?c:a;
  return d;
}


-- 


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


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

* [Bug target/29984] SPE GCC segfaults with MAX_EXPR <a, a>
  2006-11-26  6:53 [Bug target/29984] New: [Regression 4.2]: ppc 8540 g++ segfaults on valid C++ code raj dot khem at gmail dot com
                   ` (3 preceding siblings ...)
  2006-11-26  8:06 ` pinskia at gcc dot gnu dot org
@ 2006-11-26 19:52 ` pinskia at gcc dot gnu dot org
  2006-11-26 20:03 ` [Bug tree-optimization/29984] " pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-11-26 19:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2006-11-26 19:51 -------
I have a fix by not never producing MAX_EXPR<a,a> or MIN_EXPR<a,a> in reassoc.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pinskia at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
           Keywords|                            |ice-on-valid-code


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


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

* [Bug tree-optimization/29984] SPE GCC segfaults with MAX_EXPR <a, a>
  2006-11-26  6:53 [Bug target/29984] New: [Regression 4.2]: ppc 8540 g++ segfaults on valid C++ code raj dot khem at gmail dot com
                   ` (4 preceding siblings ...)
  2006-11-26 19:52 ` pinskia at gcc dot gnu dot org
@ 2006-11-26 20:03 ` pinskia at gcc dot gnu dot org
  2006-11-28  5:07 ` [Bug tree-optimization/29984] [4.2/4.3 Regression] " pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-11-26 20:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2006-11-26 20:03 -------
Here is the patch which I am testing:
Index: tree-ssa-reassoc.c
===================================================================
--- tree-ssa-reassoc.c  (revision 119229)
+++ tree-ssa-reassoc.c  (working copy)
@@ -417,8 +417,8 @@ eliminate_duplicate_pair (enum tree_code
                          operand_entry_t last)
 {

-  /* If we have two of the same op, and the opcode is & or |, we can
-     eliminate one of them.
+  /* If we have two of the same op, and the opcode is & |, min, or max,
+     we can eliminate one of them.
      If we have two of the same op, and the opcode is ^, we can
      eliminate both of them.  */

@@ -426,13 +426,15 @@ eliminate_duplicate_pair (enum tree_code
     {
       switch (opcode)
        {
+       case MAX_EXPR:
+       case MIN_EXPR:
        case BIT_IOR_EXPR:
        case BIT_AND_EXPR:
          if (dump_file && (dump_flags & TDF_DETAILS))
            {
              fprintf (dump_file, "Equivalence: ");
              print_generic_expr (dump_file, curr->op, 0);
-             fprintf (dump_file, " [&|] ");
+             fprintf (dump_file, " [&|minmax] ");
              print_generic_expr (dump_file, last->op, 0);
              fprintf (dump_file, " -> ");
              print_generic_stmt (dump_file, last->op, 0);


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|target                      |tree-optimization


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


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

* [Bug tree-optimization/29984] [4.2/4.3 Regression] SPE GCC segfaults with MAX_EXPR <a, a>
  2006-11-26  6:53 [Bug target/29984] New: [Regression 4.2]: ppc 8540 g++ segfaults on valid C++ code raj dot khem at gmail dot com
                   ` (5 preceding siblings ...)
  2006-11-26 20:03 ` [Bug tree-optimization/29984] " pinskia at gcc dot gnu dot org
@ 2006-11-28  5:07 ` pinskia at gcc dot gnu dot org
  2006-11-29  7:23 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-11-28  5:07 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
            Summary|SPE GCC segfaults with      |[4.2/4.3 Regression] SPE GCC
                   |MAX_EXPR <a, a>             |segfaults with MAX_EXPR <a,
                   |                            |a>
   Target Milestone|---                         |4.2.0


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


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

* [Bug tree-optimization/29984] [4.2/4.3 Regression] SPE GCC segfaults with MAX_EXPR <a, a>
  2006-11-26  6:53 [Bug target/29984] New: [Regression 4.2]: ppc 8540 g++ segfaults on valid C++ code raj dot khem at gmail dot com
                   ` (6 preceding siblings ...)
  2006-11-28  5:07 ` [Bug tree-optimization/29984] [4.2/4.3 Regression] " pinskia at gcc dot gnu dot org
@ 2006-11-29  7:23 ` pinskia at gcc dot gnu dot org
  2006-12-02 17:09 ` [Bug tree-optimization/29984] [4.2 " pinskia at gcc dot gnu dot org
  2006-12-02 17:09 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-11-29  7:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pinskia at gcc dot gnu dot org  2006-11-29 07:23 -------
Subject: Bug 29984

Author: pinskia
Date: Wed Nov 29 07:23:11 2006
New Revision: 119303

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=119303
Log:
2006-11-28  Andrew Pinski  <pinskia@gmail.com>

        PR tree-opt/29984
        * gcc.dg/tree-ssa/reassoc-12.c: New test.

2006-11-28  Andrew Pinski  <pinskia@gmail.com>

        PR tree-opt/29984
        * tree-ssa-reassoc.c (eliminate_duplicate_pair): Handle MAX_EXPR
        and MIN_EXRP.



Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/reassoc-12.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-reassoc.c


-- 


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


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

* [Bug tree-optimization/29984] [4.2 Regression] SPE GCC segfaults with MAX_EXPR <a, a>
  2006-11-26  6:53 [Bug target/29984] New: [Regression 4.2]: ppc 8540 g++ segfaults on valid C++ code raj dot khem at gmail dot com
                   ` (8 preceding siblings ...)
  2006-12-02 17:09 ` [Bug tree-optimization/29984] [4.2 " pinskia at gcc dot gnu dot org
@ 2006-12-02 17:09 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-12-02 17:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pinskia at gcc dot gnu dot org  2006-12-02 17:09 -------
Subject: Bug 29984

Author: pinskia
Date: Sat Dec  2 17:09:33 2006
New Revision: 119451

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=119451
Log:
2006-11-28  Andrew Pinski  <pinskia@gmail.com>

        PR tree-opt/29984
        * tree-ssa-reassoc.c (eliminate_duplicate_pair): Handle MAX_EXPR
        and MIN_EXRP.

2006-12-02  Andrew Pinski  <pinskia@gmail.com>

        PR tree-opt/29984
        * gcc.dg/tree-ssa/reassoc-12.c: New test.



Added:
    branches/gcc-4_2-branch/gcc/testsuite/gcc.dg/tree-ssa/reassoc-12.c
      - copied unchanged from r119303,
trunk/gcc/testsuite/gcc.dg/tree-ssa/reassoc-12.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-reassoc.c


-- 


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


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

* [Bug tree-optimization/29984] [4.2 Regression] SPE GCC segfaults with MAX_EXPR <a, a>
  2006-11-26  6:53 [Bug target/29984] New: [Regression 4.2]: ppc 8540 g++ segfaults on valid C++ code raj dot khem at gmail dot com
                   ` (7 preceding siblings ...)
  2006-11-29  7:23 ` pinskia at gcc dot gnu dot org
@ 2006-12-02 17:09 ` pinskia at gcc dot gnu dot org
  2006-12-02 17:09 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-12-02 17:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pinskia at gcc dot gnu dot org  2006-12-02 17:09 -------
Fixed.


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2006-12-02 17:09 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-26  6:53 [Bug target/29984] New: [Regression 4.2]: ppc 8540 g++ segfaults on valid C++ code raj dot khem at gmail dot com
2006-11-26  7:24 ` [Bug target/29984] SPE GCC segfaults with some " pinskia at gcc dot gnu dot org
2006-11-26  7:43 ` pinskia at gcc dot gnu dot org
2006-11-26  7:59 ` [Bug target/29984] SPE GCC segfaults with MAX_EXPR <a, a> pinskia at gcc dot gnu dot org
2006-11-26  8:06 ` pinskia at gcc dot gnu dot org
2006-11-26 19:52 ` pinskia at gcc dot gnu dot org
2006-11-26 20:03 ` [Bug tree-optimization/29984] " pinskia at gcc dot gnu dot org
2006-11-28  5:07 ` [Bug tree-optimization/29984] [4.2/4.3 Regression] " pinskia at gcc dot gnu dot org
2006-11-29  7:23 ` pinskia at gcc dot gnu dot org
2006-12-02 17:09 ` [Bug tree-optimization/29984] [4.2 " pinskia at gcc dot gnu dot org
2006-12-02 17:09 ` 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).