public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/35430] New: [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic
@ 2008-03-03 20:03 reichelt at gcc dot gnu dot org
2008-03-03 20:04 ` [Bug middle-end/35430] " reichelt at gcc dot gnu dot org
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2008-03-03 20:03 UTC (permalink / raw)
To: gcc-bugs
The following valid code snippet triggers an ICE since GCC 4.0.0 when compiled
with "-W":
================================
void foo(__complex__ int i)
{
i == 0u;
}
================================
bug.c: In function 'foo':
bug.c:3: internal compiler error: tree check: expected integer_type or
enumeral_type or boolean_type or real_type or fixed_point_type, have
complex_type in int_fits_type_p, at tree.c:6173
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: middle-end
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=35430
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/35430] [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic
2008-03-03 20:03 [Bug middle-end/35430] New: [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic reichelt at gcc dot gnu dot org
@ 2008-03-03 20:04 ` reichelt at gcc dot gnu dot org
2008-03-15 1:29 ` jsm28 at gcc dot gnu dot org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2008-03-03 20:04 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=35430
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/35430] [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic
2008-03-03 20:03 [Bug middle-end/35430] New: [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic reichelt at gcc dot gnu dot org
2008-03-03 20:04 ` [Bug middle-end/35430] " reichelt at gcc dot gnu dot org
@ 2008-03-15 1:29 ` jsm28 at gcc dot gnu dot org
2008-03-26 17:38 ` [Bug c/35430] " pinskia at gcc dot gnu dot org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-03-15 1:29 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:28:20
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35430
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/35430] [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic
2008-03-03 20:03 [Bug middle-end/35430] New: [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic reichelt at gcc dot gnu dot org
2008-03-03 20:04 ` [Bug middle-end/35430] " reichelt at gcc dot gnu dot org
2008-03-15 1:29 ` jsm28 at gcc dot gnu dot org
@ 2008-03-26 17:38 ` pinskia at gcc dot gnu dot org
2008-03-26 17:39 ` pinskia at gcc dot gnu dot org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-03-26 17:38 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2008-03-26 17:38 -------
This is a front-end issue.
C++ calls it at:
3952 /* Do not warn if the comparison is an equality operation,
3953 the unsigned quantity is an integral constant and it does
3954 not use the most significant bit of result_type. */
3955 else if ((resultcode == EQ_EXPR || resultcode == NE_EXPR)
3956 && ((op0_signed && TREE_CODE (orig_op1) ==
INTEGER_CST
3957 && int_fits_type_p (orig_op1,
c_common_signed_type
3958 (result_type)))
While C does:
8499 /* Do not warn if the comparison is an equality
operation,
8500 the unsigned quantity is an integral constant, and
it
8501 would fit in the result if the result were signed.
*/
8502 else if (TREE_CODE (uop) == INTEGER_CST
8503 && (resultcode == EQ_EXPR || resultcode ==
NE_EXPR)
8504 && int_fits_type_p
8505 (uop, c_common_signed_type (result_type)))
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|middle-end |c
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35430
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/35430] [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic
2008-03-03 20:03 [Bug middle-end/35430] 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-26 17:38 ` [Bug c/35430] " pinskia at gcc dot gnu dot org
@ 2008-03-26 17:39 ` pinskia at gcc dot gnu dot org
2008-03-29 19:44 ` pinskia at gcc dot gnu dot org
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-03-26 17:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2008-03-26 17:39 -------
I am going to fix this bug but not until tonight.
--
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:28:20 |2008-03-26 17:39:08
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35430
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/35430] [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic
2008-03-03 20:03 [Bug middle-end/35430] 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-26 17:39 ` pinskia at gcc dot gnu dot org
@ 2008-03-29 19:44 ` pinskia at gcc dot gnu dot org
2008-07-04 22:36 ` [Bug c/35430] [4.2/4.3/4.4 " jsm28 at gcc dot gnu dot org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-03-29 19:44 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2008-03-29 19:44 -------
This is the patch which I am testing:
Index: cp/typeck.c
===================================================================
--- cp/typeck.c (revision 133711)
+++ cp/typeck.c (working copy)
@@ -3917,6 +3917,10 @@ cp_build_binary_op (enum tree_code code,
int unsignedp0, unsignedp1;
tree primop0 = get_narrower (op0, &unsignedp0);
tree primop1 = get_narrower (op1, &unsignedp1);
+ tree undertype = result_type;
+
+ if (TREE_CODE (undertype) == COMPLEX_TYPE)
+ undertype = TREE_TYPE (undertype);
/* Check for comparison of different enum types. */
if (TREE_CODE (TREE_TYPE (orig_op0)) == ENUMERAL_TYPE
@@ -3937,7 +3941,7 @@ cp_build_binary_op (enum tree_code code,
/* Do not warn if the comparison is being done in a signed type,
since the signed type will only be chosen if it can represent
all the values of the unsigned type. */
- if (!TYPE_UNSIGNED (result_type))
+ if (!TYPE_UNSIGNED (undertype))
/* OK */;
/* Do not warn if both operands are unsigned. */
else if (op0_signed == op1_signed)
@@ -3955,10 +3959,10 @@ cp_build_binary_op (enum tree_code code,
else if ((resultcode == EQ_EXPR || resultcode == NE_EXPR)
&& ((op0_signed && TREE_CODE (orig_op1) == INTEGER_CST
&& int_fits_type_p (orig_op1, c_common_signed_type
- (result_type)))
+ (undertype)))
|| (op1_signed && TREE_CODE (orig_op0) == INTEGER_CST
&& int_fits_type_p (orig_op0, c_common_signed_type
- (result_type)))))
+ (undertype)))))
/* OK */;
else if (complain & tf_warning)
warning (OPT_Wsign_compare,
Index: c-typeck.c
===================================================================
--- c-typeck.c (revision 133711)
+++ c-typeck.c (working copy)
@@ -8483,6 +8483,9 @@ build_binary_op (enum tree_code code, tr
{
tree sop, uop;
bool ovf;
+ tree undertype = result_type;
+ if (TREE_CODE (undertype) == COMPLEX_TYPE)
+ undertype = TREE_TYPE (undertype);
if (op0_signed)
sop = xop0, uop = xop1;
@@ -8502,7 +8505,7 @@ build_binary_op (enum tree_code code, tr
else if (TREE_CODE (uop) == INTEGER_CST
&& (resultcode == EQ_EXPR || resultcode == NE_EXPR)
&& int_fits_type_p
- (uop, c_common_signed_type (result_type)))
+ (uop, c_common_signed_type (undertype)))
/* OK */;
/* Do not warn if the unsigned quantity is an enumeration
constant and its maximum value would fit in the result
@@ -8511,7 +8514,7 @@ build_binary_op (enum tree_code code, tr
&& TREE_CODE (TREE_TYPE (uop)) == ENUMERAL_TYPE
&& int_fits_type_p
(TYPE_MAX_VALUE (TREE_TYPE (uop)),
- c_common_signed_type (result_type)))
+ c_common_signed_type (undertype)))
/* OK */;
else
warning (OPT_Wsign_compare, "comparison between signed and
unsigned");
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35430
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/35430] [4.2/4.3/4.4 regression] ICE with complex arithmetic
2008-03-03 20:03 [Bug middle-end/35430] 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-29 19:44 ` pinskia at gcc dot gnu dot org
@ 2008-07-04 22:36 ` jsm28 at gcc dot gnu dot org
2008-11-04 20:54 ` jakub at gcc dot gnu dot org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 22:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 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/4.3/4.4 regression]|[4.2/4.3/4.4 regression] ICE
|ICE with complex arithmetic |with complex arithmetic
Target Milestone|4.1.3 |4.2.5
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35430
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/35430] [4.2/4.3/4.4 regression] ICE with complex arithmetic
2008-03-03 20:03 [Bug middle-end/35430] 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-07-04 22:36 ` [Bug c/35430] [4.2/4.3/4.4 " jsm28 at gcc dot gnu dot org
@ 2008-11-04 20:54 ` jakub at gcc dot gnu dot org
2008-11-04 21:05 ` [Bug c/35430] [4.2/4.3 " jakub at gcc dot gnu dot org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-11-04 20:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from jakub at gcc dot gnu dot org 2008-11-04 20:53 -------
Subject: Bug 35430
Author: jakub
Date: Tue Nov 4 20:51:38 2008
New Revision: 141587
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141587
Log:
PR c/35430
* c-common.c (warn_for_sign_compare): For complex result_type
use component's type.
* gcc.dg/pr35430.c: New test.
* g++.dg/warn/Wsign-compare-2.C: New test.
Added:
trunk/gcc/testsuite/g++.dg/warn/Wsign-compare-2.C
trunk/gcc/testsuite/gcc.dg/pr35430.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/c-common.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35430
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/35430] [4.2/4.3 regression] ICE with complex arithmetic
2008-03-03 20:03 [Bug middle-end/35430] 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-11-04 20:54 ` jakub at gcc dot gnu dot org
@ 2008-11-04 21:05 ` jakub at gcc dot gnu dot org
2009-03-31 20:46 ` [Bug c/35430] [4.3 " jsm28 at gcc dot gnu dot org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-11-04 21:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from jakub at gcc dot gnu dot org 2008-11-04 21:03 -------
Fixed on the trunk.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |4.4.0
Summary|[4.2/4.3/4.4 regression] ICE|[4.2/4.3 regression] ICE
|with complex arithmetic |with complex arithmetic
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35430
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/35430] [4.3 regression] ICE with complex arithmetic
2008-03-03 20:03 [Bug middle-end/35430] 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-11-04 21:05 ` [Bug c/35430] [4.2/4.3 " jakub at gcc dot gnu dot org
@ 2009-03-31 20:46 ` jsm28 at gcc dot gnu dot org
2009-04-16 15:45 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-31 20:46 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from jsm28 at gcc dot gnu dot org 2009-03-31 20:45 -------
Closing 4.2 branch.
--
jsm28 at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[4.2/4.3 regression] ICE |[4.3 regression] ICE with
|with complex arithmetic |complex arithmetic
Target Milestone|4.2.5 |4.3.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35430
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/35430] [4.3 regression] ICE with complex arithmetic
2008-03-03 20:03 [Bug middle-end/35430] New: [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic reichelt at gcc dot gnu dot org
` (8 preceding siblings ...)
2009-03-31 20:46 ` [Bug c/35430] [4.3 " jsm28 at gcc dot gnu dot org
@ 2009-04-16 15:45 ` pinskia at gcc dot gnu dot org
2009-08-04 12:39 ` rguenth at gcc dot gnu dot org
2010-04-20 13:42 ` rguenth at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-04-16 15:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from pinskia at gcc dot gnu dot org 2009-04-16 15:44 -------
I am 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=35430
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/35430] [4.3 regression] ICE with complex arithmetic
2008-03-03 20:03 [Bug middle-end/35430] New: [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic reichelt at gcc dot gnu dot org
` (9 preceding siblings ...)
2009-04-16 15:45 ` pinskia at gcc dot gnu dot org
@ 2009-08-04 12:39 ` rguenth at gcc dot gnu dot org
2010-04-20 13:42 ` rguenth at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-08-04 12:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from rguenth at gcc dot gnu dot org 2009-08-04 12:28 -------
GCC 4.3.4 is being released, adjusting target milestone.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.3.4 |4.3.5
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35430
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/35430] [4.3 regression] ICE with complex arithmetic
2008-03-03 20:03 [Bug middle-end/35430] New: [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic reichelt at gcc dot gnu dot org
` (10 preceding siblings ...)
2009-08-04 12:39 ` rguenth at gcc dot gnu dot org
@ 2010-04-20 13:42 ` rguenth at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-04-20 13:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from rguenth at gcc dot gnu dot org 2010-04-20 13:42 -------
WONTFIX on the 4.3 branch.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Keywords| |ice-checking
Known to fail| |4.3.4
Resolution| |FIXED
Target Milestone|4.3.5 |4.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35430
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2010-04-20 13:42 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-03 20:03 [Bug middle-end/35430] New: [4.1/4.2/4.3/4.4 regression] ICE with complex arithmetic reichelt at gcc dot gnu dot org
2008-03-03 20:04 ` [Bug middle-end/35430] " reichelt at gcc dot gnu dot org
2008-03-15 1:29 ` jsm28 at gcc dot gnu dot org
2008-03-26 17:38 ` [Bug c/35430] " pinskia at gcc dot gnu dot org
2008-03-26 17:39 ` pinskia at gcc dot gnu dot org
2008-03-29 19:44 ` pinskia at gcc dot gnu dot org
2008-07-04 22:36 ` [Bug c/35430] [4.2/4.3/4.4 " jsm28 at gcc dot gnu dot org
2008-11-04 20:54 ` jakub at gcc dot gnu dot org
2008-11-04 21:05 ` [Bug c/35430] [4.2/4.3 " jakub at gcc dot gnu dot org
2009-03-31 20:46 ` [Bug c/35430] [4.3 " jsm28 at gcc dot gnu dot org
2009-04-16 15:45 ` pinskia at gcc dot gnu dot org
2009-08-04 12:39 ` rguenth at gcc dot gnu dot org
2010-04-20 13:42 ` rguenth 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).