[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

From: Ralf Wildenhues
Subject: [PATCH] PR bootstrap/35169: HP-UX/IA awk bug
Date: Mon, 31 Mar 2008 23:18:15 +0200
User-agent: Mutt/1.5.17+20080114 (2008-01-14)

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?


2008-03-31  Ralf Wildenhues  <address@hidden>

        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 != "")

2008-03-31  Ralf Wildenhues  <address@hidden>

        * 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}:
+$ @kbd{awk 'BEGIN @{ printf "%u %d\n", 0, -1 @}'}
+0 0
address@hidden 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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]