Bug 44546 - [4.5/4.6 Regression] ICE in extract_insn, at recog.c:2103 with -ffast-math -Os (compiling graphviz)
Summary: [4.5/4.6 Regression] ICE in extract_insn, at recog.c:2103 with -ffast-math -O...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: 4.5.1
Assignee: Uroš Bizjak
URL: http://gcc.gnu.org/ml/gcc-patches/201...
Keywords:
: 44700 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-06-15 16:23 UTC by J Farkas
Modified: 2010-06-28 17:39 UTC (History)
4 users (show)

See Also:
Host: i586-pc-linux-gnu
Target: i586-pc-linux-gnu
Build: i586-pc-linux-gnu
Known to work: 4.3.2
Known to fail: 4.5.0 4.6.0
Last reconfirmed: 2010-06-15 18:07:45


Attachments
Original preprocessed source (32.48 KB, application/octet-stream)
2010-06-15 16:26 UTC, J Farkas
Details
Original compilation log with -v (1.47 KB, text/plain)
2010-06-15 16:26 UTC, J Farkas
Details
Proposed patch (1.27 KB, patch)
2010-06-20 16:59 UTC, Uroš Bizjak
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description J Farkas 2010-06-15 16:23:01 UTC
libtool: compile:  gcc -v -save-temps -DHAVE_CONFIG_H -I. -I../.. -I../.. -I../../lib/common -I../../lib/gvc -I../../lib/pack -I../../lib/ortho -I../../lib/pathplan -I../../lib/graph -I../../lib/sparse -I../../lib/rbtree -I../../lib/sfdpgen -I../../lib/cdt -Os -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wall -ffast-math -MT stress.lo -MD -MP -MF .deps/stress.Tpo -c stress.c  -fPIC -DPIC -o .libs/stress.o
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i586-pc-linux-gnu/4.5.0/lto-wrapper
Target: i586-pc-linux-gnu
Configured with: ..//configure --prefix=/usr --libexecdir=/usr/lib --enable-shared --with-system-zlib --enable-languages=c,c++,objc,java,ada,fortran --enable-threads --enable-__cxa_atexit --enable-clocale=gnu --enable-libada --enable-shared --with-ecj-jar=/usr/share/java/ecj.jar i586-pc-linux-gnu
Thread model: posix
gcc version 4.5.0 (GCC)
...
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-DHAVE_CONFIG_H' '-I.' '-I../..' '-I../..' '-I../../lib/common' '-I../../lib/gvc' '-I../../lib/pack' '-I../../lib/ortho' '-I../../lib/pathplan' '-I../../lib/graph' '-I../../lib/sparse' '-I../../lib/rbtree' '-I../../lib/sfdpgen' '-I../../lib/cdt' '-Os' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-Wno-unknown-pragmas' '-Wstrict-prototypes' '-Wpointer-arith' '-Wall' '-ffast-math' '-MT' 'stress.lo' '-MD' '-MP' '-MF' '.deps/stress.Tpo' '-c' '-fPIC' '-DPIC' '-o' '.libs/stress.o' '-mtune=pentium' '-march=pentium'
 /usr/lib/gcc/i586-pc-linux-gnu/4.5.0/cc1 -fpreprocessed stress.i -quiet -dumpbase stress.c -mtune=pentium -march=pentium -auxbase-strip .libs/stress.o -Os -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wall -version -ffast-math -fPIC -o stress.s
GNU C (GCC) version 4.5.0 (i586-pc-linux-gnu)
        compiled by GNU C version 4.5.0, GMP version 5.0.1, MPFR version 2.4.2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=127922
GNU C (GCC) version 4.5.0 (i586-pc-linux-gnu)
        compiled by GNU C version 4.5.0, GMP version 5.0.1, MPFR version 2.4.2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=127922
Compiler executable checksum: 7fe8daf58b4922cb9313351112738768
stress.c: In function &#65533;<80><98>mdsModel&#65533;<80><99>:
stress.c:1373:12: warning: &#65533;<80><98>delta&#65533;<80><99> may be used uninitialized in this function
stress.c: In function &#65533;<80><98>compute_apsp_artifical_weights_packed&#65533;<80><99>:
stress.c:1494:1: error: unrecognizable insn:
(jump_insn 445 444 315 11 stress.c:1454 (set (pc)
        (if_then_else (lt (reg:CCFP 17 flags)
                (const_int 0 [0x0]))
            (label_ref:SI 303)
            (pc))) -1 (expr_list:REG_BR_PROB (const_int 2900 [0xb54])
        (nil))
 -> 303)
stress.c:1494:1: internal compiler error: in extract_insn, at recog.c:2103
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 J Farkas 2010-06-15 16:26:08 UTC
Created attachment 20918 [details]
Original preprocessed source
Comment 2 J Farkas 2010-06-15 16:26:59 UTC
Created attachment 20919 [details]
Original compilation log with -v
Comment 3 J Farkas 2010-06-15 16:31:19 UTC
/* minimal source showing (hopefully) the same ICE */
typedef struct { float *ewgts; } vtx_data; 
extern int whatever(vtx_data *);
float *compute_apsp_artifical_weights_packed (vtx_data * graph, int n)
{
  float *weights;

  weights = (float *) zmalloc (n * sizeof (float));
  weights[n] =
    whatever(graph) > graph[n].ewgts[n] ?
    whatever(graph) : graph[n].ewgts[n];
}

/* gcc -v -save-temps -Os -ffast-math ffmos.c */

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i586-pc-linux-gnu/4.5.0/lto-wrapper
Target: i586-pc-linux-gnu
Configured with: ..//configure --prefix=/usr --libexecdir=/usr/lib --enable-shared --with-system-zlib --enable-languages=c,c++,objc,java,ada,fortran --enable-threads --enable-__cxa_atexit --enable-clocale=gnu --enable-libada --enable-shared --with-ecj-jar=/usr/share/java/ecj.jar i586-pc-linux-gnu
Thread model: posix
gcc version 4.5.0 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Os' '-ffast-math' '-c' '-mtune=pentium' '-march=pentium'
 /usr/lib/gcc/i586-pc-linux-gnu/4.5.0/cc1 -E -quiet -v ffmos.c -mtune=pentium -march=pentium -ffast-math -Os -fpch-preprocess -o ffmos.i
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/lib/gcc/i586-pc-linux-gnu/4.5.0/../../../../i586-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/i586-pc-linux-gnu/4.5.0/include
 /usr/lib/gcc/i586-pc-linux-gnu/4.5.0/include-fixed
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Os' '-ffast-math' '-c' '-mtune=pentium' '-march=pentium'
 /usr/lib/gcc/i586-pc-linux-gnu/4.5.0/cc1 -fpreprocessed ffmos.i -quiet -dumpbase ffmos.c -mtune=pentium -march=pentium -auxbase ffmos -Os -version -ffast-math -o ffmos.s
GNU C (GCC) version 4.5.0 (i586-pc-linux-gnu)
	compiled by GNU C version 4.5.0, GMP version 5.0.1, MPFR version 2.4.2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=127922
GNU C (GCC) version 4.5.0 (i586-pc-linux-gnu)
	compiled by GNU C version 4.5.0, GMP version 5.0.1, MPFR version 2.4.2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=127922
Compiler executable checksum: 7fe8daf58b4922cb9313351112738768
ffmos.c: In function &#8216;compute_apsp_artifical_weights_packed&#8217;:
ffmos.c:12:1: error: unrecognizable insn:
(jump_insn 59 58 47 2 ffmos.c:11 (set (pc)
        (if_then_else (lt (reg:CCFP 17 flags)
                (const_int 0 [0x0]))
            (label_ref:SI 45)
            (pc))) -1 (expr_list:REG_BR_PROB (const_int 2071 [0x817])
        (nil))
 -> 45)
ffmos.c:12:1: internal compiler error: in extract_insn, at recog.c:2103
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 4 H.J. Lu 2010-06-15 18:07:45 UTC
It is caused by revision 149035:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44546
Comment 5 Uroš Bizjak 2010-06-15 18:09:46 UTC
Confirmed.

bbro pass is blindly changing:

(jump_insn 55 57 23 2 pr44546.c:10 (set (pc)
        (if_then_else (unle (reg:CCFP 17 flags)
                (const_int 0 [0]))
            (label_ref:SI 28)
            (pc))) 576 {*jcc_1} (expr_list:REG_DEAD (reg:CCFP 17 flags)
        (expr_list:REG_BR_PROB (const_int 7929 [0x1ef9])
            (nil)))
to

(jump_insn 55 57 28 2 pr44546.c:10 (set (pc)
        (if_then_else (gt (reg:CCFP 17 flags)
                (const_int 0 [0]))
            (label_ref:SI 89)
            (pc))) 576 {*jcc_1} (expr_list:REG_DEAD (reg:CCFP 17 flags)
        (expr_list:REG_BR_PROB (const_int 2071 [0x817])
            (nil)))

This is not valid insn, since GT condition does not satisfy ix86_trivial_fp_comparison_operator predicate.
Comment 6 Uroš Bizjak 2010-06-15 18:16:37 UTC
(In reply to comment #5)

> bbro pass is blindly changing:

Ooops, scrap this. Post-reload splitter is splitting in a wrong way.
Comment 7 Uroš Bizjak 2010-06-20 16:59:45 UTC
Created attachment 20946 [details]
Proposed patch

Patch in testing.
Comment 8 Uroš Bizjak 2010-06-20 21:37:57 UTC
Patch at http://gcc.gnu.org/ml/gcc-patches/2010-06/msg01973.html
Comment 9 uros 2010-06-20 21:42:22 UTC
Subject: Bug 44546

Author: uros
Date: Sun Jun 20 21:42:10 2010
New Revision: 161055

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=161055
Log:
	PR target/44546
	* config/i386/predicates.md (ix86_swapped_fp_comparsion_operator):
	New predicate.
	* config/i386/i386.md (*fp_jcc_8<mode>_387): Use
	ix86_swapped_fp_comparsion_operator instead of
	ix86_fp_comparison_operator.

	(*fp_jcc_1_387): Rename from *fp_jcc_3_387.
	(*fp_jcc_1r_387): Rename from *fp_jcc_4_387.
	(*fp_jcc_2_387): Rename from *fp_jcc_5_387.
	(*fp_jcc_2r_387): Rename from *fp_jcc_6_387.
	(*fp_jcc_3_387): Rename from *fp_jcc_7_387.
	(*fp_jcc_4_<mode>_387): Rename from *fp_jcc_8<mode>_387.

testsuite/ChangeLog:

	PR target/44546
	* gcc.target/i386/pr44546.c: New test.


Added:
    trunk/gcc/testsuite/gcc.target/i386/pr44546.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.md
    trunk/gcc/config/i386/predicates.md
    trunk/gcc/testsuite/ChangeLog

Comment 10 uros 2010-06-21 14:52:23 UTC
Subject: Bug 44546

Author: uros
Date: Mon Jun 21 14:52:07 2010
New Revision: 161085

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=161085
Log:
	PR target/44546
	* config/i386/predicates.md (ix86_swapped_fp_comparsion_operator):
	New predicate.
	* config/i386/i386.md (*fp_jcc_8<mode>_387 and splitters): Use
	ix86_swapped_fp_comparsion_operator instead of
	ix86_fp_comparison_operator.

	(*fp_jcc_1_387): Rename from *fp_jcc_3_387.
	(*fp_jcc_1r_387): Rename from *fp_jcc_4_387.
	(*fp_jcc_2_387): Rename from *fp_jcc_5_387.
	(*fp_jcc_2r_387): Rename from *fp_jcc_6_387.
	(*fp_jcc_3_387): Rename from *fp_jcc_7_387.
	(*fp_jcc_4_<mode>_387): Rename from *fp_jcc_8<mode>_387.

testsuite/ChangeLog:

	PR target/44546
	* gcc.target/i386/pr44546.c: New test.


Added:
    branches/gcc-4_5-branch/gcc/testsuite/gcc.target/i386/pr44546.c
Modified:
    branches/gcc-4_5-branch/gcc/ChangeLog
    branches/gcc-4_5-branch/gcc/config/i386/i386.md
    branches/gcc-4_5-branch/gcc/config/i386/predicates.md
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog

Comment 11 Uroš Bizjak 2010-06-21 14:53:33 UTC
Fixed.
Comment 12 Andrew Pinski 2010-06-28 17:39:57 UTC
*** Bug 44700 has been marked as a duplicate of this bug. ***