This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[testsuite] failure to optimize out dead code
- To: gcc-patches at gcc dot gnu dot org
- Subject: [testsuite] failure to optimize out dead code
- From: Jakub Jelinek <jakub at redhat dot com>
- Date: Fri, 19 Jan 2001 18:43:53 +0100
- Reply-To: Jakub Jelinek <jakub at redhat dot com>
Hi!
This testcase is regression against 2.95.2 and egcs 1.1.2.
__builtin_constant_p is properly optimized out, but the 10 > 20000 test is
kept (tested with -O and above and fails both on i386, sparc and sparc -m64).
This causes some Linux 2.4.0 to have unresolved symbols.
Ok to commit?
2001-01-19 Jakub Jelinek <jakub@redhat.com>
* gcc.c-torture/execute/20010119-1.c: New test.
--- testsuite/gcc.c-torture/execute/20010119-1.c.jj Fri Jan 19 19:39:28 2001
+++ testsuite/gcc.c-torture/execute/20010119-1.c Fri Jan 19 16:23:35 2001
@@ -0,0 +1,23 @@
+#ifdef __OPTIMIZE__
+extern void undef (void);
+
+void bar (unsigned x) { }
+void baz (unsigned x) { }
+
+extern inline void foo (int a, int b)
+{
+ int c = 0;
+ while (c++ < b)
+ (__builtin_constant_p (a) ? ((a) > 20000 ? undef () : bar (a)) : baz (a));
+}
+#else
+void foo (int a, int b)
+{
+}
+#endif
+
+int main (void)
+{
+ foo(10, 100);
+ exit (0);
+}
Jakub