Re: [PATCH] opts: Add an assertion to help static analyzers [PR106332]

2022-07-27 Thread Richard Biener via Gcc-patches
On Wed, 27 Jul 2022, Jakub Jelinek wrote: > Hi! > > This function would have UB if called with empty candidates vector > (accessing p[-1] where p is malloc (0) result). > As analyzed in the PR, we never call it with empty vector, so this just > adds an assertion to make it clear. > > Bootstrappe

[PATCH] opts: Add an assertion to help static analyzers [PR106332]

2022-07-27 Thread Jakub Jelinek via Gcc-patches
Hi! This function would have UB if called with empty candidates vector (accessing p[-1] where p is malloc (0) result). As analyzed in the PR, we never call it with empty vector, so this just adds an assertion to make it clear. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?