public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/35429]  New: [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic
@ 2008-03-03 19:58 reichelt at gcc dot gnu dot org
  2008-03-03 19:58 ` [Bug tree-optimization/35429] " reichelt at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2008-03-03 19:58 UTC (permalink / raw)
  To: gcc-bugs

The following valid code snippet triggers an ICE since GCC 4.1.0 when compiled
with "-O":

====================================================
int foo(__complex__ int z0, __complex__ int z1)
{
  return z0 != 0 || z1 != 0;
}
====================================================

bug.c: In function 'foo':
bug.c:3: internal compiler error: in build_int_cst_wide, at tree.c:891
Please submit a full bug report, [etc.]


-- 
           Summary: [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code, monitored
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug tree-optimization/35429] [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic
  2008-03-03 19:58 [Bug tree-optimization/35429] New: [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic reichelt at gcc dot gnu dot org
@ 2008-03-03 19:58 ` reichelt at gcc dot gnu dot org
  2008-03-15  1:28 ` jsm28 at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2008-03-03 19:58 UTC (permalink / raw)
  To: gcc-bugs



-- 

reichelt at gcc dot gnu dot org changed:

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


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


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

* [Bug tree-optimization/35429] [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic
  2008-03-03 19:58 [Bug tree-optimization/35429] New: [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic reichelt at gcc dot gnu dot org
  2008-03-03 19:58 ` [Bug tree-optimization/35429] " reichelt at gcc dot gnu dot org
@ 2008-03-15  1:28 ` jsm28 at gcc dot gnu dot org
  2008-03-25  4:24 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-03-15  1:28 UTC (permalink / raw)
  To: gcc-bugs



-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Priority|P3                          |P2
   Last reconfirmed|0000-00-00 00:00:00         |2008-03-15 01:27:39
               date|                            |


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


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

* [Bug tree-optimization/35429] [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic
  2008-03-03 19:58 [Bug tree-optimization/35429] New: [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic reichelt at gcc dot gnu dot org
  2008-03-03 19:58 ` [Bug tree-optimization/35429] " reichelt at gcc dot gnu dot org
  2008-03-15  1:28 ` jsm28 at gcc dot gnu dot org
@ 2008-03-25  4:24 ` pinskia at gcc dot gnu dot org
  2008-03-25  4:35 ` 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 @ 2008-03-25  4:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2008-03-25 04:23 -------
2005-12-22  Richard Guenther  <rguenther@suse.de>

        * tree.c (tree_fold_gcd): Use build_int_cst where appropriate.
        * tree-ssa-loop-ivcanon.c (create_canonical_iv): Likewise.
        * varasm.c (array_size_for_constructor): Likewise.
        * fold-const.c (size_diffop, invert_truthvalue,
        optimize_bit_field_compare, make_range, build_range_check,
        fold_cond_expr_with_comparison, fold_truthop,
        fold_single_bit_test_into_sign_test, fold_binary): Likewise.

Caused it though using BIT_IOR_EXPR on a complex type does not make sense does
it?
Anyways adding INTEGRAL_TYPE_P makes it work.

Also I think there are some missed optimization due to a full equality check of
the types rather than a weaker one, I will file them as seperate bugs.

Mine, I am testing the obvious patch which adds the check for INTEGRAL_TYPE_P.


-- 

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
   Last reconfirmed|2008-03-15 01:27:39         |2008-03-25 04:23:41
               date|                            |


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


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

* [Bug tree-optimization/35429] [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic
  2008-03-03 19:58 [Bug tree-optimization/35429] New: [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic reichelt at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-03-25  4:24 ` pinskia at gcc dot gnu dot org
@ 2008-03-25  4:35 ` pinskia at gcc dot gnu dot org
  2008-03-27  8:57 ` 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 @ 2008-03-25  4:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2008-03-25 04:34 -------
Here is the patch which I am testing:
Index: fold-const.c
===================================================================
--- fold-const.c        (revision 133503)
+++ fold-const.c        (working copy)
@@ -5357,7 +5357,8 @@ fold_truthop (enum tree_code code, tree
       if (code == TRUTH_OR_EXPR
          && lcode == NE_EXPR && integer_zerop (lr_arg)
          && rcode == NE_EXPR && integer_zerop (rr_arg)
-         && TREE_TYPE (ll_arg) == TREE_TYPE (rl_arg))
+         && TREE_TYPE (ll_arg) == TREE_TYPE (rl_arg)
+         && INTEGRAL_TYPE_P (TREE_TYPE (ll_arg)))
        return build2 (NE_EXPR, truth_type,
                       build2 (BIT_IOR_EXPR, TREE_TYPE (ll_arg),
                               ll_arg, rl_arg),
@@ -5367,7 +5368,8 @@ fold_truthop (enum tree_code code, tree
       if (code == TRUTH_AND_EXPR
          && lcode == EQ_EXPR && integer_zerop (lr_arg)
          && rcode == EQ_EXPR && integer_zerop (rr_arg)
-         && TREE_TYPE (ll_arg) == TREE_TYPE (rl_arg))
+         && TREE_TYPE (ll_arg) == TREE_TYPE (rl_arg)
+         && INTEGRAL_TYPE_P (TREE_TYPE (ll_arg)))
        return build2 (EQ_EXPR, truth_type,
                       build2 (BIT_IOR_EXPR, TREE_TYPE (ll_arg),
                               ll_arg, rl_arg),
Index: testsuite/gcc.c-torture/compile/complex-5.c
===================================================================
--- testsuite/gcc.c-torture/compile/complex-5.c (revision 0)
+++ testsuite/gcc.c-torture/compile/complex-5.c (revision 0)
@@ -0,0 +1,9 @@
+int foo(__complex__ int z0, __complex__ int z1)
+{
+  return z0 != 0 || z1 != 0;
+}
+
+int foo1(__complex__ int z0, __complex__ int z1)
+{
+  return z0 == 0 && z1 == 0;
+}


-- 


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


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

* [Bug tree-optimization/35429] [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic
  2008-03-03 19:58 [Bug tree-optimization/35429] New: [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic reichelt at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2008-03-25  4:35 ` pinskia at gcc dot gnu dot org
@ 2008-03-27  8:57 ` pinskia at gcc dot gnu dot org
  2008-04-02  7:19 ` [Bug tree-optimization/35429] [4.1/4.2/ " 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 @ 2008-03-27  8:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2008-03-27 08:56 -------
Subject: Bug 35429

Author: pinskia
Date: Thu Mar 27 08:55:50 2008
New Revision: 133631

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133631
Log:
2008-03-27  Andrew Pinski  <pinskia@gmail.com>

        PR middle-end/35429
        * fold-const.c (fold_truthop): Check for integeral types when folding
        a == 0 && b == 0 and a != 0 || b != 0 .

2008-03-27  Andrew Pinski  <pinskia@gmail.com>

        PR middle-end/35429
        * gcc.c-torture/compile/complex-5.c: New test.


Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/complex-5.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug tree-optimization/35429] [4.1/4.2/ regression] ICE with complex arithmetic
  2008-03-03 19:58 [Bug tree-optimization/35429] New: [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic reichelt at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2008-03-27  8:57 ` pinskia at gcc dot gnu dot org
@ 2008-04-02  7:19 ` pinskia at gcc dot gnu dot org
  2008-04-02  7:20 ` 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 @ 2008-04-02  7:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2008-04-02 07:19 -------
Fixed also on the 4.3 branch.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.1/4.2/4.3 regression] ICE|[4.1/4.2/ regression] ICE
                   |with complex arithmetic     |with complex arithmetic


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


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

* [Bug tree-optimization/35429] [4.1/4.2/ regression] ICE with complex arithmetic
  2008-03-03 19:58 [Bug tree-optimization/35429] New: [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic reichelt at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2008-04-02  7:19 ` [Bug tree-optimization/35429] [4.1/4.2/ " pinskia at gcc dot gnu dot org
@ 2008-04-02  7:20 ` pinskia at gcc dot gnu dot org
  2008-07-04 22:36 ` [Bug tree-optimization/35429] [4.2 " jsm28 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 @ 2008-04-02  7:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2008-04-02 07:19 -------
Subject: Bug 35429

Author: pinskia
Date: Wed Apr  2 07:19:01 2008
New Revision: 133823

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133823
Log:
2008-04-02  Andrew Pinski  <pinskia@gmail.com>

        PR middle-end/35429
        * fold-const.c (fold_truthop): Check for integeral types when folding
        a == 0 && b == 0 and a != 0 || b != 0 .

2008-04-02  Andrew Pinski  <pinskia@gmail.com>

        PR middle-end/35429
        * gcc.c-torture/compile/complex-5.c: New test.


Added:
    branches/gcc-4_3-branch/gcc/testsuite/gcc.c-torture/compile/complex-5.c
      - copied unchanged from r133631,
trunk/gcc/testsuite/gcc.c-torture/compile/complex-5.c
Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/fold-const.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug tree-optimization/35429] [4.2 regression] ICE with complex arithmetic
  2008-03-03 19:58 [Bug tree-optimization/35429] New: [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic reichelt at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2008-04-02  7:20 ` pinskia at gcc dot gnu dot org
@ 2008-07-04 22:36 ` jsm28 at gcc dot gnu dot org
  2008-07-15 14:20 ` pinskia at gcc dot gnu dot org
  2009-03-31 15:19 ` jsm28 at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 22:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jsm28 at gcc dot gnu dot org  2008-07-04 22:35 -------
Closing 4.1 branch.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.1/4.2 regression] ICE    |[4.2 regression] ICE with
                   |with complex arithmetic     |complex arithmetic
   Target Milestone|4.1.3                       |4.2.5


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


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

* [Bug tree-optimization/35429] [4.2 regression] ICE with complex arithmetic
  2008-03-03 19:58 [Bug tree-optimization/35429] New: [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic reichelt at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2008-07-04 22:36 ` [Bug tree-optimization/35429] [4.2 " jsm28 at gcc dot gnu dot org
@ 2008-07-15 14:20 ` pinskia at gcc dot gnu dot org
  2009-03-31 15:19 ` jsm28 at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-07-15 14:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pinskia at gcc dot gnu dot org  2008-07-15 14:19 -------
No longer working on this one.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|pinskia at gcc dot gnu dot  |unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW


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


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

* [Bug tree-optimization/35429] [4.2 regression] ICE with complex arithmetic
  2008-03-03 19:58 [Bug tree-optimization/35429] New: [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic reichelt at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2008-07-15 14:20 ` pinskia at gcc dot gnu dot org
@ 2009-03-31 15:19 ` jsm28 at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-31 15:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jsm28 at gcc dot gnu dot org  2009-03-31 15:19 -------
Closing 4.2 branch, fixed in 4.3.1 and 4.4.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to fail|                            |4.2.5
      Known to work|                            |4.3.1 4.4.0
         Resolution|                            |FIXED
   Target Milestone|4.2.5                       |4.3.1


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


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

end of thread, other threads:[~2009-03-31 15:19 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-03 19:58 [Bug tree-optimization/35429] New: [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic reichelt at gcc dot gnu dot org
2008-03-03 19:58 ` [Bug tree-optimization/35429] " reichelt at gcc dot gnu dot org
2008-03-15  1:28 ` jsm28 at gcc dot gnu dot org
2008-03-25  4:24 ` pinskia at gcc dot gnu dot org
2008-03-25  4:35 ` pinskia at gcc dot gnu dot org
2008-03-27  8:57 ` pinskia at gcc dot gnu dot org
2008-04-02  7:19 ` [Bug tree-optimization/35429] [4.1/4.2/ " pinskia at gcc dot gnu dot org
2008-04-02  7:20 ` pinskia at gcc dot gnu dot org
2008-07-04 22:36 ` [Bug tree-optimization/35429] [4.2 " jsm28 at gcc dot gnu dot org
2008-07-15 14:20 ` pinskia at gcc dot gnu dot org
2009-03-31 15:19 ` jsm28 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).