Re: gl_linked_iterator doesn't initialize all fields.

2024-05-11 Thread Collin Funk
Hi Bruno, Thanks for the explanations. On 5/11/24 6:06 AM, Bruno Haible wrote: >> But my instinct tells me these initializations should be done >> unconditionally so undefined behavior is avoided. > > There is no undefined behaviour here, only a false alarm. My thinking was that if iterator.coun

Re: gl_linked_iterator doesn't initialize all fields.

2024-05-11 Thread Bruno Haible
Hi Collin, > Here is the function that it is warning about: > > static gl_list_iterator_t _GL_ATTRIBUTE_PURE > gl_linked_iterator (gl_list_t list) > { > gl_list_iterator_t result; > > result.vtable = list->base.vtable; > result.list = list; > result.p = list->root.next; > result.q = &l

gl_linked_iterator doesn't initialize all fields.

2024-05-11 Thread Collin Funk
When compiling with -fanalyzer and including gl_anylinked_list2.h I see this: In file included from gl_linked_list.c:29: gl_anylinked_list2.h: In function 'gl_linked_iterator': gl_anylinked_list2.h:952:10: warning: use of uninitialized value 'result.count' [CWE-457] [-Wanalyzer-use-of-uninitializ