str (TREE_STRING_POINTER (t), TREE_STRING_LENGTH (t));
break;
+ case RAW_DATA_CST:
+ if (RAW_DATA_OWNER (t) == NULL_TREE)
+ {
+ /* Stream RAW_DATA_CST with no owner (i.e. data pointing
+ into libcpp buffers) as something we can stream in as
+ STRING_CST which owns the data. */
+ u (0);
+ /* Can't use str (RAW_DATA_POINTER (t), RAW_DATA_LENGTH (t));
+ here as there isn't a null termination after it. */
+ z (RAW_DATA_LENGTH (t));
+ if (RAW_DATA_LENGTH (t))
+ if (void *ptr = buf (RAW_DATA_LENGTH (t) + 1))
+ {
+ memcpy (ptr, RAW_DATA_POINTER (t), RAW_DATA_LENGTH (t));
+ ((char *) ptr)[RAW_DATA_LENGTH (t)] = '\0';
+ }
+ }
+ else
+ {
+ gcc_assert (RAW_DATA_LENGTH (t));
+ u (RAW_DATA_LENGTH (t));
+ }
+ break;
+
case VECTOR_CST:
u (VECTOR_CST_LOG2_NPATTERNS (t));
u (VECTOR_CST_NELTS_PER_PATTERN (t));
}
break;
+ case RAW_DATA_CST:
+ {
+ size_t l = u ();
+ if (l == 0)
+ {
+ /* Stream in RAW_DATA_CST with no owner as STRING_CST
+ which owns the data. */
+ const char *chars = str (&l);
+ t = build_string (l, chars);
+ }
+ else
+ {
+ t = make_node (RAW_DATA_CST);
+ RAW_DATA_LENGTH (t) = l;
+ }
+ }
+ break;
+
case VECTOR_CST:
{
unsigned log2_npats = u ();
/* Streamed during start. */
break;
+ case RAW_DATA_CST:
+ if (RAW_DATA_OWNER (t) == NULL_TREE)
+ break; /* Streamed as STRING_CST during start. */
+ WT (RAW_DATA_OWNER (t));
+ if (streaming_p ())
+ {
+ if (TREE_CODE (RAW_DATA_OWNER (t)) == RAW_DATA_CST)
+ z (RAW_DATA_POINTER (t) - RAW_DATA_POINTER (RAW_DATA_OWNER (t)));
+ else if (TREE_CODE (RAW_DATA_OWNER (t)) == STRING_CST)
+ z (RAW_DATA_POINTER (t)
+ - TREE_STRING_POINTER (RAW_DATA_OWNER (t)));
+ else
+ gcc_unreachable ();
+ }
+ break;
+
case VECTOR_CST:
for (unsigned ix = vector_cst_encoded_nelts (t); ix--;)
WT (VECTOR_CST_ENCODED_ELT (t, ix));
/* Streamed during start. */
break;
+ case RAW_DATA_CST:
+ RT (RAW_DATA_OWNER (t));
+ gcc_assert (TREE_CODE (RAW_DATA_OWNER (t)) == STRING_CST
+ && TREE_STRING_LENGTH (RAW_DATA_OWNER (t)));
+ RAW_DATA_POINTER (t) = TREE_STRING_POINTER (RAW_DATA_OWNER (t)) + z ();
+ break;
+
case VECTOR_CST:
for (unsigned ix = vector_cst_encoded_nelts (t); ix--;)
RT (VECTOR_CST_ENCODED_ELT (t, ix));
--- /dev/null
+// { dg-additional-options "-fmodule-header" }
+// { dg-module-cmi {} }
+
+constexpr unsigned char a[] = {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+};
+
+constexpr int
+foo (const unsigned char *p, int s)
+{
+ int r = 0;
+ for (int i = 0; i < s; ++i)
+ r += p[i];
+ return r;
+}
+
+constexpr int b = foo (a, sizeof a);
+
+inline int
+bar ()
+{
+ const unsigned char b[] = {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ };
+ int r = 0;
+ for (int i = 0; i < sizeof b; ++i)
+ r += b[i];
+ return r;
+}
+
+inline int
+baz ()
+{
+ const long int c[] = {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ };
+ int r = 0;
+ for (int i = 0; i < sizeof (c) / sizeof (c[0]); ++i)
+ r += c[i];
+ return r;
+}