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

--- Comment #3 from Alibek Omarov <a1ba.omarov at gmail dot com> ---
It indeed looks similar, but looking at the error (sorry, forgot to post it as
well):
<source>:37:25: error: '_Mem_Free.constprop' called on pointer returned from a
mismatched allocation function [-Werror=mismatched-dealloc]
   37 | #define Mem_Free( mem ) _Mem_Free( mem, __FILE__, __LINE__ )
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<source>:56:17: note: in expansion of macro 'Mem_Free'
   56 |                 Mem_Free( tempbuff );
      |                 ^~~~~~~~
<source>:36:34: note: returned from '_Mem_Alloc.constprop'
   36 | #define Mem_Malloc( pool, size ) _Mem_Alloc( pool, size, false,
__FILE__, __LINE__ )
      |                                 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<source>:50:36: note: in expansion of macro 'Mem_Malloc'
   50 |                 tempbuff = (char *)Mem_Malloc( fs_mempool, buff_size );
      |                                    ^~~~~~~~~~
<source>:37:25: error: '_Mem_Free.constprop' called on pointer returned from a
mismatched allocation function [-Werror=mismatched-dealloc]
   37 | #define Mem_Free( mem ) _Mem_Free( mem, __FILE__, __LINE__ )
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<source>:61:9: note: in expansion of macro 'Mem_Free'
   61 |         Mem_Free( tempbuff );
      |         ^~~~~~~~
<source>:36:34: note: returned from '_Mem_Alloc.constprop'
   36 | #define Mem_Malloc( pool, size ) _Mem_Alloc( pool, size, false,
__FILE__, __LINE__ )
      |                                 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<source>:50:36: note: in expansion of macro 'Mem_Malloc'
   50 |                 tempbuff = (char *)Mem_Malloc( fs_mempool, buff_size );
      |                                    ^~~~~~~~~~
cc1: all warnings being treated as errors

It seems that it doesn't take into account all possible cases of function
clone. There it shows error on cloned `Mem_Free.constprop`, allocated from
cloned `Mem_Alloc.constprop`. 

While I was figuring out the cause, one of the examples actually didn't trigger
a bug on 13.x, 14.x and trunk but did on earlier versions. It seems something
has been definitely changed on how GCC treats alloc-free with function clones.

Reply via email to