------- Comment #6 from pinskia at gcc dot gnu dot org  2006-01-16 06:02 -------
The problem here is that operand_equal_p returns false for these two trees:
<array_ref 0x41da4b94
    type <integer_type 0x41d1b180 char sizes-gimplified public QI
        size <integer_cst 0x41d0a320 constant invariant 8>
        unit size <integer_cst 0x41d0a340 constant invariant 1>
        align 8 symtab 0 alias set -1 precision 8 min <integer_cst 0x41d0a3a0
-128> max <integer_cst 0x41d0a420 127>
        pointer_to_this <pointer_type 0x41d23120>>

    arg 0 <var_decl 0x41da2540 buf
        type <array_type 0x41da24e0 type <integer_type 0x41d1b180 char>
            QI size <integer_cst 0x41d0a320 8> unit size <integer_cst
0x41d0a340 1>
            align 8 symtab 0 alias set -1 domain <integer_type 0x41da2480>>
        addressable used public static common QI file t.c line 4 size
<integer_cst 0x41d0a320 8> unit size <integer_cst 0x41d0a340 1>
        align 8
        chain <function_decl 0x41da3680 foo type <function_type 0x41d236c0>
            public static SI file t.c line 7 initial <block 0x41da4bfc> result
<result_decl 0x41d12268 D.1518>
            (mem:SI (symbol_ref:SI ("foo") [flags 0x103] <function_decl
0x41da3680 foo>) [0 S4 A8])
            saved-insns 0x41d85c00>>
    arg 1 <integer_cst 0x41d0ab40 type <integer_type 0x41d1b2a0 int> constant
invariant 0>>

and
 <array_ref 0x41dab6b4
    type <integer_type 0x41d23300 char readonly sizes-gimplified public QI
        size <integer_cst 0x41d0a320 constant invariant 8>
        unit size <integer_cst 0x41d0a340 constant invariant 1>
        align 8 symtab 0 alias set -1 precision 8 min <integer_cst 0x41d0a3a0
-128> max <integer_cst 0x41d0a420 127>
        pointer_to_this <pointer_type 0x41d23360>>

    arg 0 <var_decl 0x41da2540 buf
        type <array_type 0x41da24e0 type <integer_type 0x41d1b180 char>
            QI size <integer_cst 0x41d0a320 8> unit size <integer_cst
0x41d0a340 1>
            align 8 symtab 0 alias set -1 domain <integer_type 0x41da2480>>
        addressable used public static common QI file t.c line 4 size
<integer_cst 0x41d0a320 8> unit size <integer_cst 0x41d0a340 1>
        align 8
        chain <function_decl 0x41da3680 foo type <function_type 0x41d236c0>
            public static SI file t.c line 7 initial <block 0x41da4bfc> result
<result_decl 0x41d12268 D.1518>
            (mem:SI (symbol_ref:SI ("foo") [flags 0x103] <function_decl
0x41da3680 foo>) [0 S4 A8])
            saved-insns 0x41d85c00>>
    arg 1 <integer_cst 0x41d76600 type <integer_type 0x41da2480> constant
invariant 0>
    arg 2 <integer_cst 0x41d0a2a0 type <integer_type 0x41d1b000 long unsigned
int> constant invariant 0> arg 3 <integer_cst 0x41d0a340 1>>

Even they point to the same spot, it does not work as the two array reference
have different arg2/arg3.

So Store_CCP is doing the correct thing, just the function it depends on is
not.

And the reason for this problem is because when changing **q into buf[0], it
does not fill out those two arguments to the tree.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|alias                       |
            Summary|store_ccp does nothing for  |operand_equal_p does not
                   |array references            |return true for some
                   |                            |equivalent ARRAY_REF


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24689

Reply via email to