This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
BUG: -funroll-all-loops generates unresolved externals
- To: gcc-bugs at gcc dot gnu dot org
- Subject: BUG: -funroll-all-loops generates unresolved externals
- From: Manfred Hollstein <manfredh at redhat dot com>
- Date: Thu, 3 Aug 2000 12:54:30 +0200 (MEST)
- Reply-To: Manfred Hollstein <manfred dot h at gmx dot net>
Hi there,
When bootstrapping a recent checkout from the mainline sources on
i586-redhat6-linux-gnu using BOOT_CFLAGS="-O9 -funroll-all-loops" I
ended up with an unresolved external while creating cc1chill.
Further analysis has shown, that compiling loops of the following form
using -funroll-all-loops generates jumps to labels, which won't exist
in the final output any more:
for (;;)
{
ch = input ();
if (ISALNUM (ch))
obstack_1grow (&temporary_obstack, ch);
else if (ch != '_')
break;
}
Rewriting this loop to use a do { ... } while (...) construct can be
used as a work-around:
do
{
ch = input ();
if (ISALNUM (ch))
obstack_1grow (&temporary_obstack, ch);
} while (ch == '_');
BTW, this is an excerpt from gcc/ch/lex.c.
OK to install the attached testcase?
Cheers, manfred.
2000-08-03 Manfred Hollstein <manfredh@redhat.com>
* gcc.dg/20000803-1.c: New test.
--- /dev/null Tue May 5 22:32:27 1998
+++ gcc/testsuite/gcc.dg/20000803-1.c Thu Aug 3 12:44:19 2000
@@ -0,0 +1,57 @@
+/* Copyright (C) 2000 Free Software Foundation.
+
+ by Manfred Hollstein <manfredh@redhat.com> */
+
+/* { dg-do link } */
+/* { dg-options "-O2 -funroll-all-loops" } */
+
+void *temporary_obstack;
+
+static int input (void)
+{
+ return 0;
+}
+
+static int ISALNUM (int ch)
+{
+ return ((ch >= 'A' && ch <= 'Z')
+ || (ch >= 'a' && ch <= 'z')
+ || (ch >= '0' && ch <= '0'));
+}
+
+static void obstack_1grow (void **ptr, int ch)
+{
+}
+
+
+int yylex (void)
+{
+ int ch;
+
+#ifndef WORK_AROUND
+ for (;;)
+ {
+ ch = input ();
+ if (ISALNUM (ch))
+ obstack_1grow (&temporary_obstack, ch);
+ else if (ch != '_')
+ break;
+ }
+#else
+ do
+ {
+ ch = input ();
+ if (ISALNUM (ch))
+ obstack_1grow (&temporary_obstack, ch);
+ } while (ch == '_');
+#endif
+
+ return ch;
+}
+
+int main (void)
+{
+ int ch = yylex ();
+
+ return ch;
+}