Bug 10984 - x86/sse2 ICEs on vector intrinsics with constant argument
Summary: x86/sse2 ICEs on vector intrinsics with constant argument
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.3.1
: P2 normal
Target Milestone: 3.4.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code, monitored
: 7204 8600 11056 11213 11549 11647 (view as bug list)
Depends on:
Blocks: 8869
  Show dependency treegraph
 
Reported: 2003-05-26 20:19 UTC by Kimmo Fredriksson
Modified: 2003-08-23 21:56 UTC (History)
8 users (show)

See Also:
Host: i?86-*-*
Target: i?86-*-*
Build: i?86-*-*
Known to work:
Known to fail:
Last reconfirmed: 2003-07-27 22:50:34


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kimmo Fredriksson 2003-05-26 20:19:31 UTC
The following code causes ICE:

# 1 "foo.C"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "foo.C"
typedef int v2di __attribute__ ((mode(V2DI)));

int main(void)
{
        v2di a;

        a = __builtin_ia32_psllqi128( a, 1 );

        return 0;
}

> gcc -msse2 foo.C
foo.C: In function `int main()':
foo.C:7: internal compiler error: in ix86_expand_binop_builtin, at 
   config/i386/i386.c:13029
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

> gcc -v
Reading specs from
/staff/kfredrik/local/gcc-snapshot/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/specs
Configured with: ../gcc-20030519/configure
--prefix=/staff/kfredrik/local/gcc-snapshot --enable-languages=c,c++
Thread model: posix
gcc version 3.3.1 20030519 (prerelease)

The same thing happens with all optimization levels. An easy fix is to put the 
constant 1 in a variable:

        v2di    a; 
        int     i = 1;

        a = __builtin_ia32_psllqi128( a, i );

This "fixes" the bug.
Comment 1 Dara Hazeghi 2003-05-26 20:23:10 UTC
Hello,

I can confirm that this bug is still present with gcc 3.3 branch and mainline (20030524).

Dara
Comment 2 Andrew Pinski 2003-05-26 20:28:58 UTC
also happens on the mainline (20030526):

tin:~/src/gnu/gcctest>gcc pr10984.c -msse2
pr10984.c: In function `main':
pr10984.c:7: internal compiler error: in ix86_expand_binop_builtin, at config/i386/i386.c:13707
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

(gdb) bt
#0  0x4202bb8a in exit () from /lib/i686/libc.so.6
#1  0x080f1c8a in diagnostic_action_after_output (context=0x4212dc80, diagnostic=0x83) at /
home/gates/pinskia/src/gnu/gcc/src/gcc/diagnostic.c:963
#2  0x080f207c in diagnostic_report_diagnostic (context=0x84330e0, diagnostic=0xbffeba10) at 
/home/gates/pinskia/src/gnu/gcc/src/gcc/diagnostic.c:1102
#3  0x080f2521 in internal_error (msgid=0x83 <Address 0x83 out of bounds>) at /home/gates/
pinskia/src/gnu/gcc/src/gcc/diagnostic.c:1311
#4  0x080f29ef in fancy_abort (file=0x83 <Address 0x83 out of bounds>, line=1108532352, 
function=0x83 <Address 0x83 out of bounds>) at /home/gates/pinskia/src/gnu/gcc/src/gcc/
diagnostic.c:1458
#5  0x0832901c in ix86_expand_binop_builtin (icode=CODE_FOR_ashlv2di3, arglist=0x83, 
target=0x40096a30) at /home/gates/pinskia/src/gnu/gcc/src/gcc/config/i386/i386.c:13707
#6  0x080c678e in expand_builtin (exp=0x400552b8, target=0x0, subtarget=0x0, 
mode=VOIDmode, ignore=0) at /home/gates/pinskia/src/gnu/gcc/src/gcc/builtins.c:4306
#7  0x08140d6c in expand_expr (exp=0x400552b8, target=0x0, tmode=VOIDmode, 
modifier=EXPAND_NORMAL) at /home/gates/pinskia/src/gnu/gcc/src/gcc/expr.c:7832
#8  0x0812ed00 in expand_assignment (to=0x0, from=0x400552b8, want_value=0, 
suggest_reg=1) at /home/gates/pinskia/src/gnu/gcc/src/gcc/expr.c:4248
#9  0x08139de7 in expand_expr (exp=0x400552d0, target=0x0, tmode=VOIDmode, 
modifier=EXPAND_NORMAL) at /home/gates/pinskia/src/gnu/gcc/src/gcc/expr.c:9148
#10 0x082cd4b7 in expand_expr_stmt_value (exp=0x4004b210, want_value=1074404952, 
maybe_last=-1) at /home/gates/pinskia/src/gnu/gcc/src/gcc/stmt.c:2215
#11 0x0809ccb3 in genrtl_expr_stmt_value (expr=0x400552d0, want_value=0, maybe_last=0) at 
/home/gates/pinskia/src/gnu/gcc/src/gcc/c-semantics.c:367
#12 0x0809ee6f in expand_stmt (t=0x400552d0) at /home/gates/pinskia/src/gnu/gcc/src/gcc/
c-semantics.c:831
#13 0x0809e940 in genrtl_compound_stmt (t=0x4008a190) at /home/gates/pinskia/src/gnu/
gcc/src/gcc/c-semantics.c:743
#14 0x0809ee7c in expand_stmt (t=0x4008a190) at /home/gates/pinskia/src/gnu/gcc/src/gcc/
c-semantics.c:858
#15 0x0806b9bb in c_expand_body_1 (fndecl=0x400a1d14, nested_p=0) at /home/gates/
pinskia/src/gnu/gcc/src/gcc/c-decl.c:6482
#16 0x0806bf39 in c_expand_body (fndecl=0x83) at /home/gates/pinskia/src/gnu/gcc/src/gcc/
c-decl.c:6587
#17 0x0806b50b in finish_function (nested=0, can_defer_p=1) at /home/gates/pinskia/src/gnu/
gcc/src/gcc/c-decl.c:6370
#18 0x0804c683 in yyparse () at c-parse.y:407
#19 0x08097986 in c_common_parse_file (set_yydebug=131) at /home/gates/pinskia/src/gnu/
gcc/src/gcc/c-opts.c:1644
#20 0x082ddd7a in compile_file () at /home/gates/pinskia/src/gnu/gcc/src/gcc/toplev.c:2209
#21 0x082e3938 in do_compile () at /home/gates/pinskia/src/gnu/gcc/src/gcc/toplev.c:5581
#22 0x082e39a9 in toplev_main (argc=131, argv=0x0) at /home/gates/pinskia/src/gnu/gcc/src/
gcc/toplev.c:5612
#23 0x080b6e3b in main (argc=131, argv=0x83) at /home/gates/pinskia/src/gnu/gcc/src/gcc/
main.c:37
(gdb) up 5
#5  0x0832901c in ix86_expand_binop_builtin (icode=CODE_FOR_ashlv2di3, arglist=0x83, 
target=0x40096a30) at /home/gates/pinskia/src/gnu/gcc/src/gcc/config/i386/i386.c:13707
13707       abort ();
(gdb) l
13702       }
13703   
13704     /* In case the insn wants input operands in modes different from
13705        the result, abort.  */
13706     if (GET_MODE (op0) != mode0 || GET_MODE (op1) != mode1)
13707       abort ();
13708   
13709     if (! (*insn_data[icode].operand[1].predicate) (op0, mode0))
13710       op0 = copy_to_mode_reg (mode0, op0);
13711     if (! (*insn_data[icode].operand[2].predicate) (op1, mode1))
(gdb) p debug_rtx(op0)
(mem/f:V2DI (plus:SI (reg/f:SI 54 virtual-stack-vars)
        (const_int -16 [0xfffffff0])) [0 a+0 S16 A128])
$1 = void
(gdb) p debug_rtx(op1)
(??? bad code 56848
)
$2 = void
(gdb) p mode0
$3 = V2DImode
(gdb) p op1
$4 = 0xbffeba10
(gdb) p op0
$5 = 0x40087cc0
(gdb) p mode1
$6 = TImode
Comment 3 Andrew Pinski 2003-06-02 05:24:59 UTC
*** Bug 8600 has been marked as a duplicate of this bug. ***
Comment 4 Andrew Pinski 2003-06-02 05:25:23 UTC
*** Bug 7204 has been marked as a duplicate of this bug. ***
Comment 5 Andrew Pinski 2003-06-02 05:26:46 UTC
*** Bug 11056 has been marked as a duplicate of this bug. ***
Comment 6 Dara Hazeghi 2003-06-02 10:29:32 UTC
*** Bug 11057 has been marked as a duplicate of this bug. ***
Comment 7 Andrew Pinski 2003-06-17 01:51:00 UTC
*** Bug 11213 has been marked as a duplicate of this bug. ***
Comment 8 Andrew Pinski 2003-07-16 19:14:05 UTC
*** Bug 11549 has been marked as a duplicate of this bug. ***
Comment 9 Andrew Pinski 2003-07-23 18:55:36 UTC
*** Bug 11647 has been marked as a duplicate of this bug. ***
Comment 10 GCC Commits 2003-08-23 21:19:05 UTC
Subject: Bug 10984

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	hubicka@gcc.gnu.org	2003-08-23 21:18:58

Modified files:
	gcc            : expr.c ChangeLog 
	gcc/config/i386: i386.c i386.h i386.md 

Log message:
	PR target/11369
	* i386.c (ix86_expand_carry_flag_compare): Validate operand.
	
	PR target/11031
	* i386.c (const_0_to_3_operand, const_0_to_7_operand,
	const_0_to_15_operand, const_0_to_255_operand): New predicates.
	* i386.h (PREDICATE_CODES): Add these.
	* i386.c (pinsrw and pextrw patterns): Use them.
	
	PR target/10984
	* i386.c (ix86_expand_binop_builtin): Behave sanely for VOIDmodes.
	
	PR target/8869
	* expr.c (convert_modes): Deal properly with integer to vector
	constant conversion.
	
	PR target/8871
	* i386.md (zero_extendsidi2*): Add MMX and SSE alternatives.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/expr.c.diff?cvsroot=gcc&r1=1.577&r2=1.578
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.864&r2=2.865
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.c.diff?cvsroot=gcc&r1=1.595&r2=1.596
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.h.diff?cvsroot=gcc&r1=1.350&r2=1.351
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.md.diff?cvsroot=gcc&r1=1.480&r2=1.481

Comment 11 Andrew Pinski 2003-08-23 21:56:30 UTC
Fixed on the mainline by a patch by Jan.