This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa libmudflap] new tests
- From: "Frank Ch. Eigler" <fche at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 6 Sep 2002 15:04:00 -0400
- Subject: [tree-ssa libmudflap] new tests
Hi -
I'm committing the following two new tests. They reflect
C idioms that the mudflap instrumentation has difficulty with.
2002-09-06 Frank Ch. Eigler <fche@redhat.com>
* test/pass18-frag.c, pass19-frag.c: New tests.
* Makefile.am (check): Run them. Rebuild test programs each time.
* Makefile.in: Regenerated.
Index: Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/Attic/Makefile.am,v
retrieving revision 1.1.2.8
diff -u -r1.1.2.8 Makefile.am
--- Makefile.am 3 Sep 2002 15:48:09 -0000 1.1.2.8
+++ Makefile.am 6 Sep 2002 19:01:00 -0000
@@ -14,7 +14,7 @@
test/fail2.x test/fail3.x test/fail4.x test/fail5.x test/fail6.x \
test/fail7.x test/fail8.x test/fail9.x test/pass1.x test/pass10.x \
test/pass11.x test/pass12.x test/pass13.x test/pass14.x test/pass15.x \
- test/pass16.x test/pass17.x test/pass2.x test/pass3.x test/pass4.x test/pass5.x \
+ test/pass16.x test/pass17.x test/pass18.x test/pass19.x test/pass2.x test/pass3.x test/pass4.x test/pass5.x \
test/pass6.x test/pass7.x test/pass8.x test/pass9.x
@@ -28,13 +28,22 @@
clean-local:
rm -f $(TESTS)
+# Various possibilities
+TESTFLAGS=-rdynamic
+#TESTFLAGS=-static
+#TESTFLAGS=-fdisable-simple
+#TESTFLAGS=-O3
+
test/fail%.x: test/fail%.c
- $(CC) -DSHOULD_FAIL -rdynamic -fmudflap -g -o $@ $<
+ $(CC) -DSHOULD_FAIL -fmudflap $(TESTFLAGS) -g -o $@ $<
test/pass%.x: test/pass%.c
- $(CC) -DSHOULD_PASS -rdynamic -fmudflap -g -o $@ $<
+ $(CC) -DSHOULD_PASS -fmudflap $(TESTFLAGS) -g -o $@ $<
+
+$(TESTS): clean-tests $(lib_LTLIBRARIES)
-$(TESTS): $(lib_LTLIBRARIES)
+clean-tests:
+ rm -f $(TESTS)
# SUBDIRS =
# PWD = $${PWDCMD-pwd}
Index: test/pass18-frag.c
===================================================================
RCS file: test/pass18-frag.c
diff -N test/pass18-frag.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ test/pass18-frag.c 6 Sep 2002 19:01:00 -0000
@@ -0,0 +1,20 @@
+int t;
+char foo[3] = { 'b', 'c', 'd' };
+int bar[3] = {1, 2, 0};
+t = 1;
+
+/* These tests check expression evaluation rules, such as
+ ensuring that side-effect expression (++) get executed the
+ right number of times; that array lookup checks nest correctly. */
+foo[t++] = 'a';
+if (foo[0] != 'b' || foo[1] != 'a' || foo[2] != 'd' || t != 2) abort ();
+if (bar[0] != 1 || bar[1] != 2 || bar[2] != 0) abort();
+
+foo[bar[t--]] = 'e';
+if (foo[0] != 'e' || foo[1] != 'a' || foo[2] != 'd' || t != 1) abort ();
+if (bar[0] != 1 || bar[1] != 2 || bar[2] != 0) abort();
+
+foo[bar[++t]--] = 'g';
+if (foo[0] != 'g' || foo[1] != 'a' || foo[2] != 'd' || t != 2) abort ();
+if (bar[0] != 1 || bar[1] != 2 || bar[2] != -1) abort();
+
Index: test/pass19-frag.c
===================================================================
RCS file: test/pass19-frag.c
diff -N test/pass19-frag.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ test/pass19-frag.c 6 Sep 2002 19:01:00 -0000
@@ -0,0 +1,4 @@
+struct foo {int base; char variable[1]; }; /* a common idiom for variable-size structs */
+
+struct foo * b = malloc (sizeof (int)); /* enough for base */
+b->base = 4;