bug-gnulib
[Top][All Lists]
Advanced

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

gcc 6.1.1 compilation error due to -Werror=null-dereference in obstack.c


From: Assaf Gordon
Subject: gcc 6.1.1 compilation error due to -Werror=null-dereference in obstack.c
Date: Thu, 14 Jul 2016 19:44:57 -0400

Hello,

Not sure if this has been reported yet:
On Fedora 24 with gcc 6.1.1, compiling coreutils from git (thus with -Werror) 
fails with the error below.

Possibly due to GCC not understanding that if 'new_chunk' is NULL and 
'obstack_alloc_failed_handler' is called, it won't return (in obstack.c:202).

The checked-out gnulib is v0.1-798-g6835fc4, which already includes previous 
related commit:
   6f9206 manywarnings: update for GCC 6.1

===
$ git clone git://git.sv.gnu.org/coreutils.git
$ cd coreutils
$ ./bootstrap
$ ./configure

$ git describe
v8.25-44-g502518b

$ ( cd gnulib ; git describe )
v0.1-798-g6835fc4

$ make
...
...
   CC       lib/obstack.o
lib/obstack.c: In function '_obstack_newchunk':
lib/obstack.c:205:20: error: potential null pointer dereference 
[-Werror=null-dereference]
   new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size;
   ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/obstack.c:204:19: error: potential null pointer dereference 
[-Werror=null-dereference]
   new_chunk->prev = old_chunk;
   ~~~~~~~~~~~~~~~~^~~~~~~~~~~
cc1: all warnings being treated as errors
Makefile:8891: recipe for target 'lib/obstack.o' failed
make[2]: *** [lib/obstack.o] Error 1

$ gcc -v
gcc version 6.1.1 20160621 (Red Hat 6.1.1-3) (GCC)

$ uname -a
Linux fedora24 4.6.3-300.fc24.x86_64 #1 SMP Fri Jun 24 20:52:41 UTC 2016 x86_64 
x86_64 x86_64 GNU/Linux

$ lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: Fedora
Description:    Fedora release 24 (Twenty Four)
Release:        24
Codename:       TwentyFour
===


regards,
 - assaf


reply via email to

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