[Top][All Lists]

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

Re: bison-1.30j on AIX 4.3

From: Akim Demaille
Subject: Re: bison-1.30j on AIX 4.3
Date: 10 Jan 2002 10:38:22 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp)

>>>>> "H" == H Merijn Brand <H.Merijn> writes:

H> Sorry, no reply - so no thread reference, no Cc - so you have to
H> forward yourself if you want to. I'm on my Home pc and cannot
H> access my work pc, but here are the results of the dutch jury.

H> attached is the log of ./testsuite 2 3

Thanks a lot, there is already in there something that might help us
understanding the problem!  Have a look at a ``sane'' machine

2. output.at:40: testing Output files:  & -dv -o foo.c....
+Filename = bffff39d (foo.c), Base = bffff39d (foo.c), Tab = 0 (), Ext = 
bffff3a0 (.c)
+Short: 80aa640 (foo)
+Full: 80aa3e0 (foo)

Short and Full are the base name out of which the other file names are
computed.  In particular `foo' + `.output' -> foo.output.

Your machine has:

+Filename = 2ff2294a (foo.c), Base = 2ff2294a (foo.c), Tab = 0 (), Ext = 
2ff2294d (.c)
+Short: 2000f978 (foo.c)
+Full: 2000f968 (foo.c)

I.e., for some reason, the .c was not removed!  Although it did spot
where the extension is (Ext = 2ff2294d (.c)).

Here is the corresponding code:

  const char *base, *tab, *ext;

  /* If --output=foo.c was specified (SPEC_OUTFILE == foo.c),
     BASE_NAME and SHORT_BASE_NAME are `foo'.

     If --output=foo.tab.c was specified, BASE_NAME is `foo.tab' and
     SHORT_BASE_NAME is `foo'.

     The precise -o name will be used for FTABLE.  For other output
     files, remove the ".c" or ".tab.c" suffix.  */
  if (spec_outfile)
      filename_split (spec_outfile, &base, &tab, &ext);

      /* The full base name goes up the EXT, excluding it. */
      full_base_name =
        xstrndup (spec_outfile,
                  (strlen (spec_outfile) - (ext ? strlen (ext) : 0)));
      /* The short base name goes up to TAB, excluding it.  */
      short_base_name =
        xstrndup (spec_outfile,
                  (strlen (spec_outfile)
                   - (tab ? strlen (tab) : (ext ? strlen (ext) : 0))));

      if (ext)
        compute_exts_from_src (ext);

The only possible culprit, IMHO, is in xstrndup.  Itself, being given,
is independent of the platform:

char *
xstrndup (const char *s, size_t n)
  size_t len = strnlen (s, n);
  char *new = xmalloc (len + 1);

  if (new == NULL)
    return NULL;

  new[len] = '\0';
  return (char *) memcpy (new, s, len);

So I guess the real problem is strnlen being broken on your system.
hm, does it have it...  (Gosh, I *love* Autotest reports :):

| configure:5285: checking whether strnlen is declared
| configure:5312: cc -c -O2 -qmaxmem=204800 -I/pro/local/include  conftest.c >&5
| 1506-507 (W) No licenses available. Contact your program supplier to add 
additional users.  Compilation will proceed shortly.
| "configure", line 5335.22: 1506-045 (S) Undeclared identifier strnlen.
| configure:5315: $? = 1

it is not declared, but...

| configure:5482: checking for strnlen
| configure:5525: cc -o conftest -O2 -qmaxmem=204800 -I/pro/local/include   -s 
-L/pro/local/lib conftest.c  >&5
| 1506-507 (W) No licenses available. Contact your program supplier to add 
additional users.  Compilation will proceed shortly.
| configure:5528: $? = 0

it is present!

I think we have found the bad guy!!!

May I ask you to compile and run the following please?

/tmp % cat strnlen.c                                             nostromo 10:37
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

main (void)
  const char *foobar = "foobar";
  int i;

  for (i = 0; i < 10; ++i)
    fprintf (stderr, "strnlen (%s, %d) = %d\n",
             foobar, i, strnlen (foobar, i));
  return 0;
/tmp % gcc strnlen.c                                             nostromo 10:37
/tmp % ./a.out                                                   nostromo 10:37
strnlen (foobar, 0) = 0
strnlen (foobar, 1) = 1
strnlen (foobar, 2) = 2
strnlen (foobar, 3) = 3
strnlen (foobar, 4) = 4
strnlen (foobar, 5) = 5
strnlen (foobar, 6) = 6
strnlen (foobar, 7) = 6
strnlen (foobar, 8) = 6
strnlen (foobar, 9) = 6


reply via email to

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