Bug 44941 - [4.6 Regression] ICE: RTL check: expected code 'mem', have 'reg' in emit_block_move_hints, at expr.c:1189
Summary: [4.6 Regression] ICE: RTL check: expected code 'mem', have 'reg' in emit_bloc...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: 4.6.0
Assignee: Richard Biener
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-14 23:24 UTC by Zdenek Sojka
Modified: 2010-07-19 15:40 UTC (History)
2 users (show)

See Also:
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-07-15 15:47:16


Attachments
reduced testcase (from iptraf sources) (77 bytes, text/plain)
2010-07-14 23:25 UTC, Zdenek Sojka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Sojka 2010-07-14 23:24:01 UTC
Command line:
$ gcc -O[123s] testcase.c

Compiler output:
$ gcc -O testcase.c
testcase.c: In function 'foo':
testcase.c:7:7: internal compiler error: RTL check: expected code 'mem', have 'reg' in emit_block_move_hints, at expr.c:1189

Unreduced testcase crashes with:
$ gcc -O rarpd.i
rarpd.c: In function 'load_if':
rarpd.c:203:41: internal compiler error: in make_decl_rtl, at varasm.c:1346

Reduced testcase without rtl checking crashes with:
$ gcc -O testcase.c
testcase.c: In function 'foo':
testcase.c:7:7: internal compiler error: Segmentation fault

Tested revisions:
r162193 - crash
r162056 - crash
r161659 - crash
r161170 - OK
Comment 1 Zdenek Sojka 2010-07-14 23:25:35 UTC
Created attachment 21204 [details]
reduced testcase (from iptraf sources)

Command line:
$ gcc -O pr44941.c
Comment 2 H.J. Lu 2010-07-15 14:38:02 UTC
It is caused by revision 161655:

http://gcc.gnu.org/ml/gcc-cvs/2010-07/msg00006.html
Comment 3 Richard Biener 2010-07-15 15:47:16 UTC
Mine.
Comment 4 Richard Biener 2010-07-19 09:51:33 UTC
#3  0x000000000060425e in store_one_arg (arg=0x7fffffffbc10, 
    argblock=0x7ffff7ee0540, flags=0, variable_size=0, reg_parm_stack_space=0)
    at /space/rguenther/src/svn/trunk/gcc/calls.c:4309
4309          emit_push_insn (arg->value, arg->mode, TREE_TYPE (pval), size_rtx,
(gdb) call debug_rtx (arg->value)
(reg:SI 61)
(gdb) p arg->mode
$2 = BLKmode
(gdb) call debug_rtx (size_rtx)
(const_int 0 [0])
(gdb) call debug_tree (arg->tree_value)
 <mem_ref 0x7ffff7ff90a8
    type <record_type 0x7ffff5ae02a0 S type_0 BLK
        size <integer_cst 0x7ffff7ed2b18 constant 0>
        unit size <integer_cst 0x7ffff7ed2410 constant 0>
        align 8 symtab 0 alias set -1 canonical type 0x7ffff5ae02a0 context <translation_unit_decl 0x7ffff7efb958 D.1621>
        pointer_to_this <pointer_type 0x7ffff5ae0498> chain <type_decl 0x7ffff7efb8a0 D.1615>>
   
    arg 0 <addr_expr 0x7ffff5b43030
        type <pointer_type 0x7ffff7ef6540 type <integer_type 0x7ffff7ee7498 int>
            unsigned DI
            size <integer_cst 0x7ffff7ed27a8 constant 64>
            unit size <integer_cst 0x7ffff7ed27d0 constant 8>
            align 64 symtab 0 alias set -1 canonical type 0x7ffff7ef6540>
       
        arg 0 <parm_decl 0x7ffff7edb908 i type <integer_type 0x7ffff7ee7498 int>
            used SI file pr44941.c line 5 col 15
            size <integer_cst 0x7ffff7ed26e0 constant 32>
            unit size <integer_cst 0x7ffff7ed23e8 constant 4>
            align 32 context <function_decl 0x7ffff5afb100 foo>
            (reg/v:SI 58 [ i ]) arg-type <integer_type 0x7ffff7ee7498 int>
            incoming-rtl (reg:SI 5 di [ i ])>
        pr44941.c:7:21>
    arg 1 <integer_cst 0x7ffff5adc668 type <pointer_type 0x7ffff5ae0498> constant 0>
    pr44941.c:7:7>

I have a patch.
Comment 5 Zdenek Sojka 2010-07-19 13:35:38 UTC
Thank you for fixing this.

It seems the original ICE (in make_decl_rtl, at varasm.c:1346) is different, so I opened it as PR44988.
Comment 6 Richard Biener 2010-07-19 15:40:12 UTC
Subject: Bug 44941

Author: rguenth
Date: Mon Jul 19 15:39:51 2010
New Revision: 162308

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162308
Log:
2010-07-19  Richard Guenther  <rguenther@suse.de>

	PR middle-end/44941
	* expr.c (emit_block_move_hints): Move zero size check first.
	Move asserts to more useful places.
	* calls.c (load_register_parameters): Check for zero size.

	* gcc.c-torture/compile/pr44941.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr44941.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/calls.c
    trunk/gcc/expr.c
    trunk/gcc/testsuite/ChangeLog

Comment 7 Richard Biener 2010-07-19 15:40:18 UTC
Fixed.