--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -935,9 +935,10 @@ constructor_contains_same_values_p (vec<constructor_elt, va_gc> *vec)
   return prev;
 }
 
-/* Return type which should be used for array elements, either TYPE,
-   or for integral type some smaller integral type that can still hold
-   all the constants.  */
+/* Return type which should be used for array elements, either TYPE, a variant
+   with an alignment adjusted back to a value lower than the size, or, for
+   integral types, some smaller integral type that can still hold all the
+   constants.  */
 
 static tree
 array_value_type (gswitch *swtch, tree type, int num,
@@ -949,6 +950,25 @@ array_value_type (gswitch *swtch, tree type, int num,
   int sign = 0;
   tree smaller_type;
 
+  /* Types with alignments greater than their size can reach here, e.g. out
+     of SRA.  We need to adjust the alignment back below the size threshold
+     before we can use the type as an array component type.  */
+
+  const tree type_size = TYPE_SIZE (type);
+  const unsigned HOST_WIDE_INT bitsize =
+    (type_size && TREE_CODE (type_size) == INTEGER_CST)
+    ? tree_to_uhwi (type_size) : 0;
+
+  if (bitsize)
+    {
+      unsigned int bitalign = TYPE_ALIGN (type);
+
+      while (bitalign > bitsize)
+	bitalign /= 2;
+
+      type = build_aligned_type (type, bitalign);
+    }
+
   if (!INTEGRAL_TYPE_P (type))
     return type;
 
