Specifically, this fixes the case when we get an access to array element through the pointer to element. This covers several FIXME's. in D111654.
Example:
const int arr[4][2]; const int *ptr = arr[1]; // Fixes this.
The issue is that arr[1] is int* (&Element{Element{glob_arr5,1 S64b,int[2]},0 S64b,int}), and ptr is const int*. We don't take qualifiers into account. Consequently, we doesn't match the types as the same ones.
You only use CanonPointeeTy.getLocalUnqualifiedType() all the places. Spell it once and reuse it everywhere.