bug-tar
[Top][All Lists]
Advanced

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

gcc-10 -O2 -W{cast-align,deprecated-declarations,maybe-uninitialized,nul


From: Janos LENART
Subject: gcc-10 -O2 -W{cast-align,deprecated-declarations,maybe-uninitialized,null-dereference}
Date: Sun, 22 Nov 2020 11:29:34 +0000

Hi,

Debian is configuring tar 1.32 with (among some other options):

autoreconf --force -v --install
CFLAGS="-O2 -Wall" ./configure
gcc --version is gcc (Debian 10.2.0-16) 10.2.0

Among a 100 other flags this boils down to -Werror -Wcast-align
-Wcast-align=strict -Wdeprecated-declarations -Wmaybe-uninitialized
-Wnull-dereference -O2

The tar code is pretty padentic and almost compiles with most of those
flags enabled. There are actually only 18 or so warnings (turned into errors),
and they only affect the following 4 files:
- lib/rtapelib.c with -Wcast-align -Wcast-align=strict
- lib/wordsplit.c with -Werror=maybe-uninitialized -O2
- src/buffer.c with -Wnull-dereference -O2
- gnu/selinux-at.h with -Wdeprecated-declarations

I have gone through each warning and they seem bening to me but I
wondered if someone with more tarry eyes could recheck? Also, perhaps there is
a way to make gcc understand that there is nothing fishy happening here (other
than disabling the check and doing away with possible security goodness).

I have attached a patch that I am using now as a stop gap. This shows
the locations but perhaps an ever easier way to see them is to configure
with the options above and then run:

make -C lib rmt-command.h

gcc -DHAVE_CONFIG_H -I. -Ilib -Ignu -Werror \
  -Wcast-align -Wcast-align=strict -Werror -c -o lib/rtapelib.o lib/rtapelib.c

gcc -DHAVE_CONFIG_H -I. -Ilib -Ignu -Werror \
  -Wmaybe-uninitialized -O2 -c -o lib/wordsplit.o lib/wordsplit.c

gcc -DHAVE_CONFIG_H -I. -Ilib -Ignu -Isrc -Werror \
  -Wnull-dereference -O2 -c -o src/buffer.o src/buffer.c

gcc -DHAVE_CONFIG_H -I. -Ilib -Ignu -Isrc -Werror \
  -Wdeprecated-declarations -c -o src/xattrs.o src/xattrs.c

Thank you.

Regards,
--
Janos Lenart
<ocsi@debian.org>

Attachment: gcc-10-warnings.diff
Description: Source code patch


reply via email to

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