Re: [cocci] Searching for duplicate exception handling code with SmPL?

Julia Lawall <[email protected]> Sun, 14 Jun 2026 23:28:50 +0200 (CEST)
Newsgroups fr.inria.cocci
Message-ID <[email protected]>
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--8323329-1915855904-1781472530=:99844
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8BIT



On Sun, 14 Jun 2026, Markus Elfring wrote:

> >> Questionable test result:
> >> Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> time /usr/bin/spatch ../janitor/list_selected_duplicate_statements_in_if_branches3.cocci test-insufficient_goto_chain_usage.c
> >> …
> >> info|my_test|md1|rc
> >> first|test-insufficient_goto_chain_usage.c|12|5
> >> tail|test-insufficient_goto_chain_usage.c|36|2
> >> info|my_test|md1|rc
> >> first|test-insufficient_goto_chain_usage.c|36|2
> >> tail|test-insufficient_goto_chain_usage.c|36|2
> >
> > Could you please explain what the output actually means?
>
> Data are displayed from fields of SmPL position variables,
> aren't they?
>
> Did you notice that the data display amount is different between the discussed implementations
> of the functions “my_test” and “snd_seq_fifo_new”?
> How would you explain such a remarkable information difference?

I suspect that your problem is just that the control flow in an if leads
across a goto, and two ifs that least to the same place are considered to
contain the same code.  It should be sufficient to say when != goto l1;
and when != goto l2; on the ...s before the kfree calls to avoid this
behavior.

julia
--8323329-1915855904-1781472530=:99844--