Yannick Y Bergeron wrote:
> If it's a compiler issue, I can open a ticket to IBM XL C/C++ but I would 
> need to understand why it should works (other than "it works with gcc"), 
> what would be the normal behavior and why this should be considered a 
> compiler issue.

Simply put, the program declares an identifier SYSINT_BUFSIZE,
but cc -qlanglvl=extc99 later incorrectly reports that this
identifier is not declared.

I'll attach a small sample.c file that attempts to take your
tar.output file and discard everything except what's needed
to illustrate the bug.  If your 'cc -qlanglvl=extc99 -g -c sample.c'
fails, the compiler is clearly buggy.  If cc accepts the program,
you may have to restore some of the stuff I've removed (indicated by
/* ... */) to make the bug reappear.  Either way, you can
use the program as part of your trouble ticket.  The simplest
thing for you would be to submit the full foo.c, which you've already
got, but it may help the IBM maintainers to have a smaller test
case that illustrates the bug.  I also suggest mentioning this email
thread

http://lists.gnu.org/archive/html/bug-tar/2013-12/msg00025.html

as part of your trouble ticket.

It would be helpful to come up with a way to work around the bug,
so that 'tar' can be built even with a buggy compiler.  But we may
need to know what the compiler bug is, before we can do that.
/* ... */
typedef	signed long long	int64_t;
typedef unsigned long long	uint64_t;
/* ... */
typedef int64_t			intmax_t;
typedef uint64_t		uintmax_t;
/* ... */
extern int	printf(const char *__restrict, ...);
/* ... */
enum { SYSINT_BUFSIZE =
	 (((((((sizeof (uintmax_t) * (8) - (! ((__typeof__ (uintmax_t)) 0 < (__typeof__ (uintmax_t)) -1))) * 146 + 484) / 485) + (! ((__typeof__ (uintmax_t)) 0 < (__typeof__ (uintmax_t)) -1))) + 1)) < ((((((sizeof (intmax_t) * (8) - (! ((__typeof__ (intmax_t)) 0 < (__typeof__ (intmax_t)) -1))) * 146 + 484) / 485) + (! ((__typeof__ (intmax_t)) 0 < (__typeof__ (intmax_t)) -1))) + 1)) ? ((((((sizeof (intmax_t) * (8) - (! ((__typeof__ (intmax_t)) 0 < (__typeof__ (intmax_t)) -1))) * 146 + 484) / 485) + (! ((__typeof__ (intmax_t)) 0 < (__typeof__ (intmax_t)) -1))) + 1)) : ((((((sizeof (uintmax_t) * (8) - (! ((__typeof__ (uintmax_t)) 0 < (__typeof__ (uintmax_t)) -1))) * 146 + 484) / 485) + (! ((__typeof__ (uintmax_t)) 0 < (__typeof__ (uintmax_t)) -1))) + 1))) };
char *sysinttostr (uintmax_t, intmax_t, uintmax_t, char buf[SYSINT_BUFSIZE]);
/* ... */
struct field_range
{
  char const *fieldname;
  intmax_t min_val;
  uintmax_t max_val;
};

static struct field_range const field_ranges[] = {
  { "nfs", 0, 1 },
  /* ... */
  { 0, 0, 0 }
};
/* ... */
void
show_snapshot_field_ranges (void)
{
  struct field_range const *p;
  char minbuf[((SYSINT_BUFSIZE) < ((((((sizeof (intmax_t) * (8) - (! ((__typeof__ (intmax_t)) 0 < (__typeof__ (intmax_t)) -1))) * 146 + 484) / 485) + (! ((__typeof__ (intmax_t)) 0 < (__typeof__ (intmax_t)) -1))) + 1)) ? ((((((sizeof (intmax_t) * (8) - (! ((__typeof__ (intmax_t)) 0 < (__typeof__ (intmax_t)) -1))) * 146 + 484) / 485) + (! ((__typeof__ (intmax_t)) 0 < (__typeof__ (intmax_t)) -1))) + 1)) : (SYSINT_BUFSIZE))];
  char maxbuf[((SYSINT_BUFSIZE) < ((((((sizeof (uintmax_t) * (8) - (! ((__typeof__ (uintmax_t)) 0 < (__typeof__ (uintmax_t)) -1))) * 146 + 484) / 485) + (! ((__typeof__ (uintmax_t)) 0 < (__typeof__ (uintmax_t)) -1))) + 1)) ? ((((((sizeof (uintmax_t) * (8) - (! ((__typeof__ (uintmax_t)) 0 < (__typeof__ (uintmax_t)) -1))) * 146 + 484) / 485) + (! ((__typeof__ (uintmax_t)) 0 < (__typeof__ (uintmax_t)) -1))) + 1)) : (SYSINT_BUFSIZE))];

  printf("This tar's snapshot file field ranges are\n");
  printf ("   (%-15s => [ %s, %s ]):\n\n", "field name", "min", "max");

  for (p=field_ranges; p->fieldname != 0; p++)
    {
      printf ("    %-15s => [ %s, %s ],\n", p->fieldname,
	      sysinttostr (p->min_val, p->min_val, p->max_val, minbuf),
	      sysinttostr (p->max_val, p->min_val, p->max_val, maxbuf));

    }

  printf("\n");
}
/* ... */

Reply via email to