Overview
| Artifact ID: | 76a40b3dac35ec8df6032a083fd523c1c2198a6077766e4c43c30695fdaef50e |
|---|---|
| Ticket: | 167e0635db79f05d23d766376f6eed32b1572451
`make valgrind` detections |
| User & Date: | sebres on 2024-04-05 21:37:56 |
Changes
- icomment:
@Jan, of course I meant the regular (integer) case.<br/> One could surely do it with type-check, as you suggest, however in clockmod (8.6 based) there were several int-types (int32, wide), but with that thing I wanted just fast avoid additional shimmer from whatever type (unicode, string with utf-8, future objects like clock-seconds, etc with theoretic fast conversion to integer), since unneeded shimmer is always bad... Thus it was made how it made.<br/> And it is not "optimization", this is very quick and simple trick. But back to valgrind...<br/> I don't follow the first claim: To have uninitialized value in that condition, `baseObj->length` or `baseObj->bytes` needs to be uninitialized, because `baseObj` is always initialized either within `TclNewObj` & co or to NULL by memset in `ClockInitFmtScnArgs`. So I don't follow the issue why valgrind may complain. Also I don't follow the second claim: To have uninitialized value in CreateHashEntry (tclHash.c:288) from FindOrCreateFmtScnStorage (tclClockFmt.c:800) the last must use `strFmt` (and related `key`) uninitialized, but it is obtained by `TclGetString(objPtr)` in (tclClockFmt.c:777), so this is basically impossible (unless something makes hash-table corrupt and it is rather `hPtr->key.oneWordValue` in the condition where valgrind complains). ```c // tclHash.c: 240 static Tcl_HashEntry * 241 CreateHashEntry( 242 Tcl_HashTable *tablePtr, /* Table in which to lookup entry. */ 243 const char *key, /* Key to use to find or create matching 244 245 * entry. */ ... 288 if ((key == hPtr->key.oneWordValue) // tclClockFmt.c: 772 static ClockFmtScnStorage * 773 FindOrCreateFmtScnStorage( 774 Tcl_Interp *interp, 775 Tcl_Obj *objPtr) 776 { 777 const char *strFmt = TclGetString(objPtr); ... 800 hPtr = Tcl_CreateHashEntry(&FmtScnHashTable, strFmt, &isNew); ``` Bug in valgrind? Bug in 9.0 somewhere? Anyway I don't reproduce it, neither for 8.7 nor 9.0 with my valgrind / gcc: ``` $ valgrind --version valgrind-3.19.0 $ gcc --version gcc (Debian 12.2.0-14) 12.2.0 ``` - login: "sebres"
- mimetype: "text/x-markdown"