+2001-12-05 Jakub Jelinek <jakub@redhat.com>
+
+ * gcse.c (store_killed_in_insn): Consider pure calls
+ as potential store killers in addition to normal calls.
+
2001-12-05 Jakub Jelinek <jakub@redhat.com>
* expr.c (expand_expr): When checking promoted value, use
if (GET_CODE (insn) == CALL_INSN)
{
+ /* A normal or pure call might read from pattern,
+ but a const call will not. */
if (CONST_OR_PURE_CALL_P (insn))
- return 0;
+ {
+ rtx link;
+
+ for (link = CALL_INSN_FUNCTION_USAGE (insn);
+ link;
+ link = XEXP (link, 1))
+ if (GET_CODE (XEXP (link, 0)) == USE
+ && GET_CODE (XEXP (XEXP (link, 0), 0)) == MEM
+ && GET_CODE (XEXP (XEXP (XEXP (link, 0), 0), 0)) == SCRATCH)
+ return 1;
+ return 0;
+ }
else
return 1;
}
* g++.dg/other/anon-union.C: New test.
+ * gcc.c-torture/execute/20011024-1.c: New test.
+
2001-12-04 Joseph S. Myers <jsm28@cam.ac.uk>
* gcc.c-torture/execute/20000722-1.x,
--- /dev/null
+/* Test whether store motion recognizes pure functions as potentially reading
+ any memory. */
+
+typedef __SIZE_TYPE__ size_t;
+extern void *memcpy (void *dest, const void *src, size_t n);
+extern size_t strlen (const char *s);
+extern int strcmp (const char *s1, const char *s2) __attribute__((pure));
+
+char buf[50];
+
+static void foo (void)
+{
+ if (memcpy (buf, "abc", 4) != buf) abort ();
+ if (strcmp (buf, "abc")) abort ();
+ memcpy (buf, "abcdefgh", strlen ("abcdefgh") + 1);
+}
+
+int main (void)
+{
+ foo ();
+ return 0;
+}