GNU tar 1.13.25 (in alpha.gnu.org:gnu/tar/) fails 'make check' badly
on sparc-solaris8 if compiled with -mcpu=ultrasparc. This is a regression
from many prev versions of GCC. My table of what works and doesn't
-g : OK on sparc-solaris8
-O : OK on sparc-solaris8
-O -mcpu=ultrasparc : not OK on sparc-solaris8
-O2 : OK on sparc-solaris8
-O2 -mcpu=ultrasparc : not OK on sparc-solaris8 (OK on ia32-linux-rh7.2)
I'd guess it's a miscompilation of to_octal in src/create.c
The symptom is that the resulting tar miscreates tar files (but
seems to read them fine). Just look at bytes 101ff in a bad/good
tar file -- the mode/uid/gid things come out obviously busted.
Keep up the good work.
In order to reproduce a bug, we need significantly more information.
Um... get a copy of the tar-1.13.25.tar.gz tarball from, uh, alpha.gnu.org
in directory 'gnu'. Unpack it. Configure with
CFLAGS="-O2 -mcpu=ultrasparc" ./configure
Virtually all of the 'make check' tests will fail, because it will be creating
duff tar archives. Make a trivial archive with a good (GNU) tar. Make a comparable
archive with the tar just built. Look at the two tar archives, at about
byte 100. Where one shows a unix 'mode' (etc), the busted one will be plainly
If you go back and do CFLAGS=-O2 ./configure, everything should work fine.
Quoting the aforementioned document:
"What we do not want
The location (URL) of the package that failed to build (we won't download it,
anyway, since you've already given us what we need to duplicate the bug, haven't
We have not the time and resources to download and debug every source tarball,
GNU software or not. Could you help us by narrowing down the problem to a single
source file (even better, a single function within the file) and following the
instructions of the document?
Thanks in advance.
Subject: Re: [sparc] -mcpu=ultrasparc busts tar-1.13.25 on sparc-solaris8
> We have not the time and resources to download and debug every source tarball,
> GNU software or not. Could you help us by narrowing down the problem to a single
> source file (even better, a single function within the file) and following the
> instructions of the document?
Compile the code below (on a sparc-solaris box), with and
without -mcpu=ultrasparc, and note the different answers:
% gcc -O2 bug-11xx.c
% gcc -O2 -mcpu=ultrasparc bug-11xx.c
typedef unsigned long long uint64_t;
typedef uint64_t uintmax_t;
typedef unsigned int size_t;
to_octal (uintmax_t value, char *where, size_t size)
uintmax_t v = value;
size_t i = size;
where[--i] = '0' + (v & ((1 << 3) - 1));
v >>= 3;
Thanks for this pretty testcase!
Confirmed as a regression from GCC 3.2.3 on 3.3 branch but not on mainline.
Created attachment 4111 [details]
The patch has not yet undergone the required round of testing.