Hi, I'm trying to write a pattern to match expression without side-effects, i.e expression E but not i++, --i, function call.
While trying to write it I faced that this expression matches different array indices. Actually, it's quite unexpected for me: @@ expression E; identifier A; @@ * E->A || E->A Actually, I would expect it not to match the file at all: $ spatch --cocci-file ./test.cocci ./drivers/md/dm-clone-metadata.c init_defs_builtins: /usr/lib64/coccinelle/standard.h HANDLING: ./drivers/md/dm-clone-metadata.c diff = --- ./drivers/md/dm-clone-metadata.c +++ /tmp/cocci-output-11041-66b4fb-dm-clone-metadata.c @@ -947,7 +947,6 @@ bool dm_clone_changed_this_transaction(s unsigned long flags; spin_lock_irqsave(&cmd->bitmap_lock, flags); - r = cmd->dmap[0].changed || cmd->dmap[1].changed; spin_unlock_irqrestore(&cmd->bitmap_lock, flags); return r; Thanks, Denis _______________________________________________ Cocci mailing list [email protected] https://systeme.lip6.fr/mailman/listinfo/cocci
