Re: Possible UNINIT bug within man-db gl sources

2024-08-27 Thread Paul Eggert
On 2024-08-27 04:15, Marc Nieper-Wißkirchen wrote: However, see the second code block in Example 4 of section 6.7.3.1 (in the latest draft of C23). This may, of course, be itself an error as the example is about restrict and not about uninitialized structs. Yes, that example sheds no light on

Re: Possible UNINIT bug within man-db gl sources

2024-08-27 Thread Marc Nieper-Wißkirchen
Am Do., 22. Aug. 2024 um 07:27 Uhr schrieb Paul Eggert : > On 2024-08-21 06:36, Bruno Haible wrote: > > In summary, this paragraph makes no sense for structs. > > Hmm, well, the paragraph makes sense to me. I suppose somebody could > fire off a question to the C committee about the intent of the p

Re: Possible UNINIT bug within man-db gl sources

2024-08-21 Thread Collin Funk
Paul Eggert writes: >> that 'return (struct ...) { initializers }' >> produces particularly good code with modern compilers) > > Yeah, that's partly why I weighed in on this seemingly-obscure topic. > I like the more-functional style and wouldn't want "undefined > behavior" to get in its way

Re: Possible UNINIT bug within man-db gl sources

2024-08-21 Thread Paul Eggert
On 2024-08-21 06:36, Bruno Haible wrote: In summary, this paragraph makes no sense for structs. Hmm, well, the paragraph makes sense to me. I suppose somebody could fire off a question to the C committee about the intent of the paragraph. In the meantime it's an engineering decision - should

Re: Possible UNINIT bug within man-db gl sources

2024-08-21 Thread Bruno Haible
Paul Eggert wrote: > > Copying and then discarding an uninitialized value of integer > > or pointer type (i.e. not a signalling NaN (*)) is not undefined behaviour. > > Although that's how typical implementations behave, the C standard says > that copying from a source variable has undefined beha

Re: Possible UNINIT bug within man-db gl sources

2024-08-20 Thread Lukas Javorsky
Is this patch necessary? The elements of the structure are initialized prior to the return statement. Since the `i`, `j`, and `count` are not really used, I feel like the SAST report I've sent can be marked as a false positive. Do you agree? On Sat, Aug 17, 2024 at 7:17 AM Paul Eggert wrote: >

Re: Possible UNINIT bug within man-db gl sources

2024-08-16 Thread Paul Eggert
On 2024-08-16 07:30, Bruno Haible wrote: Copying and then discarding an uninitialized value of integer or pointer type (i.e. not a signalling NaN (*)) is not undefined behaviour. Although that's how typical implementations behave, the C standard says that copying from a source variable has und

Re: Possible UNINIT bug within man-db gl sources

2024-08-16 Thread Bruno Haible
Hi, Lukas Javorsky wrote: > From my analysis, I believe that if the `GCC_LINT` or `lint` macros > are not defined, the elements `i`, `j`, and `count` from the > `gl_map_iterator_t` struct are not initialized Correct. They are not initialized because they are not used. Look at the gl_tree_iterato

Possible UNINIT bug within man-db gl sources

2024-08-16 Thread Lukas Javorsky
Hi, I'm analyzing the results of SAST reports (combination of coverity,snyk,cppcheck,gcc,clang,shellcheck,unicontrol), and from 20 findings I identified a few that might be a true positive. However, I would like to ask you for the help to resolve it, as I'm not 100% aware of the code internals.