[Bug rtl-optimization/39779] ICE shifting byte to the right with constant > 7FFFFFFF

2009-09-23 Thread uros at gcc dot gnu dot org


--- Comment #14 from uros at gcc dot gnu dot org  2009-09-23 10:19 ---
Subject: Bug 39779

Author: uros
Date: Wed Sep 23 10:18:46 2009
New Revision: 152066

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152066
Log:
PR c/39779
* c-typeck.c (build_binary_op) : Check that integer
constant is more than zero.

testsuite/ChangeLog:

PR c/39779
* gcc.c-torture/compile/pr39779.c: New test.


Added:
branches/gcc-4_3-branch/gcc/testsuite/gcc.c-torture/compile/pr39779.c
Modified:
branches/gcc-4_3-branch/gcc/ChangeLog
branches/gcc-4_3-branch/gcc/c-typeck.c
branches/gcc-4_3-branch/gcc/testsuite/ChangeLog


-- 


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



[Bug rtl-optimization/39779] ICE shifting byte to the right with constant > 7FFFFFFF

2009-09-23 Thread uros at gcc dot gnu dot org


--- Comment #13 from uros at gcc dot gnu dot org  2009-09-23 09:37 ---
Subject: Bug 39779

Author: uros
Date: Wed Sep 23 09:37:25 2009
New Revision: 152064

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152064
Log:
PR c/39779
* c-typeck.c (build_binary_op) : Check that integer
constant is more than zero.

testsuite/ChangeLog:

PR c/39779
* gcc.c-torture/compile/pr39779.c: New test.


Added:
branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr39779.c
Modified:
branches/gcc-4_4-branch/gcc/ChangeLog
branches/gcc-4_4-branch/gcc/c-typeck.c
branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


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



[Bug rtl-optimization/39779] ICE shifting byte to the right with constant > 7FFFFFFF

2009-09-22 Thread uros at gcc dot gnu dot org


--- Comment #12 from uros at gcc dot gnu dot org  2009-09-23 06:44 ---
Subject: Bug 39779

Author: uros
Date: Wed Sep 23 06:43:56 2009
New Revision: 152058

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152058
Log:
PR c/39779
* c-typeck.c (build_binary_op) : Check that integer
constant is more than zero.

testsuite/ChangeLog:

PR c/39779
* gcc.c-torture/compile/pr39779.c: New test.


Added:
trunk/gcc/testsuite/gcc.c-torture/compile/pr39779.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/c-typeck.c
trunk/gcc/testsuite/ChangeLog


-- 


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



[Bug rtl-optimization/39779] ICE shifting byte to the right with constant > 7FFFFFFF

2009-09-21 Thread ubizjak at gmail dot com


--- Comment #11 from ubizjak at gmail dot com  2009-09-21 13:02 ---
Another week, another patch in testing:

Index: c-typeck.c
===
--- c-typeck.c  (revision 151915)
+++ c-typeck.c  (working copy)
@@ -9465,6 +9465,7 @@ build_binary_op (location_t location, en
unsigned_arg = TYPE_UNSIGNED (TREE_TYPE (op0));

  if (TYPE_PRECISION (TREE_TYPE (arg0)) < TYPE_PRECISION (result_type)
+ && int_fits_type_p (op1, TREE_TYPE (arg0))
  /* We can shorten only if the shift count is less than the
 number of bits in the smaller type size.  */
  && compare_tree_int (op1, TYPE_PRECISION (TREE_TYPE (arg0))) < 0


-- 


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



[Bug rtl-optimization/39779] ICE shifting byte to the right with constant > 7FFFFFFF

2009-09-11 Thread ubizjak at gmail dot com


--- Comment #10 from ubizjak at gmail dot com  2009-09-11 11:22 ---
(In reply to comment #9)
> That's because Uros didn't actually revert the testcase together with the
> reversion of the patch (only testsuite/ChangeLog says so).

Eh, done now.


-- 


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



[Bug rtl-optimization/39779] ICE shifting byte to the right with constant > 7FFFFFFF

2009-09-11 Thread jakub at gcc dot gnu dot org


--- Comment #9 from jakub at gcc dot gnu dot org  2009-09-11 10:45 ---
That's because Uros didn't actually revert the testcase together with the
reversion of the patch (only testsuite/ChangeLog says so).


-- 

jakub at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||uros at gcc dot gnu dot org


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



[Bug rtl-optimization/39779] ICE shifting byte to the right with constant > 7FFFFFFF

2009-09-11 Thread howarth at nitro dot med dot uc dot edu


--- Comment #8 from howarth at nitro dot med dot uc dot edu  2009-09-11 
09:55 ---
Using built-in specs.
Target: x86_64-apple-darwin10
Configured with: ../gcc-4.5-20090910/configure --prefix=/sw
--prefix=/sw/lib/gcc4.5 --mandir=/sw/share/man --infodir=/sw/share/info
--enable-languages=c,c++,fortran,objc,java --with-gmp=/sw
--with-libiconv-prefix=/sw --with-ppl=/sw --with-cloog=/sw --with-system-zlib
--x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib
--disable-libjava-multilib --build=x86_64-apple-darwin10
--host=x86_64-apple-darwin10 --target=x86_64-apple-darwin10
Thread model: posix
gcc version 4.5.0 20090911 (experimental) (GCC) 


-- 


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



[Bug rtl-optimization/39779] ICE shifting byte to the right with constant > 7FFFFFFF

2009-09-11 Thread howarth at nitro dot med dot uc dot edu


--- Comment #7 from howarth at nitro dot med dot uc dot edu  2009-09-11 
09:54 ---
The pr39779.c test case is ICEing the compiler in gcc trunk on
x86_64-apple-darwin10 at r151625 as follows...

Executing on host:
/sw/src/fink.build/gcc45-4.4.999-20090910/darwin_objdir/gcc/xgcc
-B/sw/src/fink.build/gcc45-4.4.999-20090910/darwin_objdir/gcc/
/sw/src/fink.build/gcc45-4.4.999-20090910/gcc-4.5-20090910/gcc/testsuite/gcc.dg/pr39779.c
  -w -S  -o pr39779.s(timeout = 300)
/sw/src/fink.build/gcc45-4.4.999-20090910/gcc-4.5-20090910/gcc/testsuite/gcc.dg/pr39779.c:
In function 'test':
/sw/src/fink.build/gcc45-4.4.999-20090910/gcc-4.5-20090910/gcc/testsuite/gcc.dg/pr39779.c:8:1:
error: unrecognizable insn:
(insn 7 6 8 3
/sw/src/fink.build/gcc45-4.4.999-20090910/gcc-4.5-20090910/gcc/testsuite/gcc.dg/pr39779.c:6
(set (reg:QI 61)
(const_int -557921043 [0xdebecced])) -1 (nil))
/sw/src/fink.build/gcc45-4.4.999-20090910/gcc-4.5-20090910/gcc/testsuite/gcc.dg/pr39779.c:8:1:
internal compiler error: in extract_insn, at recog.c:2093
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.
compiler exited with status 1
output is:
/sw/src/fink.build/gcc45-4.4.999-20090910/gcc-4.5-20090910/gcc/testsuite/gcc.dg/pr39779.c:
In function 'test':
/sw/src/fink.build/gcc45-4.4.999-20090910/gcc-4.5-20090910/gcc/testsuite/gcc.dg/pr39779.c:8:1:
error: unrecognizable insn:
(insn 7 6 8 3
/sw/src/fink.build/gcc45-4.4.999-20090910/gcc-4.5-20090910/gcc/testsuite/gcc.dg/pr39779.c:6
(set (reg:QI 61)
(const_int -557921043 [0xdebecced])) -1 (nil))
/sw/src/fink.build/gcc45-4.4.999-20090910/gcc-4.5-20090910/gcc/testsuite/gcc.dg/pr39779.c:8:1:
internal compiler error: in extract_insn, at recog.c:2093
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.

FAIL: gcc.dg/pr39779.c (internal compiler error)
FAIL: gcc.dg/pr39779.c (test for excess errors)
Excess errors:
/sw/src/fink.build/gcc45-4.4.999-20090910/gcc-4.5-20090910/gcc/testsuite/gcc.dg/pr39779.c:8:1:
error: unrecognizable insn:
(insn 7 6 8 3
/sw/src/fink.build/gcc45-4.4.999-20090910/gcc-4.5-20090910/gcc/testsuite/gcc.dg/pr39779.c:6
(set (reg:QI 61)
(const_int -557921043 [0xdebecced])) -1 (nil))
/sw/src/fink.build/gcc45-4.4.999-20090910/gcc-4.5-20090910/gcc/testsuite/gcc.dg/pr39779.c:8:1:
internal compiler error: in extract_insn, at recog.c:2093


-- 


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



[Bug rtl-optimization/39779] ICE shifting byte to the right with constant > 7FFFFFFF

2009-09-10 Thread ubizjak at gmail dot com


-- 

ubizjak at gmail dot com changed:

   What|Removed |Added

 AssignedTo|ubizjak at gmail dot com|unassigned at gcc dot gnu
   ||dot org
 Status|ASSIGNED|NEW


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



[Bug rtl-optimization/39779] ICE shifting byte to the right with constant > 7FFFFFFF

2009-09-10 Thread uros at gcc dot gnu dot org


--- Comment #6 from uros at gcc dot gnu dot org  2009-09-10 15:15 ---
Subject: Bug 39779

Author: uros
Date: Thu Sep 10 15:14:39 2009
New Revision: 151596

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=151596
Log:
Revert:
2009-09-09  Uros Bizjak  

PR rtl-optimization/39779
* expr.c (convert_modes): Return when mode == oldmode after
CONST_INTs are processed.

testsuite/ChangeLog:

Revert:
2009-09-09  Uros Bizjak 

PR rtl-optimization/39779
* gcc.dg/pr39979.c: New test.


Modified:
trunk/gcc/ChangeLog
trunk/gcc/expr.c
trunk/gcc/testsuite/ChangeLog


-- 


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



[Bug rtl-optimization/39779] ICE shifting byte to the right with constant > 7FFFFFFF

2009-09-09 Thread uros at gcc dot gnu dot org


--- Comment #5 from uros at gcc dot gnu dot org  2009-09-09 19:25 ---
Subject: Bug 39779

Author: uros
Date: Wed Sep  9 19:25:31 2009
New Revision: 151573

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=151573
Log:
PR rtl-optimization/39779
* expr.c (convert_modes): Return when mode == oldmode after
CONST_INTs are processed.

testsuite/ChangeLog:

PR rtl-optimization/39779
* gcc.dg/pr39979.c: New test.


Added:
trunk/gcc/testsuite/gcc.dg/pr39779.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/expr.c
trunk/gcc/testsuite/ChangeLog


-- 


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



[Bug rtl-optimization/39779] ICE shifting byte to the right with constant > 7FFFFFFF

2009-09-08 Thread ubizjak at gmail dot com


--- Comment #4 from ubizjak at gmail dot com  2009-09-08 15:04 ---
I have (different) patch.


-- 

ubizjak at gmail dot com changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |ubizjak at gmail dot com
   |dot org |
 Status|NEW |ASSIGNED
   Last reconfirmed|2009-04-16 08:28:47 |2009-09-08 15:04:46
   date||


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



[Bug rtl-optimization/39779] ICE shifting byte to the right with constant > 7FFFFFFF

2009-04-16 Thread ubizjak at gmail dot com


--- Comment #3 from ubizjak at gmail dot com  2009-04-16 12:26 ---
This testcase fails for all optimization levels:

--cut here--
/* { dg-do compile } */
/* { dg-options "-w" } */

int test (char v1)
{
  v1 >>= 0xdebecced;
  return v1;
}
--cut here--

Follwing patch fixes the failure, but introduces several testsuite failures:

--cut here--
Index: optabs.c
===
--- optabs.c(revision 146146)
+++ optabs.c(working copy)
@@ -1478,18 +1478,10 @@ expand_binop_directly (enum machine_mode
  for their mode.  */

   if (GET_MODE (xop0) != mode0 && mode0 != VOIDmode)
-xop0 = convert_modes (mode0,
- GET_MODE (xop0) != VOIDmode
- ? GET_MODE (xop0)
- : mode,
- xop0, unsignedp);
+xop0 = convert_modes (mode0, GET_MODE (xop0), xop0, unsignedp);

   if (GET_MODE (xop1) != mode1 && mode1 != VOIDmode)
-xop1 = convert_modes (mode1,
- GET_MODE (xop1) != VOIDmode
- ? GET_MODE (xop1)
- : mode,
- xop1, unsignedp);
+xop1 = convert_modes (mode1, GET_MODE (xop1), xop1, unsignedp);

   /* If operation is commutative,
  try to make the first operand a register.
--cut here--


-- 


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



[Bug rtl-optimization/39779] ICE shifting byte to the right with constant > 7FFFFFFF

2009-04-16 Thread ubizjak at gmail dot com


--- Comment #2 from ubizjak at gmail dot com  2009-04-16 11:37 ---
It looks that convert_modes has some issues. When expanding shift RTX,
convert_modes is called from

#0  convert_modes (mode=QImode, oldmode=QImode, x=0xb7d05fe8, unsignedp=0) at
../../gcc-svn/trunk/gcc/expr.c:769
#1  0x083455ec in expand_binop_directly (mode=USQmode, binoptab=0x8a02148,
op0=, op1=0xb7d05fe8, target=0xb7d2a2d0, unsignedp=, methods=OPTAB_DIRECT, last=0xb7c8f72c) at
../../gcc-svn/trunk/gcc/optabs.c:1488
#2  0x08343389 in expand_binop (mode=QImode, binoptab=0x8a02148,
op0=0xb7d2a2e8, op1=0xb7d05fe8, target=0xb7d2a2d0, unsignedp=0,
methods=OPTAB_DIRECT) at ../../gcc-svn/trunk/gcc/optabs.c:1601
#3  0x08209c95 in expand_shift (code=RSHIFT_EXPR, mode=QImode,
shifted=0xb7d2a2e8, amount=0xb7d29ec4, target=0xb7d2a2d0, unsignedp=0) at
../../gcc-svn/trunk/gcc/expmed.c:2244

as:

convert_modes (mode=QImode, oldmode=QImode, x=0xb7d05fe8, unsignedp=0) at
../../gcc-svn/trunk/gcc/expr.c:769
(gdb) p debug_rtx (x)
(const_int -557921043 [0xdebecced])

We immediatelly hit:

  if (mode == oldmode)
return x;

so, we return "(const_int -557921043 [0xdebecced])" that doesn't satisfy QImode
constraint. The compilation goes downhill from there...

This looks like generic RTL optimization problem.


-- 

ubizjak at gmail dot com changed:

   What|Removed |Added

  Component|target  |rtl-optimization


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