.
D 2023-10-07T12:30:45.442
J assignee nobody
J closer nobody
J cmimetype text/x-fossil-wiki
J comment LLVM\sClang\s17\smakes\s<tt>-fsanitize=function</tt>\savailable\sfor\sC\s(previously\sit\swas\sjust\sfor\sC++).\sIt\sis\simplied\sby\s<tt>-fsanitize=undefined</tt>.\sIt\scomplains\sabout\scalls\sto\s<tt>freeProc(clientData)</tt>\sfrom\s<tt>Tcl_EventuallyFree()</tt>\sand\s<tt>Tcl_Release()</tt>.\sUnlike\swarnings\sfrom\se.g.\s<tt>-Wincompatible-function-pointer-types</tt>,\sthis\sUBSan\serror\sis\snot\ssuppressed\sby\scasts\sto\s<tt>(Tcl_FreeProc\s*)</tt>.\sExample\swhen\sexiting\stclsh:\r\n<pre>\r\n<span\sstyle="font-weight:bold">tcl/generic/tclPreserve.c:229:3:\s<span\sstyle="color:firebrick">runtime\serror:</span>\scall\sto\sfunction\sDeleteInterpProc\sthrough\spointer\sto\sincorrect\sfunction\stype\s'void\s(*)(char\s*)'\r\ntclBasic.c:1422:\s<span\sstyle="color:gray">note:</span></span>\sDeleteInterpProc\sdefined\shere\r\nSUMMARY:\sUndefinedBehaviorSanitizer:\sundefined-behavior\stcl/generic/tclPreserve.c:229:3\sin\s\r\n</pre>\r\nThere\sare\sonly\sa\sfew\sof\sinstances\sof\sthis\sin\score\sTcl;\sto\spatch\sthese,\sI\sremove\scasts\sto\s<tt>(Tcl_FreeProc\s*)</tt>,\sthen\suse\sthe\s<tt>Tcl_FreeProc</tt>\stypedef\sfor\sfunction\sdeclarations,\sand\sthen\sfix\sfunction\sdefinitions.\sThere\sare\sseveral\smore\sinstances\sin\score\sTk\swhich\sI\sam\slooking\sinto\spatching.\sAny\sextensions\spassing\sincompatible\sfunction\spointers\sto\s<tt>Tcl_EventuallyFree()</tt>\swill\salso\strigger\sthis\sUBSan\serror.
J foundin 8.6.13
J is_private 0
J login chrstphrchvz
J priority 5\sMedium
J private_contact 6133eb3026f9b10aa9b7b48da92ae2834fc225b0
J resolution None
J severity Minor
J status Open
J submitter chrstphrchvz
J subsystem 42.\sMemory\sPreservation
J title Do\snot\spass\sincompatible\sfunction\spointers\sto\sTcl_EventuallyFree()
J type Patch
K 8ab8a138c9156e5a5a4a386310c6fd11608b8805
U chrstphrchvz
Z 5eaafdae8a061f5303f68714e05f6473