But, i'm not able to access target specific attribute from second level of indirection onwards.
For example,
int **gpi ;
Note that in this case finding the target means indirecting through a memory address, and hence we would have to track the attributes of all memory locations which is a difficult and perhaps unsolvable problem.
As I said before, I think what you are trying to do is fundamentally flawed. If you need attributes, you use them when generating RTL, not when optimizing or emitting RTL.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com