https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115234
Bug ID: 115234
Summary: Wnull-dereference false-positive on address of local
variable
Product: gcc
Version: 14.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: lto
Assignee: unassigned at gcc dot gnu.org
Reporter: cgzones at googlemail dot com
Target Milestone: ---
$ gcc-14 --version
gcc-14 (Debian 14.1.0-1) 14.1.0
Reproducer:
git clone --depth 1 --branch 3.7-rc1
https://github.com/seLinuxProject/selinux.git
cd selinux/
make CC='gcc-14 -flto=auto' DESTDIR=/tmp/selinux_destdir SUBDIRS='libsepol
checkpolicy' -j"$(nproc)" install
```
In function ‘sepol_context_from_string’,
inlined from ‘context_from_string’ at ../libsepol/src/context.c:315:6,
inlined from ‘sepol_context_to_sid’ at ../libsepol/src/services.c:1300:6:
../libsepol/src/context_record.c:206:22: error: potential null pointer
dereference [-Werror=null-dereference]
206 | *con = NULL;
| ^
```
context_from_string():
298: sepol_context_t *ctx_record = NULL;
315: if (sepol_context_from_string(handle, con_cpy, &ctx_record) < 0)
sepol_context_from_string():
198: int sepol_context_from_string(sepol_handle_t * handle,
199: const char *str, sepol_context_t ** con)
206: *con = NULL;