public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/31339] [4.3 regression] ICE on invalid use of complex constant
  2007-03-24 23:22 [Bug middle-end/31339] New: [4.3 regression] ICE on invalid use of complex constant reichelt at gcc dot gnu dot org
@ 2007-03-24 23:22 ` reichelt at gcc dot gnu dot org
  2007-03-25  6:21 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2007-03-24 23:22 UTC (permalink / raw)
  To: gcc-bugs



-- 

reichelt at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.3.0


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


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

* [Bug middle-end/31339]  New: [4.3 regression] ICE on invalid use of complex constant
@ 2007-03-24 23:22 reichelt at gcc dot gnu dot org
  2007-03-24 23:22 ` [Bug middle-end/31339] " reichelt at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2007-03-24 23:22 UTC (permalink / raw)
  To: gcc-bugs

The following invalid code snippet triggers an ICE on mainline:

===========================
bool b = --0i == 0;
===========================

bug.cc:1: error: lvalue required as decrement operand
bug.cc:1: internal compiler error: tree check: expected class 'type', have
'exceptional' (error_mark) in fold_comparison, at fold-const.c:8459
Please submit a full bug report, [etc.]


-- 
           Summary: [4.3 regression] ICE on invalid use of complex constant
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code, error-recovery, monitored
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org


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


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

* [Bug middle-end/31339] [4.3 regression] ICE on invalid use of complex constant
  2007-03-24 23:22 [Bug middle-end/31339] New: [4.3 regression] ICE on invalid use of complex constant reichelt at gcc dot gnu dot org
  2007-03-24 23:22 ` [Bug middle-end/31339] " reichelt at gcc dot gnu dot org
@ 2007-03-25  6:21 ` pinskia at gcc dot gnu dot org
  2007-04-03  6:28 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-03-25  6:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2007-03-25 08:21 -------
  if (TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (arg0))

I think we are just checking TYPE_OVERFLOW_UNDEFINED too early.


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

* [Bug middle-end/31339] [4.3 regression] ICE on invalid use of complex constant
  2007-03-24 23:22 [Bug middle-end/31339] New: [4.3 regression] ICE on invalid use of complex constant reichelt at gcc dot gnu dot org
  2007-03-24 23:22 ` [Bug middle-end/31339] " reichelt at gcc dot gnu dot org
  2007-03-25  6:21 ` pinskia at gcc dot gnu dot org
@ 2007-04-03  6:28 ` pinskia at gcc dot gnu dot org
  2007-05-22 23:29 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-04-03  6:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2007-04-03 07:28 -------
Confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-04-03 07:28:40
               date|                            |


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


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

* [Bug middle-end/31339] [4.3 regression] ICE on invalid use of complex constant
  2007-03-24 23:22 [Bug middle-end/31339] New: [4.3 regression] ICE on invalid use of complex constant reichelt at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-04-03  6:28 ` pinskia at gcc dot gnu dot org
@ 2007-05-22 23:29 ` pinskia at gcc dot gnu dot org
  2007-05-22 23:49 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-05-22 23:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2007-05-23 00:29 -------
I have a patch for the C and C++ front-ends, we don't have to change fold at
all.


-- 

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


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


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

* [Bug middle-end/31339] [4.3 regression] ICE on invalid use of complex constant
  2007-03-24 23:22 [Bug middle-end/31339] New: [4.3 regression] ICE on invalid use of complex constant reichelt at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-05-22 23:29 ` pinskia at gcc dot gnu dot org
@ 2007-05-22 23:49 ` pinskia at gcc dot gnu dot org
  2007-05-29  0:25 ` [Bug c/31339] " pinskia at gcc dot gnu dot org
  2007-05-29  0:25 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-05-22 23:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2007-05-23 00:48 -------
The patch which I am testing:
Index: testsuite/gcc.dg/boolcomplex-1.c
===================================================================
--- testsuite/gcc.dg/boolcomplex-1.c    (revision 0)
+++ testsuite/gcc.dg/boolcomplex-1.c    (revision 0)
@@ -0,0 +1,3 @@
+/* { dg-do compile } */
+/* { dg-options "" } */
+_Bool b = --0i == 0; /* { dg-error "lvalue required as decrement operand" } */
Index: testsuite/g++.dg/ext/boolcomplex-1.c
===================================================================
--- testsuite/g++.dg/ext/boolcomplex-1.c        (revision 0)
+++ testsuite/g++.dg/ext/boolcomplex-1.c        (revision 0)
@@ -0,0 +1,3 @@
+/* { dg-do compile } */
+/* { dg-options "" } */
+bool b = --0i == 0; /* { dg-error "lvalue required as decrement operand" } */
Index: cp/typeck.c
===================================================================
--- cp/typeck.c (revision 124926)
+++ cp/typeck.c (working copy)
@@ -4221,8 +4221,11 @@ build_unary_op (enum tree_code code, tre
          arg = stabilize_reference (arg);
          real = build_unary_op (REALPART_EXPR, arg, 1);
          imag = build_unary_op (IMAGPART_EXPR, arg, 1);
+         real = build_unary_op (code, real, 1);
+         if (real == error_mark_node || imag == error_mark_node)
+           return error_mark_node;
          return build2 (COMPLEX_EXPR, TREE_TYPE (arg),
-                        build_unary_op (code, real, 1), imag);
+                        real, imag);
        }

       /* Report invalid types.  */
Index: c-typeck.c
===================================================================
--- c-typeck.c  (revision 124926)
+++ c-typeck.c  (working copy)
@@ -2908,8 +2908,11 @@ build_unary_op (enum tree_code code, tre
          arg = stabilize_reference (arg);
          real = build_unary_op (REALPART_EXPR, arg, 1);
          imag = build_unary_op (IMAGPART_EXPR, arg, 1);
+         real = build_unary_op (code, real, 1);
+         if (real == error_mark_node || imag == error_mark_node)
+           return error_mark_node;
          return build2 (COMPLEX_EXPR, TREE_TYPE (arg),
-                        build_unary_op (code, real, 1), imag);
+                        real, imag);
        }

       /* Report invalid types.  */




Instead of ever creating a COMPLEX_EXPR with an error_mark, just return an
error_mark_node.


-- 


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


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

* [Bug c/31339] [4.3 regression] ICE on invalid use of complex constant
  2007-03-24 23:22 [Bug middle-end/31339] New: [4.3 regression] ICE on invalid use of complex constant reichelt at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-05-22 23:49 ` pinskia at gcc dot gnu dot org
@ 2007-05-29  0:25 ` pinskia at gcc dot gnu dot org
  2007-05-29  0:25 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-05-29  0:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2007-05-29 00:25 -------
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=31339


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

* [Bug c/31339] [4.3 regression] ICE on invalid use of complex constant
  2007-03-24 23:22 [Bug middle-end/31339] New: [4.3 regression] ICE on invalid use of complex constant reichelt at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2007-05-29  0:25 ` [Bug c/31339] " pinskia at gcc dot gnu dot org
@ 2007-05-29  0:25 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-05-29  0:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2007-05-29 00:25 -------
Subject: Bug 31339

Author: pinskia
Date: Tue May 29 00:25:25 2007
New Revision: 125156

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=125156
Log:
2007-05-28  Andrew Pinski  <Andrew_pinski@playstation.sony.com>

        PR c/31339
        * c-typeck.c (build_unary_op <case PREINCREMENT_EXPR,
        case POSTINCREMENT_EXPR, case PREDECREMENT_EXPR,
        case POSTDECREMENT_EXPR>): Return the error_mark_node
        if either the real or imaginary parts would an
        error_mark_node.

2007-05-28  Andrew Pinski  <Andrew_pinski@playstation.sony.com>

        PR c++/31339
        * typeck.c (build_unary_op <case PREINCREMENT_EXPR,
        case POSTINCREMENT_EXPR, case PREDECREMENT_EXPR,
        case POSTDECREMENT_EXPR>): Return the error_mark_node
        if either the real or imaginary parts would an
        error_mark_node.

2007-05-28  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR c/31339
        * gcc.dg/boolcomplex-1.c: New test.

        PR c++/31339
        * g++.dg/ext/boolcomplex-1.c: New test



Added:
    trunk/gcc/testsuite/g++.dg/ext/boolcomplex-1.c
    trunk/gcc/testsuite/gcc.dg/boolcomplex-1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-typeck.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/typeck.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

end of thread, other threads:[~2007-05-29  0:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-24 23:22 [Bug middle-end/31339] New: [4.3 regression] ICE on invalid use of complex constant reichelt at gcc dot gnu dot org
2007-03-24 23:22 ` [Bug middle-end/31339] " reichelt at gcc dot gnu dot org
2007-03-25  6:21 ` pinskia at gcc dot gnu dot org
2007-04-03  6:28 ` pinskia at gcc dot gnu dot org
2007-05-22 23:29 ` pinskia at gcc dot gnu dot org
2007-05-22 23:49 ` pinskia at gcc dot gnu dot org
2007-05-29  0:25 ` [Bug c/31339] " pinskia at gcc dot gnu dot org
2007-05-29  0:25 ` 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).