------- Comment #3 from uweigand at gcc dot gnu dot org 2009-11-30 15:17 ------- OK, I've reproduced the problem. It seems int_or_pointer_precision is fundamentally wrong for pointers using a non-standard size (i.e. pointer variables defined using a mode attribute).
The history of this is that there used to be code e.g. in fold-const.c:fit_double_type that hard-coded a precision of POINTER_SIZE for pointer types: if (POINTER_TYPE_P (type) || TREE_CODE (type) == OFFSET_TYPE) prec = POINTER_SIZE; else prec = TYPE_PRECISION (type); This showed up as a bug in the presence of named-address-space pointers of a different size than POINTER_SIZE. The initial thought to fix this as to just always use TYPE_PRECISION. This turned out to break C++, as OFFSET_TYPEs were generated that did not correctly set TYPE_PRECISION. Mike fixed this, and added the int_or_pointer_precision routine to verify that TYPE_PRECISION of pointer and offset types is set correctly. However, this now breaks on targets that allow pointers of different size even for the same address space, because the verification in int_or_pointer_precision fails. I think we need to relax the check to allow any "valid_pointer_mode" for the given address space as mode of the pointer, as long as the precision matches the mode size of that mode. I'm testing a patch to that effect. -- uweigand at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |uweigand at gcc dot gnu dot |dot org |org Status|UNCONFIRMED |ASSIGNED Ever Confirmed|0 |1 Last reconfirmed|0000-00-00 00:00:00 |2009-11-30 15:17:10 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42224