case INTEGER_CST:
return tree_int_cst_compare (cst1, cst2);
case STRING_CST:
- return strcmp (TREE_STRING_POINTER (cst1),
- TREE_STRING_POINTER (cst2));
+ if (TREE_STRING_LENGTH (cst1) < TREE_STRING_LENGTH (cst2))
+ return -1;
+ if (TREE_STRING_LENGTH (cst1) > TREE_STRING_LENGTH (cst2))
+ return 1;
+ return memcmp (TREE_STRING_POINTER (cst1),
+ TREE_STRING_POINTER (cst2),
+ TREE_STRING_LENGTH (cst1));
+ case RAW_DATA_CST:
+ if (RAW_DATA_LENGTH (cst1) < RAW_DATA_LENGTH (cst2))
+ return -1;
+ if (RAW_DATA_LENGTH (cst1) > RAW_DATA_LENGTH (cst2))
+ return 1;
+ return memcmp (RAW_DATA_POINTER (cst1),
+ RAW_DATA_POINTER (cst2),
+ RAW_DATA_LENGTH (cst1));
case REAL_CST:
/* Impose an arbitrary but deterministic order. */
return memcmp (TREE_REAL_CST_PTR (cst1),
--- /dev/null
+/* PR analyzer/119278 */
+/* { dg-do compile } */
+
+const unsigned char a[] = {
+#define A 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
+ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A
+};
+const unsigned char b[] = {
+#define B 16, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1
+ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B
+};
+struct S { const unsigned char *s; };
+void bar (struct S *);
+
+void
+foo (void)
+{
+ struct S t[] = { a, b };
+ bar (t);
+}