fix #4189

bug when accessing a cglobal as different types