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: Restrict keyword doesn't work correctly in GCC 4.4


On Wed, Jun 3, 2009 at 5:34 PM, Bingfeng Mei
<bmei@broadcom.com> wrote:
> Richard,
> Thanks. I tried your patch and the -fno-tree-ter, and none works. The problem is that
>
> ? ? ? decl = find_base_decl (TREE_OPERAND (inner, 0)); ?<--- Cannot find the base declaration, so decl = 0
>
> ? ? ? if (decl ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?<-- won't be checked
> ? ? ? ? ?&& POINTER_TYPE_P (TREE_TYPE (decl))
> ? ? ? ? ?&& TYPE_RESTRICT (TREE_TYPE (decl)))
>
>
> The TREE_OPERAND (inner, 0) is:
>
> ?<nop_expr 0xf7fc7400
> ? ?type <pointer_type 0xf7fa6870
> ? ? ? ?type <integer_type 0xf7f122f4 int sizes-gimplified public SI
> ? ? ? ? ? ?size <integer_cst 0xf7f0f9d8 constant 32>
> ? ? ? ? ? ?unit size <integer_cst 0xf7f0f7c4 constant 4>
> ? ? ? ? ? ?align 32 symtab 0 alias set 2 canonical type 0xf7f122f4 precision 32 min <integer_cst 0xf7f0f984 -2147483648> max <integer_cst 0xf7f0f9a0 2147483647>
> ? ? ? ? ? ?pointer_to_this <pointer_type 0xf7f18798>>
> ? ? ? ?sizes-gimplified public unsigned restrict SI size <integer_cst 0xf7f0f9d8 32> unit size <integer_cst 0xf7f0f7c4 4>
> ? ? ? ?align 32 symtab 0 alias set -1 canonical type 0xf7fa6870>
>
> ? ?arg 0 <plus_expr 0xf7fc95e8
> ? ? ? ?type <integer_type 0xf7f12438 long unsigned int public unsigned SI size <integer_cst 0xf7f0f9d8 32> unit size <integer_cst 0xf7f0f7c4 4>
> ? ? ? ? ? ?align 32 symtab 0 alias set -1 canonical type 0xf7f12438 precision 32 min <integer_cst 0xf7f0fa64 0> max <integer_cst 0xf7f0fa48 4294967295>>
>
> ? ? ? ?arg 0 <var_decl 0xf7fc4a6c D.1768 type <integer_type 0xf7f12438 long unsigned int>
> ? ? ? ? ? ?used unsigned ignored SI file tst.c line 1 col 6 size <integer_cst 0xf7f0f9d8 32> unit size <integer_cst 0xf7f0f7c4 4>
> ? ? ? ? ? ?align 32 context <function_decl 0xf7fa7080 foo>
> ? ? ? ? ? ?(reg:SI 104 [ D.1768 ])>
> ? ? ? ?arg 1 <integer_cst 0xf7fb7bec constant 4>
> ? ? ? ?tst.c:7:5>
> ? ?tst.c:7:5>
>
>
> I added the following code. It seems to work for my example and others. Not sure potential hazard with it.
> ? ? ? ? ...
> ? ? ? ? ?else if(!decl
> ? ? ? ? ? ? ? ? ?&& POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND(inner, 0)))
> ? ? ? ? ? ? ? ? ?&& TYPE_RESTRICT (TREE_TYPE (TREE_OPERAND(inner, 0))))
> ? ? ? ? ? ?{
> ? ? ? ? ? ? ? return new_alias_set ();
> ? ? ? ? ? ?}
> ? ? ? ? ....
>

Ah, of course.  As I said - restrict support is broken.

Richard.


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