Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gcc-9 stricter on NULL arguments for printf #2879

ingvarha opened this issue Jan 9, 2019 · 1 comment

gcc-9 stricter on NULL arguments for printf #2879

ingvarha opened this issue Jan 9, 2019 · 1 comment


Copy link

@ingvarha ingvarha commented Jan 9, 2019

I got the following bug report for Fedora.

Note that gcc-9 is not available readily wrapped for fedora yet, this is only a pre warning, so I have not had the opportunity to dig into this yet myself. There are only some 8 calls to printf in vnum.c (varnish-6.1.1), so it should not be too difficult to track this down, I guess.


From: Jeff Law
Subject: Preparing for gcc-9 upgrade in Fedora -- your package is going to fail to build

I'm writing you because you have a package that will fail to build in Fedora once the compiler team drops in gcc-9.

In particular your package is calling one of the printf family of routines with a %s directive and a NULL argument for that directive. gcc-9 is better at discovering these than prior GCC versions.

BUILDSTDERR: In file included from /usr/include/stdio.h:867,
BUILDSTDERR: from vnum.c:36:
BUILDSTDERR: In function 'printf',
BUILDSTDERR: inlined from 'main' at vnum.c:356:4:
BUILDSTDERR: /usr/include/bits/stdio2.h:107:10: error: '%s' directive argument is null [-Werror=format-overflow=]
BUILDSTDERR: 107 | return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
BUILDSTDERR: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BUILDSTDERR: cc1: all warnings being treated as errors

Copy link

@bsdphk bsdphk commented Jan 11, 2019

In general I do not consider {"%s", NULL} an error, it is well established practice and very convenient i testing and debugging contexts like this one.

Have fixed it anyway, as I found the code could be simplified at the same time.

@bsdphk bsdphk closed this in 7119d79 Jan 11, 2019
hermunn added a commit to hermunn/varnish-cache that referenced this issue Nov 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants