> Subject: build failure with gcc 4.6.0 "array subscript is 
> above array bounds"
...
> That corresponds to:
>       tmp = ((unsigned long *)child->thread.fpr)
>               [TS_FPRWIDTH * (index - PT_FPR0)];
> 
> child->thread.fpr is "double fpr[32][TS_FPRWIDTH]".
> 
> index has already been bounds checked so we know it is <= PT_FPSCR.

That code looks gross....
I think it is trying to index a 2D array with a single index
and type-pun the lookup.
I'm not sure how the array size (for the subscript error)
is determined in the presence of the cast, but without
the cast the index would have to be less than 32.
I also suspect this is failing when gcc inlines the function
from a call where 'index' is a constant.

Possibly the code should read:
   tmp = (unsigned long *)child->thread.fpr[index - PT_FPRO];
although index may have been scaled by 'sizeof double/sizeof long'.

        David


_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Reply via email to