https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98597
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |law at gcc dot gnu.org --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The bug is clear: const bool addr = TREE_CODE (arg) == ADDR_EXPR; if (addr) { arg = TREE_OPERAND (arg, 0); ... } makes arg sometimes pointer and sometimes what the pointer points to (which can be another pointer or something completely different). So obviously tree arg_type = TREE_TYPE (TREE_TYPE (arg)); can't work reliably. Either the arg = TREE_OPERAND (arg, 0); should be done only if byte_off == 0, or everything else that uses TREE_TYPE (TREE_TYPE (arg)) needs to be changed to do something different based on whether addr is true or false. I'd note that having the same variable represent different levels of indirection in the same code depending on some circumstances is a maintainance nightmare. E.g. instead of having a bool whether arg was originally ADDR_EXPR or not, it might be better to keep arg as it is and have another tree that would represent what arg points to if it is ADDR_EXPR, otherwise NULL_TREE.