* [Bug c/14682] error: Invalid operand to binary operator
2004-03-22 19:38 [Bug c/14682] New: error: Invalid operand to binary operator aj at gcc dot gnu dot org
@ 2004-03-22 19:39 ` aj at gcc dot gnu dot org
2004-03-22 19:53 ` [Bug middle-end/14682] [tree-ssa] " pinskia at gcc dot gnu dot org
` (22 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: aj at gcc dot gnu dot org @ 2004-03-22 19:39 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From aj at gcc dot gnu dot org 2004-03-22 19:39 -------
Created an attachment (id=5975)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5975&action=view)
Preprocessed source file
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14682
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug middle-end/14682] [tree-ssa] error: Invalid operand to binary operator
2004-03-22 19:38 [Bug c/14682] New: error: Invalid operand to binary operator aj at gcc dot gnu dot org
2004-03-22 19:39 ` [Bug c/14682] " aj at gcc dot gnu dot org
@ 2004-03-22 19:53 ` pinskia at gcc dot gnu dot org
2004-03-22 20:13 ` [Bug c/14682] " falk at debian dot org
` (21 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-22 19:53 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-03-22 19:53 -------
Most likely this is a dup of bug 14672.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
BugsThisDependsOn| |14672
Component|c |middle-end
Summary|error: Invalid operand to |[tree-ssa] error: Invalid
|binary operator |operand to binary operator
Target Milestone|--- |tree-ssa
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14682
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug c/14682] [tree-ssa] error: Invalid operand to binary operator
2004-03-22 19:38 [Bug c/14682] New: error: Invalid operand to binary operator aj at gcc dot gnu dot org
2004-03-22 19:39 ` [Bug c/14682] " aj at gcc dot gnu dot org
2004-03-22 19:53 ` [Bug middle-end/14682] [tree-ssa] " pinskia at gcc dot gnu dot org
@ 2004-03-22 20:13 ` falk at debian dot org
2004-03-22 20:16 ` [Bug middle-end/14682] " pinskia at gcc dot gnu dot org
` (20 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: falk at debian dot org @ 2004-03-22 20:13 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From falk at debian dot org 2004-03-22 20:13 -------
I can reproduce this with 3.5-tree-ssa 20040318 (merged 20040307)
(alphaev68-unknown-linux-gnu).
Test case:
int __atomic_readv_replacement(unsigned long iov_len, int count, int i) {
unsigned long bytes = 0;
while (i < count) {
if (9223372036854775807L - bytes < iov_len)
return 22;
}
return 0;
}
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Component|middle-end |c
Ever Confirmed| |1
Target Milestone|tree-ssa |---
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14682
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug middle-end/14682] [tree-ssa] error: Invalid operand to binary operator
2004-03-22 19:38 [Bug c/14682] New: error: Invalid operand to binary operator aj at gcc dot gnu dot org
` (2 preceding siblings ...)
2004-03-22 20:13 ` [Bug c/14682] " falk at debian dot org
@ 2004-03-22 20:16 ` pinskia at gcc dot gnu dot org
2004-03-22 20:20 ` [Bug optimization/14682] " pinskia at gcc dot gnu dot org
` (19 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-22 20:16 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-03-22 20:16 -------
Here is one which fails on 32bit targets:
int __atomic_readv_replacement(unsigned long long iov_len, int count, int i) {
unsigned long long bytes = 0;
while (i < count) {
if (9223372036854775807LL - bytes < iov_len)
return 22;
}
return 0;
}
--
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn|14672 |
Component|c |middle-end
Target Milestone|--- |tree-ssa
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14682
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug optimization/14682] [tree-ssa] error: Invalid operand to binary operator
2004-03-22 19:38 [Bug c/14682] New: error: Invalid operand to binary operator aj at gcc dot gnu dot org
` (3 preceding siblings ...)
2004-03-22 20:16 ` [Bug middle-end/14682] " pinskia at gcc dot gnu dot org
@ 2004-03-22 20:20 ` pinskia at gcc dot gnu dot org
2004-03-22 21:14 ` steven at gcc dot gnu dot org
` (18 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-22 20:20 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-03-22 20:20 -------
DOM is causing it.
Before DOM:
;; Function __atomic_readv_replacement (__atomic_readv_replacement)
__atomic_readv_replacement (iov_len, count, i)
{
long long unsigned int bytes;
long long unsigned int T.0;
<bb 0>:
bytes_1 = 0;
goto <bb 3> (<L2>);
<L0>:;
T.0_5 = 9223372036854775807 - bytes_1;
if (T.0_5 < iov_len_6) goto <L1>; else goto <L2>;
<L1>:;
return 22;
<L2>:;
if (i_2 < count_3) goto <L0>; else goto <L4>;
<L4>:;
return 0;
}
After DOM:
;; Function __atomic_readv_replacement (__atomic_readv_replacement)
__atomic_readv_replacement (iov_len, count, i)
{
long long unsigned int bytes;
long long unsigned int T.0;
<bb 0>:
bytes_1 = 0;
goto <bb 3> (<L2>);
<L0>:;
T.0_5 = 9223372036854775807;
if ((long long int)iov_len_6 < 0) goto <L1>; else goto <L2>;
<L1>:;
return 22;
<L2>:;
if (i_2 < count_3) goto <L0>; else goto <L4>;
<L4>:;
return 0;
}
See if ((long long int)iov_len_6 < 0) goto <L1>; else goto <L2>;
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |law at gcc dot gnu dot org
Component|middle-end |optimization
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14682
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug optimization/14682] [tree-ssa] error: Invalid operand to binary operator
2004-03-22 19:38 [Bug c/14682] New: error: Invalid operand to binary operator aj at gcc dot gnu dot org
` (4 preceding siblings ...)
2004-03-22 20:20 ` [Bug optimization/14682] " pinskia at gcc dot gnu dot org
@ 2004-03-22 21:14 ` steven at gcc dot gnu dot org
2004-03-22 21:17 ` pinskia at gcc dot gnu dot org
` (17 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-03-22 21:14 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From steven at gcc dot gnu dot org 2004-03-22 21:14 -------
Yup, DOM1 is doing something really interesting here:
Optimizing statement <L0>:;
Optimizing statement T.0_5 = 9223372036854775807 - bytes_1;
Replaced 'bytes<D1401>_1' with constant '0'
Folded to: T.0_5 = 9223372036854775807;
Optimizing statement if (T.0_5 < iov_len_6) goto <L1>; else goto <L2>;
Replaced 'T.0<D1405>_5' with constant '9223372036854775807'
Folded to: if ((long long int)iov_len_6 < 0) goto <L1>; else goto <L2>;
--
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|0000-00-00 00:00:00 |2004-03-22 21:14:32
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14682
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug optimization/14682] [tree-ssa] error: Invalid operand to binary operator
2004-03-22 19:38 [Bug c/14682] New: error: Invalid operand to binary operator aj at gcc dot gnu dot org
` (5 preceding siblings ...)
2004-03-22 21:14 ` steven at gcc dot gnu dot org
@ 2004-03-22 21:17 ` pinskia at gcc dot gnu dot org
2004-03-22 21:27 ` steven at gcc dot gnu dot org
` (16 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-22 21:17 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-03-22 21:17 -------
Actually it looks like DOM is not taking into the fact that fold can create non-gimple.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14682
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug optimization/14682] [tree-ssa] error: Invalid operand to binary operator
2004-03-22 19:38 [Bug c/14682] New: error: Invalid operand to binary operator aj at gcc dot gnu dot org
` (6 preceding siblings ...)
2004-03-22 21:17 ` pinskia at gcc dot gnu dot org
@ 2004-03-22 21:27 ` steven at gcc dot gnu dot org
2004-03-22 21:34 ` steven at gcc dot gnu dot org
` (15 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-03-22 21:27 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From steven at gcc dot gnu dot org 2004-03-22 21:27 -------
Perhaps. I looked in GDB:
/* Const/copy propagate into USES, VUSES and the RHS of VDEFs. */
may_have_exposed_new_symbols = cprop_into_stmt (stmt, const_and_copies);
==> Here we have:
"if (9223372036854775807 < iov_len_6) goto <L1>; else goto <L2>;"
which is good.
/* If the statement has been modified with constant replacements,
fold its RHS before checking for redundant computations. */
if (ann->modified)
{
/* Try to fold the statement making sure that STMT is kept
up to date. */
if (fold_stmt (bsi_stmt_ptr (si)))
{
==> and here we have:
"if ((long long int)iov_len_6 < 0) goto <L1>; else goto <L2>;"
which is wrong.
So fold_stmt is producing something we're not ready for.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14682
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug optimization/14682] [tree-ssa] error: Invalid operand to binary operator
2004-03-22 19:38 [Bug c/14682] New: error: Invalid operand to binary operator aj at gcc dot gnu dot org
` (7 preceding siblings ...)
2004-03-22 21:27 ` steven at gcc dot gnu dot org
@ 2004-03-22 21:34 ` steven at gcc dot gnu dot org
2004-03-22 22:11 ` pinskia at gcc dot gnu dot org
` (14 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-03-22 21:34 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From steven at gcc dot gnu dot org 2004-03-22 21:34 -------
In tree-ssa-ccp.c:
/* If we couldn't fold the RHS, hand over to the generic fold routines. */
if (result == NULL_TREE)
result = fold (rhs);
After fold(rhs), we have:
(gdb) p print_generic_stmt (stderr,result,0)
(long long int)iov_len_6 < 0;
So Andrew is right.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14682
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug optimization/14682] [tree-ssa] error: Invalid operand to binary operator
2004-03-22 19:38 [Bug c/14682] New: error: Invalid operand to binary operator aj at gcc dot gnu dot org
` (8 preceding siblings ...)
2004-03-22 21:34 ` steven at gcc dot gnu dot org
@ 2004-03-22 22:11 ` pinskia at gcc dot gnu dot org
2004-03-22 22:43 ` law at redhat dot com
` (13 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-22 22:11 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-03-22 22:11 -------
Here is a version which uses char instead of long/long long's:
int __atomic_readv_replacement(unsigned char iov_len, int count, int i) {
unsigned char bytes = 0;
if ((unsigned char)((char)127 - bytes) < iov_len)
return 22;
return 0;
}
The problem is that fold is converting 127 < iov_len into (char)( iov_len) < 0 which is
right but it is not gimple.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |dnovillo at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14682
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug optimization/14682] [tree-ssa] error: Invalid operand to binary operator
2004-03-22 19:38 [Bug c/14682] New: error: Invalid operand to binary operator aj at gcc dot gnu dot org
` (9 preceding siblings ...)
2004-03-22 22:11 ` pinskia at gcc dot gnu dot org
@ 2004-03-22 22:43 ` law at redhat dot com
2004-03-23 2:53 ` pinskia at gcc dot gnu dot org
` (12 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: law at redhat dot com @ 2004-03-22 22:43 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From law at redhat dot com 2004-03-22 22:42 -------
Subject: Re: [tree-ssa] error: Invalid operand to
binary operator
In message <20040322221127.1513.qmail@sources.redhat.com>, "pinskia at gcc dot
gnu dot org" writes:
>
>------- Additional Comments From pinskia at gcc dot gnu dot org 2004-03-22 2
>2:11 -------
>Here is a version which uses char instead of long/long long's:
>int __atomic_readv_replacement(unsigned char iov_len, int count, int i) {
> unsigned char bytes = 0;
> if ((unsigned char)((char)127 - bytes) < iov_len)
> return 22;
> return 0;
>}
>
>The problem is that fold is converting 127 < iov_len into (char)( iov_len) <
> 0 which is
>right but it is not gimple.
This is a known problem and already on my list of issues to address.
jeff
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14682
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug optimization/14682] [tree-ssa] error: Invalid operand to binary operator
2004-03-22 19:38 [Bug c/14682] New: error: Invalid operand to binary operator aj at gcc dot gnu dot org
` (10 preceding siblings ...)
2004-03-22 22:43 ` law at redhat dot com
@ 2004-03-23 2:53 ` pinskia at gcc dot gnu dot org
2004-03-23 2:58 ` pinskia at gcc dot gnu dot org
` (11 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-23 2:53 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-03-23 02:53 -------
This should be critical because it shows up in PR 8361: if ((long int)__n_7 < 0) goto <L1>
; else goto <L2>;
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |critical
Last reconfirmed|2004-03-22 21:14:32 |2004-03-23 02:53:29
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14682
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug optimization/14682] [tree-ssa] error: Invalid operand to binary operator
2004-03-22 19:38 [Bug c/14682] New: error: Invalid operand to binary operator aj at gcc dot gnu dot org
` (11 preceding siblings ...)
2004-03-23 2:53 ` pinskia at gcc dot gnu dot org
@ 2004-03-23 2:58 ` pinskia at gcc dot gnu dot org
2004-03-23 14:28 ` law at redhat dot com
` (10 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-23 2:58 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-03-23 02:58 -------
Really only the preprocessed source that is in the PR because maxsize is defined now
as:
size_type
max_size() const { return size_type(-1) / sizeof(value_type); }
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14682
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug optimization/14682] [tree-ssa] error: Invalid operand to binary operator
2004-03-22 19:38 [Bug c/14682] New: error: Invalid operand to binary operator aj at gcc dot gnu dot org
` (12 preceding siblings ...)
2004-03-23 2:58 ` pinskia at gcc dot gnu dot org
@ 2004-03-23 14:28 ` law at redhat dot com
2004-03-26 21:58 ` dje at gcc dot gnu dot org
` (9 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: law at redhat dot com @ 2004-03-23 14:28 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From law at redhat dot com 2004-03-23 14:28 -------
Subject: Re: [tree-ssa] error: Invalid operand to
binary operator
In message <20040323025330.29184.qmail@sources.redhat.com>, "pinskia at gcc dot
gnu dot org" writes:
>
>------- Additional Comments From pinskia at gcc dot gnu dot org 2004-03-23 0
>2:53 -------
>This should be critical because it shows up in PR 8361: if ((long int)__n_7 <
> 0) goto <L1>
>; else goto <L2>;
I know it affects 8361 -- that's how I found out about it in the first
place! :-)
jeff
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14682
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug optimization/14682] [tree-ssa] error: Invalid operand to binary operator
2004-03-22 19:38 [Bug c/14682] New: error: Invalid operand to binary operator aj at gcc dot gnu dot org
` (13 preceding siblings ...)
2004-03-23 14:28 ` law at redhat dot com
@ 2004-03-26 21:58 ` dje at gcc dot gnu dot org
2004-03-27 12:31 ` steven at gcc dot gnu dot org
` (8 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: dje at gcc dot gnu dot org @ 2004-03-26 21:58 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dje at gcc dot gnu dot org 2004-03-26 21:58 -------
A similar error breaks bootstrap on PPC32 AIX after the March 25/26 merge:
/k42/dje/build/powerpc-ibm-aix5.1.0.0-20040326/powerpc-ibm-aix5.1.0.0/pthread/li
bstdc++-v3/include/ext/pool_allocator.h: In member function `_Tp* __gnu_cxx::__p
ool_alloc<_Tp>::allocate(size_t, const void*) [with _Tp = wchar_t]':
/k42/dje/build/powerpc-ibm-aix5.1.0.0-20040326/powerpc-ibm-aix5.1.0.0/pthread/li
bstdc++-v3/include/ext/pool_allocator.h:299: error: Invalid operand to binary op
erator
(long int<D5>)__n<D15188>_17;
/k42/dje/build/powerpc-ibm-aix5.1.0.0-20040326/powerpc-ibm-aix5.1.0.0/pthread/li
bstdc++-v3/include/ext/pool_allocator.h:299: internal compiler error: verify_stm
ts failed.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14682
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug optimization/14682] [tree-ssa] error: Invalid operand to binary operator
2004-03-22 19:38 [Bug c/14682] New: error: Invalid operand to binary operator aj at gcc dot gnu dot org
` (14 preceding siblings ...)
2004-03-26 21:58 ` dje at gcc dot gnu dot org
@ 2004-03-27 12:31 ` steven at gcc dot gnu dot org
2004-03-28 0:54 ` dnovillo at gcc dot gnu dot org
` (7 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-03-27 12:31 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From steven at gcc dot gnu dot org 2004-03-27 12:31 -------
This breaks bootstrap at least PPC32 and Cygwin since the latest merge.
--
What |Removed |Added
----------------------------------------------------------------------------
Priority|P2 |P1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14682
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug optimization/14682] [tree-ssa] error: Invalid operand to binary operator
2004-03-22 19:38 [Bug c/14682] New: error: Invalid operand to binary operator aj at gcc dot gnu dot org
` (15 preceding siblings ...)
2004-03-27 12:31 ` steven at gcc dot gnu dot org
@ 2004-03-28 0:54 ` dnovillo at gcc dot gnu dot org
2004-04-01 17:32 ` law at redhat dot com
` (6 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: dnovillo at gcc dot gnu dot org @ 2004-03-28 0:54 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dnovillo at gcc dot gnu dot org 2004-03-28 00:54 -------
law is working on a fix.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |law at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14682
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug optimization/14682] [tree-ssa] error: Invalid operand to binary operator
2004-03-22 19:38 [Bug c/14682] New: error: Invalid operand to binary operator aj at gcc dot gnu dot org
` (16 preceding siblings ...)
2004-03-28 0:54 ` dnovillo at gcc dot gnu dot org
@ 2004-04-01 17:32 ` law at redhat dot com
2004-04-01 17:40 ` law at gcc dot gnu dot org
` (5 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: law at redhat dot com @ 2004-04-01 17:32 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From law at redhat dot com 2004-04-01 17:32 -------
Subject: Re: [tree-ssa] error: Invalid operand to
binary operator
In message <20040322221127.1513.qmail@sources.redhat.com>, "pinskia at gcc dot
gnu dot org" writes:
>
>------- Additional Comments From pinskia at gcc dot gnu dot org 2004-03-22 2
>2:11 -------
>Here is a version which uses char instead of long/long long's:
>int __atomic_readv_replacement(unsigned char iov_len, int count, int i) {
> unsigned char bytes = 0;
> if ((unsigned char)((char)127 - bytes) < iov_len)
> return 22;
> return 0;
>}
>
>The problem is that fold is converting 127 < iov_len into (char)( iov_len) <
> 0 which is right but it is not gimple.
Correct. This is the fault of fold_relational_hi_lo (and it's one of the
reasons why I suggested to Kazu that he not try and merge it back to the
mainline). I've got a hack which disables this behavior when we're in gimple
form (Richard -- any progress on rewriting the folder around the design we
discussed a couple weeks ago?)
Additionally, I noticed that fold_stmt in tree-ssa-ccp.c was not checking
return values as closely as it should. I fixed that too.
Finally, while working on improving the way we handle updating the SSA
graph after jump threading I noticed two places where we could stop walking
down the list of PHI nodes when we really should have kept going. I haven't
been able to trigger a real failure due to this bug, but it clearly needs
to be fixed.
Bootstrapped and regression tested on i686-pc-linux-gnu. I'll check in the
simplified testcase fir 14682 shortly.
* fold-const.c (fold_relational_hi_lo): Do not return non-gimple
code when we are in gimple form.
* tree-optimize.c (tree_rest_of_compilation): Note when we are in
gimple form.
* tree-ssa-ccp.c (ccp_fold): Tighten tests on return value from
nondestructive_fold_{unary,binary}to_constant.
* tree.h (in_gimple_form): Declare.
* tree-ssa.c (ssa_remove_edge): Correct looping structure.
(ssa_redirect_edge): Similarly
Index: fold-const.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v
retrieving revision 1.213.2.82
diff -c -p -r1.213.2.82 fold-const.c
*** fold-const.c 26 Mar 2004 16:22:07 -0000 1.213.2.82
--- fold-const.c 1 Apr 2004 17:03:59 -0000
*************** fold_relational_hi_lo (enum tree_code *c
*** 9072,9077 ****
--- 9072,9084 ----
TREE_TYPE (exp),
TREE_OPERAND (exp, 0),
TREE_OPERAND (exp, 1));
+
+ /* If we are in gimple form, then returning EXP would create
+ non-gimple expressions. Clearing it is safe and insures
+ we do not allow a non-gimple expression to escape. */
+ if (in_gimple_form)
+ exp = NULL;
+
return (retval ? retval : exp);
}
}
Index: tree-optimize.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-optimize.c,v
retrieving revision 1.1.4.135
diff -c -p -r1.1.4.135 tree-optimize.c
*** tree-optimize.c 26 Mar 2004 16:22:28 -0000 1.1.4.135
--- tree-optimize.c 1 Apr 2004 17:04:01 -0000
*************** Boston, MA 02111-1307, USA. */
*** 52,57 ****
--- 52,58 ----
/* Global variables used to communicate with passes. */
int dump_flags;
bitmap vars_to_rename;
+ bool in_gimple_form;
/* The root of the compilation pass tree, once constructed. */
static struct tree_opt_pass *all_passes;
*************** tree_rest_of_compilation (tree fndecl, b
*** 522,529 ****
--- 523,537 ----
}
}
+ /* Note that the folders should only create gimple expressions.
+ This is a hack until the new folder is ready. */
+ in_gimple_form = 1;
+
/* Perform all tree transforms and optimizations. */
execute_pass_list (all_passes);
+
+ /* Note that the folders can create non-gimple expressions again. */
+ in_gimple_form = 1;
/* If the function has a variably modified type, there may be
SAVE_EXPRs in the parameter types. Their context must be set to
Index: tree-ssa-ccp.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-ccp.c,v
retrieving revision 1.1.2.148
diff -c -p -r1.1.2.148 tree-ssa-ccp.c
*** tree-ssa-ccp.c 16 Mar 2004 22:31:55 -0000 1.1.2.148
--- tree-ssa-ccp.c 1 Apr 2004 17:04:04 -0000
*************** ccp_fold (tree stmt)
*** 806,811 ****
--- 806,816 ----
TREE_TYPE (rhs),
op0);
+ /* If we folded, but did not create an invariant, then we can not
+ use this expression. */
+ if (retval && ! is_gimple_min_invariant (retval))
+ return NULL;
+
/* If we could not fold the expression, but the arguments are all
constants and gimple values, then build and return the new
expression.
*************** ccp_fold (tree stmt)
*** 854,859 ****
--- 859,869 ----
TREE_TYPE (rhs),
op0, op1);
+ /* If we folded, but did not create an invariant, then we can not
+ use this expression. */
+ if (retval && ! is_gimple_min_invariant (retval))
+ return NULL;
+
/* If we could not fold the expression, but the arguments are all
constants and gimple values, then build and return the new
expression.
Index: tree-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa.c,v
retrieving revision 1.1.4.216
diff -c -p -r1.1.4.216 tree-ssa.c
*** tree-ssa.c 19 Mar 2004 02:07:25 -0000 1.1.4.216
--- tree-ssa.c 1 Apr 2004 17:04:06 -0000
*************** Boston, MA 02111-1307, USA. */
*** 53,63 ****
void
ssa_remove_edge (edge e)
{
! tree phi;
/* Remove the appropriate PHI arguments in E's destination block. */
! for (phi = phi_nodes (e->dest); phi; phi = TREE_CHAIN (phi))
! remove_phi_arg (phi, e->src);
remove_edge (e);
}
--- 53,66 ----
void
ssa_remove_edge (edge e)
{
! tree phi, next;
/* Remove the appropriate PHI arguments in E's destination block. */
! for (phi = phi_nodes (e->dest); phi; phi = next)
! {
! next = TREE_CHAIN (phi);
! remove_phi_arg (phi, e->src);
! }
remove_edge (e);
}
*************** ssa_remove_edge (edge e)
*** 69,82 ****
edge
ssa_redirect_edge (edge e, basic_block dest)
{
! tree phi;
tree list = NULL, *last = &list;
tree src, dst, node;
int i;
/* Remove the appropriate PHI arguments in E's destination block. */
! for (phi = phi_nodes (e->dest); phi; phi = TREE_CHAIN (phi))
{
i = phi_arg_from_edge (phi, e);
if (i < 0)
continue;
--- 72,87 ----
edge
ssa_redirect_edge (edge e, basic_block dest)
{
! tree phi, next;
tree list = NULL, *last = &list;
tree src, dst, node;
int i;
/* Remove the appropriate PHI arguments in E's destination block. */
! for (phi = phi_nodes (e->dest); phi; phi = next)
{
+ next = TREE_CHAIN (phi);
+
i = phi_arg_from_edge (phi, e);
if (i < 0)
continue;
Index: tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.h,v
retrieving revision 1.342.2.180
diff -c -p -r1.342.2.180 tree.h
*** tree.h 26 Mar 2004 16:22:30 -0000 1.342.2.180
--- tree.h 1 Apr 2004 17:04:12 -0000
*************** typedef enum
*** 3757,3761 ****
--- 3757,3766 ----
extern int tree_node_counts[];
extern int tree_node_sizes[];
+
+ /* True if we are in gimple form and the actions of the folders need to
+ be restricted. False if we are not in gimple form and folding is not
+ restricted to creating gimple expressions. */
+ extern bool in_gimple_form;
#endif /* GCC_TREE_H */
jeff
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14682
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug optimization/14682] [tree-ssa] error: Invalid operand to binary operator
2004-03-22 19:38 [Bug c/14682] New: error: Invalid operand to binary operator aj at gcc dot gnu dot org
` (17 preceding siblings ...)
2004-04-01 17:32 ` law at redhat dot com
@ 2004-04-01 17:40 ` law at gcc dot gnu dot org
2004-04-01 18:24 ` rth at redhat dot com
` (4 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: law at gcc dot gnu dot org @ 2004-04-01 17:40 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From law at gcc dot gnu dot org 2004-04-01 17:40 -------
Should be fixed by today's changes.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14682
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug optimization/14682] [tree-ssa] error: Invalid operand to binary operator
2004-03-22 19:38 [Bug c/14682] New: error: Invalid operand to binary operator aj at gcc dot gnu dot org
` (18 preceding siblings ...)
2004-04-01 17:40 ` law at gcc dot gnu dot org
@ 2004-04-01 18:24 ` rth at redhat dot com
2004-04-01 18:25 ` rth at redhat dot com
` (3 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: rth at redhat dot com @ 2004-04-01 18:24 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rth at redhat dot com 2004-04-01 18:24 -------
Subject: Re: [tree-ssa] error: Invalid operand to binary operator
On Thu, Apr 01, 2004 at 10:32:08AM -0700, law@redhat.com wrote:
> (Richard -- any progress on rewriting the folder around the design we
> discussed a couple weeks ago?)
No, not yet. :-(
r~
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14682
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug optimization/14682] [tree-ssa] error: Invalid operand to binary operator
2004-03-22 19:38 [Bug c/14682] New: error: Invalid operand to binary operator aj at gcc dot gnu dot org
` (19 preceding siblings ...)
2004-04-01 18:24 ` rth at redhat dot com
@ 2004-04-01 18:25 ` rth at redhat dot com
2004-04-01 18:40 ` law at redhat dot com
` (2 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: rth at redhat dot com @ 2004-04-01 18:25 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rth at redhat dot com 2004-04-01 18:25 -------
Subject: Re: [tree-ssa] error: Invalid operand to binary operator
On Thu, Apr 01, 2004 at 10:32:08AM -0700, law@redhat.com wrote:
> + /* Note that the folders should only create gimple expressions.
> + This is a hack until the new folder is ready. */
> + in_gimple_form = 1;
> +
> /* Perform all tree transforms and optimizations. */
> execute_pass_list (all_passes);
> +
> + /* Note that the folders can create non-gimple expressions again. */
> + in_gimple_form = 1;
Typo second time.
r~
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14682
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug optimization/14682] [tree-ssa] error: Invalid operand to binary operator
2004-03-22 19:38 [Bug c/14682] New: error: Invalid operand to binary operator aj at gcc dot gnu dot org
` (20 preceding siblings ...)
2004-04-01 18:25 ` rth at redhat dot com
@ 2004-04-01 18:40 ` law at redhat dot com
2004-04-01 18:42 ` dnovillo at redhat dot com
2004-04-01 19:01 ` law at redhat dot com
23 siblings, 0 replies; 25+ messages in thread
From: law at redhat dot com @ 2004-04-01 18:40 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From law at redhat dot com 2004-04-01 18:40 -------
Subject: Re: [tree-ssa] error: Invalid operand to
binary operator
In message <20040401182528.GB30425@redhat.com>, Richard Henderson writes:
>On Thu, Apr 01, 2004 at 10:32:08AM -0700, law@redhat.com wrote:
>> + /* Note that the folders should only create gimple expressions.
>> + This is a hack until the new folder is ready. */
>> + in_gimple_form = 1;
>> +
>> /* Perform all tree transforms and optimizations. */
>> execute_pass_list (all_passes);
>> +
>> + /* Note that the folders can create non-gimple expressions again. */
>> + in_gimple_form = 1;
>
>Typo second time.
Thanks. Brain fart. I also changed them to use true/false respectively.
jeff
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14682
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug optimization/14682] [tree-ssa] error: Invalid operand to binary operator
2004-03-22 19:38 [Bug c/14682] New: error: Invalid operand to binary operator aj at gcc dot gnu dot org
` (21 preceding siblings ...)
2004-04-01 18:40 ` law at redhat dot com
@ 2004-04-01 18:42 ` dnovillo at redhat dot com
2004-04-01 19:01 ` law at redhat dot com
23 siblings, 0 replies; 25+ messages in thread
From: dnovillo at redhat dot com @ 2004-04-01 18:42 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dnovillo at redhat dot com 2004-04-01 18:42 -------
Subject: Re: [tree-ssa] error: Invalid operand to
binary operator
On Thu, 2004-04-01 at 13:40, law at redhat dot com wrote:
> >> + /* Note that the folders should only create gimple expressions.
> >> + This is a hack until the new folder is ready. */
> >> + in_gimple_form = 1;
> >> +
> >> /* Perform all tree transforms and optimizations. */
> >> execute_pass_list (all_passes);
> >> +
> >> + /* Note that the folders can create non-gimple expressions again. */
> >> + in_gimple_form = 1;
> >
> >Typo second time.
> Thanks. Brain fart. I also changed them to use true/false respectively.
>
Oh, heh. We were all looking at the same thing then. I committed the
obvious fix a few minutes ago.
Diego.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14682
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug optimization/14682] [tree-ssa] error: Invalid operand to binary operator
2004-03-22 19:38 [Bug c/14682] New: error: Invalid operand to binary operator aj at gcc dot gnu dot org
` (22 preceding siblings ...)
2004-04-01 18:42 ` dnovillo at redhat dot com
@ 2004-04-01 19:01 ` law at redhat dot com
23 siblings, 0 replies; 25+ messages in thread
From: law at redhat dot com @ 2004-04-01 19:01 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From law at redhat dot com 2004-04-01 19:01 -------
Subject: Re: [tree-ssa] error: Invalid operand to
binary operator
In message <20040401184237.14302.qmail@sources.redhat.com>, "dnovillo at redhat
dot com" writes:
>
>------- Additional Comments From dnovillo at redhat dot com 2004-04-01 18:42
> -------
>Subject: Re: [tree-ssa] error: Invalid operand to
> binary operator
>
>On Thu, 2004-04-01 at 13:40, law at redhat dot com wrote:
>
>> >> + /* Note that the folders should only create gimple expressions.
>> >> + This is a hack until the new folder is ready. */
>> >> + in_gimple_form = 1;
>> >> +
>> >> /* Perform all tree transforms and optimizations. */
>> >> execute_pass_list (all_passes);
>> >> +
>> >> + /* Note that the folders can create non-gimple expressions again.
>*/
>> >> + in_gimple_form = 1;
>> >
>> >Typo second time.
>> Thanks. Brain fart. I also changed them to use true/false respectively.
>>
>Oh, heh. We were all looking at the same thing then. I committed the
>obvious fix a few minutes ago.
Yea, you beat me to the commit...
jeff
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14682
^ permalink raw reply [flat|nested] 25+ messages in thread