This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PR bootstrap/35169: HP-UX/IA awk bug


GCC PR 35169 uncovers an awk printf %u bug on ia64-hp-hpux11.23 not
present on HP-UX/PA.  I confirmed that the patch against GCC produces
a correct options.c with its awk, and of course with GNU awk.
OK for trunk, 4.3, 4.2, and 4.1?

This is a 4.1 regression introduced inadvertently on 2006-05-16
(by adding another output field after the %u).  I checked *.awk
files in GCC for other instances of this.

Below is also a patch for the portability section of the Autoconf
manual.  OK to apply, and who should be credited?

Can the bug reporter please file a trouble ticket with HP so they can
fix this?  Also, could you bootstrap GCC on ia64-hp-hpux11.23 with the
patch applied?

Thanks,
Ralf

gcc/ChangeLog:
2008-03-31  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

	PR bootstrap/35169
	* optc-gen.awk: Work around HP-UX/IA awk bug.

diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk
index cd10244..717f384 100644
--- a/gcc/optc-gen.awk
+++ b/gcc/optc-gen.awk
@@ -189,8 +189,10 @@ for (i = 0; i < n_opts; i++) {
 				idx = -1;
 		}
 	}
-	printf("  { %c-%s%c,\n    %s,\n    %s, %u, %d,\n",
-	       quote, opts[i], quote, hlp, back_chain[i], len, idx)
+	# Split the printf after %u to work around an HP-UX awk bug.
+	printf("  { %c-%s%c,\n    %s,\n    %s, %u,",
+	       quote, opts[i], quote, hlp, back_chain[i], len)
+	printf(" %d,\n", idx)
 	condition = opt_args("Condition", flags[i])
 	cl_flags = switch_flags(flags[i])
 	if (condition != "")



autoconf/ChangeLog:
2008-03-31  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

	* doc/autoconf.texi (Limitations of Usual Tools): Mention awk %u
	bug on HP-UX/IA.
	Report by ...

diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index dc06bab..e6a892e 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -14541,6 +14541,14 @@ bar
 Either do not depend on such patterns (i.e., use @samp{/^(.*foo|bar)/},
 or use a simple test to reject such implementations.
 
+On @samp{ia64-hp-hpux11.23}, Awk mishandles @code{printf} conversions
+after @code{%u}:
+
+@example
+$ @kbd{awk 'BEGIN @{ printf "%u %d\n", 0, -1 @}'}
+0 0
+@end example
+
 @acronym{AIX} version 5.2 has an arbitrary limit of 399 on the
 length of regular expressions and literal strings in an Awk program.
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]