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

GCC optimizer bug

I have just attempted to compile tar for arm. It appears to trigger an
optimizer bug in gcc.

My test sequence is this:

./tar -c /home/jgg/tar-1.13.11/ | tar -tv

If create.c is compiled with -O2 then the test to determine the max size
of a field failes and tar produces a valid but technically incorrect
archive (older tar versions cannot read it)

If create.c is compiled without -O2 or if a fprintf is inserted before the
critical if statement things are fine.

The effected line is

  if (! negative && v <= MAX_VAL_WITH_DIGITS (size - 1, LG_8))

[line 118 in create.c]

It appears that the MAX)_VAL_WITH_DIGITS macro is somehow compiled to
produce too small a result.

All testing was done on 1.13.11 and on debussy [gcc 2.95-1 from potato]

Note: I will compile tar without -O2 and probably upload it.


Reply to: