In general, TYPE_CANONICAL of a type strips all attributes. An exception to this seems to be that TYPE_REF_CAN_ALIAS_ALL remains set on the TYPE_CANONICAL of a pointer/reference type even though its TREE_TYPE no longer has the may_alias attribute, and is inconsistent with "affects_type_identity" being false for may_alias. This seems to have been a mistake in the patch that first introduced TYPE_CANONICAL, rather than a deliberate choice. I'm also planning to fix 50800 in the front end, but this patch still seems like an improvement. Tested x86-64-pc-linux-gnu, OK for trunk?