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]

Re: gcc 3.3.1 segmentation fault (in rtlanal.c, rtx_varies_p())


On Thursday 26 August 2004 15:50, Grigory Tolstolytkin wrote:
> When compiling attached source file, the compiler crashes with
> segmentation fault in rtx_varies_p() function in rtlanal.c
> I reproduced it at least for two tragets: arm_v5t_le and arm_iwmmxt_le.
> It doesn't occur when compiling with -O0 or -O1,
> but for others do.
>
> I debugged the compiler and found that the compiler generates the
> following rtl instruction:
>
> (insn 16 15 17 0 0x4021b344 (set (reg/f:SI 71)
>         (reg:SI 0 r0)) 345 {*iwmmxt_movsi_insn} (nil)
>         (insn_list:REG_RETVAL 15 (expr_list:REG_EQUAL (expr_list
> (symbol_ref:SI ("cl"))
>         (nil))
>         (nil))))
>
> Then, the "expr_list (symbol_ref:SI("cl"))" comes to the hash table for
> CSE optimization (the hash table declared in cse.c)
>
> And when CSE optimization is applied
> (cse_insn() is called on the rtl instruction
>     (insn 28 47 36 1 0x4021b318 (set (mem/f:SI (plus:SI (reg/f:SI 25 sfp)
>     (const_int -4 [0xfffffffc])) [2 S4 A32])
>     (reg/v/f:SI 68)) 345 {*iwmmxt_movsi_insn} (nil)
>     (nil))
> ) the rtl expression from the hash table is extracted and rtx_varies_p()
> function is called on each parameter of expr_list.
> But the second parameter is NIL and rtx_varies_p() crashes on the first
> line (code = GET_CODE(x)), since the x is NULL.
>
> If I add the follwing code in the beginning of rtx_varies_p():
> "
>     if (x == NULL)
>         return 0;    // nil expression doesn't have have a value which
> can vary even between two executions of the program
> "
<...>
> Any help is appreciated.

I this patch (present in 3.4) did something similar:
http://gcc.gnu.org/ml/gcc-patches/2004-02/msg01518.html

I couldn't reproduce with 3.3, so didn't apply the patch there.

Paul


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