public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/38590]  New: ice: verify_gimple failed
@ 2008-12-21  2:10 regehr at cs dot utah dot edu
  2008-12-21 10:18 ` [Bug middle-end/38590] [4.4 Regression] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: regehr at cs dot utah dot edu @ 2008-12-21  2:10 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1906 bytes --]

regehr@john-home:~/volatile/tmp83$ current-gcc -c -O2 -Wall small.c
small.c: In function ‘func_75’:
small.c:3: warning: statement with no effect
small.c:1: error: type mismatch in binary expression
int

int

unsigned int

D.1235 = -1 / p_76.1;

small.c:1: internal compiler error: verify_gimple failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

regehr@john-home:~/volatile/tmp83$ cat small.c

void func_75 (int p_76) 
{
  (1 / (int) -(unsigned int)p_76) < -1 ? 1 : p_76;
}

regehr@john-home:~/volatile/tmp83$ current-gcc -v

Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../configure --program-prefix=current-
--enable-languages=c,c++ --prefix=/home/regehr : (reconfigured) ../configure
--program-prefix=current- --enable-languages=c,c++ --prefix=/home/regehr :
(reconfigured) ../configure --program-prefix=current- --enable-languages=c,c++
--prefix=/home/regehr : (reconfigured) ../configure --program-prefix=current-
--prefix=/home/regehr --enable-languages=c,c++ --no-create --no-recursion :
(reconfigured) ../configure --program-prefix=current- --prefix=/home/regehr
--enable-languages=c,c++ --no-create --no-recursion : (reconfigured)
../configure --program-prefix=current- --prefix=/home/regehr
--enable-languages=c,c++ --no-create --no-recursion
Thread model: posix
gcc version 4.4.0 20081220 (experimental) (GCC)


-- 
           Summary: ice: verify_gimple 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: 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=38590


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

* [Bug middle-end/38590] [4.4 Regression] ice: verify_gimple failed
  2008-12-21  2:10 [Bug c/38590] New: ice: verify_gimple failed regehr at cs dot utah dot edu
@ 2008-12-21 10:18 ` pinskia at gcc dot gnu dot org
  2008-12-21 18:03 ` hjl dot tools at gmail dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-21 10:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2008-12-21 10:14 -------
This is caused by the optimization which converts C/-a into -C/a for strict
overflow which is why it only happens at -O2 and above (or with
-fstrict-overflow).

Confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
          Component|c                           |middle-end
     Ever Confirmed|0                           |1
           Keywords|                            |ice-checking, ice-on-valid-
                   |                            |code
   Last reconfirmed|0000-00-00 00:00:00         |2008-12-21 10:14:51
               date|                            |
            Summary|ice: verify_gimple failed   |[4.4 Regression] ice:
                   |                            |verify_gimple failed
   Target Milestone|---                         |4.4.0
            Version|unknown                     |4.4.0


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


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

* [Bug middle-end/38590] [4.4 Regression] ice: verify_gimple failed
  2008-12-21  2:10 [Bug c/38590] New: ice: verify_gimple failed regehr at cs dot utah dot edu
  2008-12-21 10:18 ` [Bug middle-end/38590] [4.4 Regression] " pinskia at gcc dot gnu dot org
@ 2008-12-21 18:03 ` hjl dot tools at gmail dot com
  2008-12-21 19:14 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: hjl dot tools at gmail dot com @ 2008-12-21 18:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from hjl dot tools at gmail dot com  2008-12-21 18:00 -------
It is caused by revision 133479:

http://gcc.gnu.org/ml/gcc-patches/2008-03/msg01393.html


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenther at suse dot de
  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=38590


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

* [Bug middle-end/38590] [4.4 Regression] ice: verify_gimple failed
  2008-12-21  2:10 [Bug c/38590] New: ice: verify_gimple failed regehr at cs dot utah dot edu
  2008-12-21 10:18 ` [Bug middle-end/38590] [4.4 Regression] " pinskia at gcc dot gnu dot org
  2008-12-21 18:03 ` hjl dot tools at gmail dot com
@ 2008-12-21 19:14 ` pinskia at gcc dot gnu dot org
  2008-12-21 22:05 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-21 19:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2008-12-21 19:13 -------
(In reply to comment #2)
> It is caused by revision 133479:
> 
> http://gcc.gnu.org/ml/gcc-patches/2008-03/msg01393.html

Not really caused, just exposed, in fact it was caused by:
r107575 | pinskia | 2005-11-27 16:31:36 -0500 (Sun, 27 Nov 2005) | 13 lines

2005-11-27  Andrew Pinski  <pinskia@physics.uc.edu>

        PR middle-end/24575
        * fold-const.c (negate_expr_p): Add case for signed divides if overflow
        is undefined.
        (negate_expr): Likewise.
2005-11-27  Andrew Pinski  <pinskia@physics.uc.edu>

        PR middle-end/24575
        * gcc.dg/tree-ssa/divide-3.c: New test.
        * gcc.dg/tree-ssa/divide-4.c: New test.

:)

Yes it is my bug.  See sometimes pointing out the patch which exposes the ICE
is not always correct as you need to look into what the patch is doing.  The
patch which HJL pointed out is just the patch which enables the checking and
not the patch which enabled the optimization in the first place.


-- 


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


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

* [Bug middle-end/38590] [4.4 Regression] ice: verify_gimple failed
  2008-12-21  2:10 [Bug c/38590] New: ice: verify_gimple failed regehr at cs dot utah dot edu
                   ` (2 preceding siblings ...)
  2008-12-21 19:14 ` pinskia at gcc dot gnu dot org
@ 2008-12-21 22:05 ` pinskia at gcc dot gnu dot org
  2008-12-21 22:17 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-21 22:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2008-12-21 22:04 -------
Anyways I have a simple fix, just use fold_convert in some places in
fold-const.c for the folding of -A / -B into A/B.

Note it was really caused by:
r107543 | pinskia | 2005-11-26 17:18:04 -0500 (Sat, 26 Nov 2005) | 13 lines

2005-11-26  Andrew Pinski  <pinskia@physics.uc.edu>

        PR middle-end/23669
        * fold-const.c (fold_binary): Convert -A/-B to A/B for signed types
        when overflow is undefined.
2005-11-26  Andrew Pinski  <pinskia@physics.uc.edu>

        PR middle-end/23669
        * gcc.dg/tree-ssa/divide-1.c: New test.
        * gcc.dg/tree-ssa/divide-2.c: New test.

:)


-- 


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


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

* [Bug middle-end/38590] [4.4 Regression] ice: verify_gimple failed
  2008-12-21  2:10 [Bug c/38590] New: ice: verify_gimple failed regehr at cs dot utah dot edu
                   ` (3 preceding siblings ...)
  2008-12-21 22:05 ` pinskia at gcc dot gnu dot org
@ 2008-12-21 22:17 ` pinskia at gcc dot gnu dot org
  2008-12-21 22:30 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-21 22:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2008-12-21 22:16 -------
The obvious patch which I am testing right now:
Index: fold-const.c
===================================================================
--- fold-const.c        (revision 142867)
+++ fold-const.c        (working copy)
@@ -11678,7 +11678,7 @@ fold_binary (enum tree_code code, tree t
                                   WARN_STRICT_OVERFLOW_MISC);
          return fold_build2 (code, type,
                              fold_convert (type, TREE_OPERAND (arg0, 0)),
-                             negate_expr (arg1));
+                             fold_convert (type, negate_expr (arg1)));
        }
       if ((!INTEGRAL_TYPE_P (type) || TYPE_OVERFLOW_UNDEFINED (type))
          && TREE_CODE (arg1) == NEGATE_EXPR
@@ -11689,8 +11689,9 @@ fold_binary (enum tree_code code, tree t
                                    "when distributing negation across "
                                    "division"),
                                   WARN_STRICT_OVERFLOW_MISC);
-         return fold_build2 (code, type, negate_expr (arg0),
-                             TREE_OPERAND (arg1, 0));
+         return fold_build2 (code, type,
+                             fold_convert (type, negate_expr (arg0)),
+                             fold_convert (type, TREE_OPERAND (arg1, 0)));
        }

       /* If arg0 is a multiple of arg1, then rewrite to the fastest div


-- 


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


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

* [Bug middle-end/38590] [4.4 Regression] ice: verify_gimple failed
  2008-12-21  2:10 [Bug c/38590] New: ice: verify_gimple failed regehr at cs dot utah dot edu
                   ` (4 preceding siblings ...)
  2008-12-21 22:17 ` pinskia at gcc dot gnu dot org
@ 2008-12-21 22:30 ` pinskia at gcc dot gnu dot org
  2008-12-23 16:24 ` pinskia at gcc dot gnu dot org
  2008-12-23 16:24 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-21 22:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2008-12-21 22:28 -------
Mine.


-- 

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=38590


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

* [Bug middle-end/38590] [4.4 Regression] ice: verify_gimple failed
  2008-12-21  2:10 [Bug c/38590] New: ice: verify_gimple failed regehr at cs dot utah dot edu
                   ` (5 preceding siblings ...)
  2008-12-21 22:30 ` pinskia at gcc dot gnu dot org
@ 2008-12-23 16:24 ` pinskia at gcc dot gnu dot org
  2008-12-23 16:24 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-23 16:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pinskia at gcc dot gnu dot org  2008-12-23 16:21 -------
Fixed, thanks for the bug report.


-- 

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=38590


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

* [Bug middle-end/38590] [4.4 Regression] ice: verify_gimple failed
  2008-12-21  2:10 [Bug c/38590] New: ice: verify_gimple failed regehr at cs dot utah dot edu
                   ` (6 preceding siblings ...)
  2008-12-23 16:24 ` pinskia at gcc dot gnu dot org
@ 2008-12-23 16:24 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-23 16:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pinskia at gcc dot gnu dot org  2008-12-23 16:22 -------
Subject: Bug 38590

Author: pinskia
Date: Tue Dec 23 16:21:32 2008
New Revision: 142906

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142906
Log:
2008-12-23  Andrew Pinski  <pinski@gmail.com>

        PR middle-end/38590
        * fold-const.c (fold_binary): Call fold_convert on arguments to
        fold_build2 for negative divide optimization.

2008-12-23  Andrew Pinski  <pinskia@gmail.com>

        PR middle-end/38590
        * gcc.c-torture/compile/pr38590-1.c: New testcase.
        * gcc.c-torture/compile/pr38590-2.c: New testcase.


Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr38590-1.c
    trunk/gcc/testsuite/gcc.c-torture/compile/pr38590-2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

end of thread, other threads:[~2008-12-23 16:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-21  2:10 [Bug c/38590] New: ice: verify_gimple failed regehr at cs dot utah dot edu
2008-12-21 10:18 ` [Bug middle-end/38590] [4.4 Regression] " pinskia at gcc dot gnu dot org
2008-12-21 18:03 ` hjl dot tools at gmail dot com
2008-12-21 19:14 ` pinskia at gcc dot gnu dot org
2008-12-21 22:05 ` pinskia at gcc dot gnu dot org
2008-12-21 22:17 ` pinskia at gcc dot gnu dot org
2008-12-21 22:30 ` pinskia at gcc dot gnu dot org
2008-12-23 16:24 ` pinskia at gcc dot gnu dot org
2008-12-23 16:24 ` 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).