This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GCC RTX generation question


Hello,

I wrote here before a few months ago, I'm trying to port GCC to a simple
RISC machine and I have two problems I don't seem to be able to fix. I'm
using gcc 4.4.3 for both compiling and as source code.

1. I have the following code:

-------------------------------
extern void doSmth();

void bugTest(){
	doSmth();
}
-------------------------------

It compiles fine with -O0, but when I try to use -O3, I get the following
compiler error:

---------------------------------------------
test0.c:13: error: unrecognizable insn:
(call_insn 7 6 8 3 test0.c:12 (call (mem:SI (mem:SI (reg/f:SI 41) [0 S4
A32]) [0 S4 A32])
        (const_int 0 [0x0])) -1 (nil)
    (nil))
test0.c:13: internal compiler error: in extract_insn, at recog.c:2048
---------------------------------------------

I don't understand why the compiler generates (call (mem (mem (reg) )))...
and also, I was under the impression that any address should checked by
the GO_IF_LEGITIMATE_ADDRESS macro, but I checked and the macro doesn't
receive a (mem (reg)) rtx to verify. This is most likely a failure of my
part to describe something correctly, but the error message isn't very
explicit.


2. I have another piece of code that fails to compile with -O3.

---------------------------------------------
struct desc{
	int int1;
	int int2;
	int int3;
};

int bugTest(struct desc *tDesc){
	return *((int*)(tDesc->int1 + 16));
}
----------------------------------------------

This time the compiler crashes with a segmentation fault. From what I
could dig up with gdb, the compilers tries to make a LIBCALL for a
memcopy, but I'm not really sure why. At the end is the back-trace of the
crash.

If someone could give me a hint or two, it would be greatly appreciated.

Thanks,
Radu


====================================
assign_temp (type_or_decl=0x0, keep=0, memory_required=1, dont_promote=1)
at ../../gcc-4.4.3/gcc/function.c:889
889	  if (DECL_P (type_or_decl))
(gdb) bt
#0  assign_temp (type_or_decl=0x0, keep=0, memory_required=1,
dont_promote=1) at ../../gcc-4.4.3/gcc/function.c:889
#1  0x081312cd in emit_push_insn (x=0xb7d0a5c0, mode=SImode, type=0x0,
size=0xb7c912d8, align=8, partial=0, reg=0x0, extra=0,
args_addr=0xb7c92290, args_so_far=0xb7c912b8, reg_parm_stack_space=0,
    alignment_pad=0xb7c912b8) at ../../gcc-4.4.3/gcc/expr.c:3756
#2  0x080cf0cb in emit_library_call_value_1 (retval=<value optimized out>,
orgfun=<value optimized out>, value=<value optimized out>,
fn_type=LCT_NORMAL, outmode=VOIDmode, nargs=3,
    p=0xbfffef60 "\300\245&#1079;\006") at ../../gcc-4.4.3/gcc/calls.c:3701
#3  0x080cf8ed in emit_library_call (orgfun=0xb7cce7a0,
fn_type=LCT_NORMAL, outmode=VOIDmode, nargs=3) at
../../gcc-4.4.3/gcc/calls.c:3952
#4  0x08124d31 in expand_assignment (to=0xb7c940f0, from=0xb7c9a5a0,
nontemporal=0 '\000') at ../../gcc-4.4.3/gcc/expr.c:4381
#5  0x08126803 in expand_expr_real_1 (exp=0xb7c95750, target=<value
optimized out>, tmode=<value optimized out>, modifier=EXPAND_NORMAL,
alt_rtl=0x0) at ../../gcc-4.4.3/gcc/expr.c:9257
#6  0x0812b4ed in expand_expr_real (exp=0xb7c95750, target=0xb7c912b8,
tmode=VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at
../../gcc-4.4.3/gcc/expr.c:7129
#7  0x0823bd9b in expand_expr (exp=0xb7c95750) at
../../gcc-4.4.3/gcc/expr.h:539
#8  expand_expr_stmt (exp=0xb7c95750) at ../../gcc-4.4.3/gcc/stmt.c:1352


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]