public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/45059] New: error: invalid operands in binary operation, leads to ICE: verify_stmts failed
@ 2010-07-24 18:24 regehr at cs dot utah dot edu
2010-07-24 19:09 ` [Bug tree-optimization/45059] [4.6 Regression] " rguenth at gcc dot gnu dot org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: regehr at cs dot utah dot edu @ 2010-07-24 18:24 UTC (permalink / raw)
To: gcc-bugs
[regehr@bethe tmp604]$ current-gcc -O3 small.c -c -fwhole-program
small.c: In function 'main':
small.c:42:1: error: invalid operands in binary operation
D.2852_11 = (unsigned int) D.2845_7 != 4294967295;
small.c:42:1: internal compiler error: verify_stmts failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
[regehr@bethe tmp604]$ current-gcc -v
Using built-in specs.
COLLECT_GCC=current-gcc
COLLECT_LTO_WRAPPER=/uusoc/exports/scratch/regehr/z/compiler-install/gcc-r162424-inst
all/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --with-libelf=/usr/local --enable-lto
--prefix=/home/re
gehr/z/compiler-install/gcc-r162424-install --program-prefix=r162424-
--enable-langua
ges=c,c++
Thread model: posix
gcc version 4.6.0 20100722 (experimental) (GCC)
[regehr@bethe tmp604]$ cat small.c
typedef signed char int8_t;
typedef short int int16_t;
typedef int int32_t;
typedef unsigned char uint8_t;
typedef unsigned int uint32_t;
static uint32_t
safe_mod_func_uint32_t_u_u (uint32_t ui1, uint8_t ui2)
{
return ui2 ? ui1 : ui1 + ui2;
}
int8_t g_2;
uint32_t g_36[7][4] = {
-1L, -1L, -1L, 0, -1L, -1L, -1L, 0
};
uint8_t g_56;
uint8_t g_269;
int32_t func_37 (const int16_t p_38, int16_t p_39, int8_t p_40, int32_t p_41,
uint8_t p_42);
uint8_t
func_1 (void)
{
uint8_t *l_298 = &g_2;
func_20 (l_298,
&l_298 != &l_298 == ~func_37 (func_37 (g_56, 0, 0, g_269, 0), 1, 0,
-1L, 0), 0);
return 0;
}
int32_t
func_37 (const int16_t p_38, int16_t p_39, int8_t p_40, int32_t p_41,
uint8_t p_42)
{
uint8_t *l_55 = &g_56;
*l_55 |= g_2 < safe_mod_func_uint32_t_u_u (g_36[1][2], 0) | 0, ~p_39;
return 0;
}
int
main (int argc, char *argv[])
{
func_1 ();
}
--
Summary: error: invalid operands in binary operation, leads to
ICE: verify_stmts failed
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: regehr at cs dot utah dot edu
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45059
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/45059] [4.6 Regression] error: invalid operands in binary operation, leads to ICE: verify_stmts failed
2010-07-24 18:24 [Bug c/45059] New: error: invalid operands in binary operation, leads to ICE: verify_stmts failed regehr at cs dot utah dot edu
@ 2010-07-24 19:09 ` rguenth at gcc dot gnu dot org
2010-07-26 12:39 ` jakub at gcc dot gnu dot org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-07-24 19:09 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from rguenth at gcc dot gnu dot org 2010-07-24 19:09 -------
Caused by tree-ssa-reassoc.c
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Component|c |tree-optimization
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2010-07-24 19:09:14
date| |
Summary|error: invalid operands in |[4.6 Regression] error:
|binary operation, leads to |invalid operands in binary
|ICE: verify_stmts failed |operation, leads to ICE:
| |verify_stmts failed
Target Milestone|--- |4.6.0
Version|unknown |4.6.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45059
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/45059] [4.6 Regression] error: invalid operands in binary operation, leads to ICE: verify_stmts failed
2010-07-24 18:24 [Bug c/45059] New: error: invalid operands in binary operation, leads to ICE: verify_stmts failed regehr at cs dot utah dot edu
2010-07-24 19:09 ` [Bug tree-optimization/45059] [4.6 Regression] " rguenth at gcc dot gnu dot org
@ 2010-07-26 12:39 ` jakub at gcc dot gnu dot org
2010-07-26 12:59 ` jakub at gcc dot gnu dot org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-07-26 12:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from jakub at gcc dot gnu dot org 2010-07-26 12:39 -------
Simplified testcase:
typedef unsigned int T;
extern void foo (unsigned char *, int);
static signed char a;
static T b[1] = { -1 };
static unsigned char c;
static inline short int
bar (short v)
{
c |= a < b[0];
return 0;
}
int
main ()
{
unsigned char *e = &a;
foo (e, bar (bar (c)));
return 0;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45059
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/45059] [4.6 Regression] error: invalid operands in binary operation, leads to ICE: verify_stmts failed
2010-07-24 18:24 [Bug c/45059] New: error: invalid operands in binary operation, leads to ICE: verify_stmts failed regehr at cs dot utah dot edu
2010-07-24 19:09 ` [Bug tree-optimization/45059] [4.6 Regression] " rguenth at gcc dot gnu dot org
2010-07-26 12:39 ` jakub at gcc dot gnu dot org
@ 2010-07-26 12:59 ` jakub at gcc dot gnu dot org
2010-07-26 14:15 ` 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 @ 2010-07-26 12:59 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from jakub at gcc dot gnu dot org 2010-07-26 12:58 -------
Works if b[] has unsigned int type instead of T.
Sounds like a type mismatch.
The VAR_DECL b has ARRAY_TYPE with T element type and b's CONSTRUCTOR has the
same type, but the values in the constructor doesn't have T type, but unsigned
int:
<constructor 0x7ffff1f2f420
type <array_type 0x7ffff1f23498
type <integer_type 0x7ffff1f232a0 T unsigned SI
size <integer_cst 0x7ffff202d708 constant 32>
unit size <integer_cst 0x7ffff202d410 constant 4>
align 32 symtab 0 alias set -1 canonical type 0x7ffff2042540
precision 32 min <integer_cst 0x7ffff202d730 0> max <integer_cst 0x7ffff202d6e0
4294967295>
pointer_to_this <pointer_type 0x7ffff1f23540>>
SI size <integer_cst 0x7ffff202d708 32> unit size <integer_cst
0x7ffff202d410 4>
align 32 symtab 0 alias set -1 canonical type 0x7ffff1f235e8
domain <integer_type 0x7ffff2055690 type <integer_type 0x7ffff2042000
long unsigned int>
DI
size <integer_cst 0x7ffff202d7d0 constant 64>
unit size <integer_cst 0x7ffff202d7f8 constant 8>
align 64 symtab 0 alias set -1 canonical type 0x7ffff2055690
precision 64 min <integer_cst 0x7ffff202d438 0> max <integer_cst 0x7ffff202d438
0>>>
constant static lngt 1
idx <integer_cst 0x7ffff202db40 type <integer_type 0x7ffff20420a8
bit_size_type> constant 0>
val <integer_cst 0x7ffff202d6e0 type <integer_type 0x7ffff2042540 unsigned
int> constant 4294967295>>
When ccp propagates b[0] into the comparison, the comparison uses T on one side
and unsigned int on the other side. When b has T type, ccp doesn't optimize
the ... < 4294967295 comparison into ... != 4294967295, while when b has
unsigned int type, it does.
T's TYPE_MAIN_VARIANT is unsigned int.
So, it isn't clear if the middle-end is considering the two types as
incompatible or what.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45059
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/45059] [4.6 Regression] error: invalid operands in binary operation, leads to ICE: verify_stmts failed
2010-07-24 18:24 [Bug c/45059] New: error: invalid operands in binary operation, leads to ICE: verify_stmts failed regehr at cs dot utah dot edu
` (2 preceding siblings ...)
2010-07-26 12:59 ` jakub at gcc dot gnu dot org
@ 2010-07-26 14:15 ` jakub at gcc dot gnu dot org
2010-08-24 17:26 ` 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 @ 2010-07-26 14:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from jakub at gcc dot gnu dot org 2010-07-26 14:15 -------
The reassoc issue is caused by
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159189
BTW, the C++ FE uses T instead of unsigned type for values in the ctor and thus
the testcase works there.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sandra at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45059
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/45059] [4.6 Regression] error: invalid operands in binary operation, leads to ICE: verify_stmts failed
2010-07-24 18:24 [Bug c/45059] New: error: invalid operands in binary operation, leads to ICE: verify_stmts failed regehr at cs dot utah dot edu
` (3 preceding siblings ...)
2010-07-26 14:15 ` jakub at gcc dot gnu dot org
@ 2010-08-24 17:26 ` jakub at gcc dot gnu dot org
2010-08-25 9:37 ` jakub at gcc dot gnu dot org
2010-08-25 9:50 ` jakub at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-08-24 17:26 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from jakub at gcc dot gnu dot org 2010-08-24 17:26 -------
Created an attachment (id=21557)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21557&action=view)
gcc46-pr45059.patch
Untested fix.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |jakub at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45059
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/45059] [4.6 Regression] error: invalid operands in binary operation, leads to ICE: verify_stmts failed
2010-07-24 18:24 [Bug c/45059] New: error: invalid operands in binary operation, leads to ICE: verify_stmts failed regehr at cs dot utah dot edu
` (4 preceding siblings ...)
2010-08-24 17:26 ` jakub at gcc dot gnu dot org
@ 2010-08-25 9:37 ` jakub at gcc dot gnu dot org
2010-08-25 9:50 ` jakub at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-08-25 9:37 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from jakub at gcc dot gnu dot org 2010-08-25 09:37 -------
Subject: Bug 45059
Author: jakub
Date: Wed Aug 25 09:36:35 2010
New Revision: 163539
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=163539
Log:
PR tree-optimization/45059
* tree-ssa-reassoc.c (eliminate_redundant_comparison): Strip useless
type conversions from newop{1,2}. Assert t is a comparison and
newop{1,2} after the stripping are gimple vals.
* gcc.c-torture/compile/pr45059.c: New test.
Added:
trunk/gcc/testsuite/gcc.c-torture/compile/pr45059.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-reassoc.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45059
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/45059] [4.6 Regression] error: invalid operands in binary operation, leads to ICE: verify_stmts failed
2010-07-24 18:24 [Bug c/45059] New: error: invalid operands in binary operation, leads to ICE: verify_stmts failed regehr at cs dot utah dot edu
` (5 preceding siblings ...)
2010-08-25 9:37 ` jakub at gcc dot gnu dot org
@ 2010-08-25 9:50 ` jakub at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-08-25 9:50 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from jakub at gcc dot gnu dot org 2010-08-25 09:50 -------
Fixed.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45059
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-08-25 9:50 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-24 18:24 [Bug c/45059] New: error: invalid operands in binary operation, leads to ICE: verify_stmts failed regehr at cs dot utah dot edu
2010-07-24 19:09 ` [Bug tree-optimization/45059] [4.6 Regression] " rguenth at gcc dot gnu dot org
2010-07-26 12:39 ` jakub at gcc dot gnu dot org
2010-07-26 12:59 ` jakub at gcc dot gnu dot org
2010-07-26 14:15 ` jakub at gcc dot gnu dot org
2010-08-24 17:26 ` jakub at gcc dot gnu dot org
2010-08-25 9:37 ` jakub at gcc dot gnu dot org
2010-08-25 9:50 ` jakub 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).