On 05/10/16 22:43 -0400, Jason Merrill wrote:
On Wed, Oct 5, 2016 at 4:02 PM, Jakub Jelinek <ja...@redhat.com> wrote:
+    case INTEGER_TYPE:
+      return TYPE_PRECISION (t) == GET_MODE_PRECISION (TYPE_MODE (t));
+
+    case BOOLEAN_TYPE:
+      /* For bool values other than 0 and 1 should only appear with
+        undefined behavior.  */
+      return true;
+
+    case ENUMERAL_TYPE:
+      return type_has_unique_obj_representations (ENUM_UNDERLYING_TYPE (t));

I would think that we want the same answer for bool and enums: Either
the whole type size participates in the value representation, but only
certain values have defined behavior (so we should return true), or
only certain bits participate in the value representation (so we
should return false).  This is a question for the committee, but I'm
inclined to use the INTEGER_TYPE code for BOOLEAN_TYPE and
ENUMERAL_TYPE as well, since we don't mask off the other bits when
loading one of these types.

Yes, my new, slightly improved understanding is that if the front-end
always did a mask operation when accessing enumeration types and bool
then the bits outside its valid range of values would be padding. They
would not contribute to its value if set to non-zero values e.g.  by
memset. But since we just load those values without masking, and rely
on a well-defined program not to set bits outside the valid range, we
should return true for those types.

Thanks for working on this, Jakub!

Reply via email to