[Pkg-xfce-devel] Bug#811608: FTBFS with GCC 6: nonnull argument compared to NULL

Martin Michlmayr tbm at hpe.com
Thu Jan 21 23:31:45 UTC 2016

* Yves-Alexis Perez <corsac at debian.org> [2016-01-20 08:25]:
> > Note that only the first error is reported; there might be more.  You
> > can find a snapshot of GCC 6 in experimental.  To build with GCC 6,
> > you can set CC=gcc-6 CXX=g++-6 explicitly.
> Could you add a bit more information about this, especially the new options
> etc?

You can find some of that here:

> > > glib-2.0 
> > > libsystem.c: In function 'getpwnam':
> > > libsystem.c:859:14: error: nonnull argument 'name' compared to NULL [-Werror=nonnull]
> > >      if (name == NULL)
> This looks spurious. It's usually considered a *good* idea to check for NULL
> pointer, so I don't understand the error. Also, the code is:

I'm no expert with this, but /usr/include/pwd.h defines:
extern struct passwd *getpwnam (const char *__name) __nonnull ((1));

Looking at the preprocessed source of libsystem I see this e.g.
extern struct passwd *getpwnam (const char *__name) __attribute__ ((__nonnull__ (1)));
extern int __attribute__((__nonnull__ (1))) pam_end(pam_handle_t *pamh, int pam_status);

so it's marked as __nonnull__ but then you're checking if it's NULL,
and this is what this warning is about (error because of -Werror).

You can find more info about this warning and the rationale here:

> So:
> - I fail to see how the compiler can statically know name is NULL

Because of __nonnull__.

Martin Michlmayr
Linux for HPE Helion, Hewlett Packard Enterprise

More information about the Pkg-xfce-devel mailing list