nginx 1.24 + njs build errors [-Werror=dangling-pointer=] after switch from GCC 12 (Fedora 37) -> GCC13 (Fedora 38)

PGNet Dev pgnet.dev at gmail.com
Tue Apr 18 17:26:44 UTC 2023


I'm building nginx mainline v1.24 on Fedora.

on F37, with gcc 12,

	gcc --version
		gcc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4)
		Copyright (C) 2022 Free Software Foundation, Inc.
		This is free software; see the source for copying conditions.  There is NO
		warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


build's good.

Upgrading to today's new/latest F38, with gcc 13,

	gcc --version
		gcc (GCC) 13.0.1 20230401 (Red Hat 13.0.1-0)
		Copyright (C) 2023 Free Software Foundation, Inc.
		This is free software; see the source for copying conditions.  There is NO
		warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

builds for target F38+ fail @ dangling-pointer errors,

	...
	src/njs_iterator.c: In function 'njs_object_iterate':
	src/njs_iterator.c:358:25: error: storing the address of local variable 'string_obj' in '*args.value' [-Werror=dangling-pointer=]
	  358 |             args->value = &string_obj;
	      |             ~~~~~~~~~~~~^~~~~~~~~~~~~
	...
	cc1: all warnings being treated as errors

adding

	-Wno-dangling-pointer

to build flags worksaround it, with successful build.

for ref,

FAILED build log:

	https://download.copr.fedorainfracloud.org/results/pgfed/nginx-mainline/fedora-38-x86_64/05802768-nginx/build.log.gz

OK build log:

	https://download.copr.fedorainfracloud.org/results/pgfed/nginx-mainline/fedora-38-x86_64/05802814-nginx/build.log.gz

I'm checking to see whether the error flag was added to GCC 13 upstream, or just to Redhat/Fedora flags ...


More information about the nginx-devel mailing list