public inbox for cocci@systeme.lip6.fr
 help / color / mirror / Atom feed
From: michelemartone@users.sourceforge.net (Michele Martone)
To: cocci@systeme.lip6.fr
Subject: [Cocci] [cocci-bug] coccinelle 1.0.6: OpenMP #pragma directive leads to function ignore
Date: Thu, 26 Apr 2018 10:12:09 +0200	[thread overview]
Message-ID: <20180426081209.GA7703@localhost> (raw)

Dear Prof. Lawall and Coccinelle team,

I'm an enthusiastical, however still beginner use of Coccinelle.

While running spatch 1.0.6 on a long OpenMP-enabled listing, I
noticed that the presence of the C line:
 #pragma omp parallel for reduction(+:I) private(I)
seems to prevent restructuring of the function containing it.
If I simplify the pragma to something like
 #pragma omp parallel
the problem disappears.

Is there anything I can do to restructure large codes containing
many of such similar lines ?

In the attachment you find a test case and the output I experience.

Best regards,
Michele
-------------- next part --------------
+ spatch --version
spatch version 1.0.6 compiled with OCaml version 4.05.0
Flags passed to the configure script: --host=i586-suse-linux-gnu --build=i586-suse-linux-gnu --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/lib --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --disable-dependency-tracking
Python scripting support: yes
Syntax of regular expresssions: PCRE
+ sed -i 's/^...pragma/#pragma  /g' pragma_ignored.c
+ cat pragma_ignored.c
void good(void)
{
 A[I]; /* not ignored */
}
void bad(void)
{
 A[I]; /* if pragma uncommented ignored by spatch 1.0.6  */
#pragma   omp parallel for reduction(+:I) private(I)
}
+ spatch --sp-file pragma_ignored.cocci pragma_ignored.c
init_defs_builtins: /usr/lib/coccinelle/standard.h
HANDLING: pragma_ignored.c
diff = 
--- pragma_ignored.c
+++ /tmp/di36pef/cocci-output-200330-4f22e8-pragma_ignored.c
@@ -1,6 +1,6 @@
 void good(void)
 {
- A[I]; /* not ignored */
+ A[J]; /* not ignored */
 }
 void bad(void)
 {
+ sed -i 's/^.pragma  /\/\/#pragma/g' pragma_ignored.c
+ cat pragma_ignored.c
void good(void)
{
 A[I]; /* not ignored */
}
void bad(void)
{
 A[I]; /* if pragma uncommented ignored by spatch 1.0.6  */
//#pragma omp parallel for reduction(+:I) private(I)
}
+ spatch --sp-file pragma_ignored.cocci pragma_ignored.c
init_defs_builtins: /usr/lib/coccinelle/standard.h
HANDLING: pragma_ignored.c
diff = 
--- pragma_ignored.c
+++ /tmp/di36pef/cocci-output-200335-2965e3-pragma_ignored.c
@@ -1,9 +1,9 @@
 void good(void)
 {
- A[I]; /* not ignored */
+ A[J]; /* not ignored */
 }
 void bad(void)
 {
- A[I]; /* if pragma uncommented ignored by spatch 1.0.6  */
+ A[J]; /* if pragma uncommented ignored by spatch 1.0.6  */
 //#pragma omp parallel for reduction(+:I) private(I)
 }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pragma_ignored.sh
Type: application/x-sh
Size: 345 bytes
Desc: not available
URL: <https://systeme.lip6.fr/pipermail/cocci/attachments/20180426/bb9498f0/attachment.sh>
-------------- next part --------------
void good(void)
{
 A[I]; /* not ignored */
}
void bad(void)
{
 A[I]; /* if pragma uncommented ignored by spatch 1.0.6  */
//#pragma omp parallel for reduction(+:I) private(I)
}
-------------- next part --------------
// pragma_ignored.cocci
// 
// $ spatch --version
// spatch version 1.0.6 compiled with OCaml version 4.05.0
// Flags passed to the configure script: --host=i586-suse-linux-gnu --build=i586-suse-linux-gnu --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/lib --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --disable-dependency-tracking
// Python scripting support: yes
// Syntax of regular expresssions: PCRE
// 
// 
// $ spatch --sp-file pragma_ignored.cocci  pragma_i
// 
// @@ -1,9 +1,9 @@
//  void good(void)
//  {
// - A[I]; /* not ignored */
// + A[J]; /* not ignored */
//  }
//  void bad(void)
//  {
// - A[I]; /* if pragma uncommented ignored by spatch 1.0.6  */
// + A[J]; /* if pragma uncommented ignored by spatch 1.0.6  */
//  //#pragma omp parallel for reduction(+:I) private(I)
//  }
// 
@@
symbol A,I,J;
@@

-A[I]
+A[J]

             reply	other threads:[~2018-04-26  8:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-26  8:12 Michele Martone [this message]
2018-04-26  8:25 ` [Cocci] [cocci-bug] coccinelle 1.0.6: OpenMP #pragma directive leads to function ignore Julia Lawall
2018-04-26 10:21   ` Michele Martone
2018-04-26 10:22     ` Julia Lawall
2018-04-30  6:43     ` Julia Lawall
2018-04-30  7:39       ` Michele Martone
2018-04-30  7:42         ` Julia Lawall
2018-04-30  7:47           ` Michele Martone
2018-04-30  7:44         ` Peter Senna Tschudin
2018-05-02 13:16           ` Michele Martone
2018-05-25 13:56             ` Michele Martone
2018-04-26 13:01   ` [Cocci] Coccinelle " 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=20180426081209.GA7703@localhost \
    --to=michelemartone@users.sourceforge.net \
    --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