https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111253

            Bug ID: 111253
           Summary: Dodgy pointer name (*_42 = PHI ...) in
                    -Wfree-nonheap-object diagnostic
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
            Blocks: 99098
  Target Milestone: ---

Created attachment 55823
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55823&action=edit
object_cache.i

With gcc-13 (Gentoo Hardened 13.2.1_p20230826 p7) 13.2.1 20230826:
```
/bin/sh ../libtool  --tag=CC   --mode=compile x86_64-pc-linux-gnu-gcc
-DHAVE_CONFIG_H -I. -I..    -fvisibility=hidden -pthread -std=gnu99 -O2 -pipe
-march=native -fdiagnostics-color=always -frecord-gcc-switch
es -Wreturn-type      -ggdb3 -Wall -Wmissing-prototypes -Wextra
-DLT_BUILDING_DLL=1 -c -o data-struct/object_cache.lo
data-struct/object_cache.c
libtool: compile:  x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I..
-fvisibility=hidden -pthread -std=gnu99 -O2 -pipe -march=native
-fdiagnostics-color=always -frecord-gcc-switches -Wreturn-type -ggdb3 -Wall
-Wmissing-prototypes -Wextra -DLT_BUILDING_DLL=1 -c data-struct/object_cache.c 
-fPIC -DPIC -o data-struct/.libs/object_cache.o
In function 'resize_memory_caches',
    inlined from 'find_cache' at data-struct/object_cache.c:211:4:
data-struct/object_cache.c:150:29: warning: 'realloc' called on pointer '*_42 =
PHI <lcs.14_40(29), lcs.19_48(30)>.t_mem_caches' with nonzero offset 640
[-Wfree-nonheap-object]
  150 |         lcs->t_mem_caches = realloc(lcs->t_mem_caches,
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
  151 |                                     lcs->t_mem_caches_total *
sizeof(struct local_cache));
      |                                    
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

gcc -O2 -c object_cache.i is enough to reproduce.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99098
[Bug 99098] invalid/missing -Wfree-nonheap-object warnings

Reply via email to