From: julia.lawall@lip6.fr (Julia Lawall)
To: cocci@systeme.lip6.fr
Subject: [Cocci] Analysis for Linux source files
Date: Mon, 15 Apr 2013 16:29:29 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.02.1304151626120.1961@hadrien> (raw)
In-Reply-To: <1365433540.3314.49.camel@zamolxis.metaware.tm.fr>
Attached is a patch. The line numbers may be off, but it should apply to
the latest version. It causes a match failure for the following semantic
patch:
@r@
type T;
identifier x;
position p;
@@
T at p x;
@script:python@
T << r.T;
@@
print "before"
print T
print "after"
when applied to the following code:
int main () {
register x;
return 0;
}
The type metavariable would have been matched to the implicit "int", but
this implicit int doesn't have a position, so the match of the position
variable fails. On the other hand, there is no more crash.
julia
-------------- next part --------------
diff --git a/engine/cocci_vs_c.ml b/engine/cocci_vs_c.ml
index 4d12515..26a479c 100644
--- a/engine/cocci_vs_c.ml
+++ b/engine/cocci_vs_c.ml
@@ -2820,7 +2820,13 @@ and (fullTypebis: (A.typeC, Ast_c.fullType) matcher) =
match ty with
B.NoType -> false
| _ -> true in
- if type_present
+ let position_required_but_unavailable =
+ match A.get_pos_var ida with
+ [] -> false
+ | _ ->
+ let (tyq, (ty, tyii)) = typb in
+ List.for_all Ast_c.is_fake tyii in
+ if type_present && not position_required_but_unavailable
then
let max_min _ =
Lib_parsing_c.lin_col_by_pos (Lib_parsing_c.ii_of_type typb) in
next prev parent reply other threads:[~2013-04-15 14:29 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.1.1364983201.25969.cocci@systeme.lip6.fr>
2013-04-08 14:29 ` [Cocci] Analysis for Linux source files Nic Volanschi (R&D)
2013-04-08 14:54 ` Julia Lawall
2013-04-08 14:56 ` Julia Lawall
2013-04-08 15:05 ` Nic Volanschi (R&D)
2013-04-15 14:29 ` Julia Lawall [this message]
2013-04-08 21:14 ` [Cocci] Handling of omitted data type specification? SF Markus Elfring
2013-04-09 5:19 ` Julia Lawall
2013-04-02 10:12 [Cocci] Analysis for Linux source files SF Markus Elfring
2013-04-02 11:45 ` Julia Lawall
2013-04-02 12:14 ` SF Markus Elfring
2013-04-02 12:47 ` Julia Lawall
2013-04-02 15:17 ` SF Markus Elfring
2013-04-02 15:23 ` Julia Lawall
2013-04-02 15:30 ` SF Markus Elfring
2013-04-02 15:48 ` Julia Lawall
2013-04-02 16:21 ` Julia Lawall
2013-04-02 15:24 ` Julia Lawall
2013-04-02 15:37 ` SF Markus Elfring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.02.1304151626120.1961@hadrien \
--to=julia.lawall@lip6.fr \
--cc=cocci@systeme.lip6.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox