This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: -ftree-check for review


On 5/9/07, Nic Volanschi <nic.volanschi@free.fr> wrote:

Hi Andrew,


Nice example! But it perfectly works, in both cases, and even others. Let's
consider the file:

#include <stdio.h>

#define N 10

void kix_o_main() {
  int a[N], i, j, k, *p;
  FILE *f;

  f = fopen("in", "rw");
  f = fopen("in", &"rw"[0]);
  f = fopen("in", &"11\0rw"[3]);
  f = fopen("in", "11\0rw"+3);

  if(p == NULL)
    a[i] = a[i] * k + j;

  return;
}

So, let's try:

[nic@paco C]$ ~/Gcc/graphite/inst/bin/gcc -c --tree-check="%X=fopen(%_,%Y)"
--tree-checks-verbose --dump-tree-gimple c.c
c.c: In function 'kix_o_main':
c.c:9: warning: user-defined warning %X=fopen(%_,%Y): .
c.c:9: instance = {X <- f, Y <- &"rw"[0]},
c.c:9: reached: f = f.0.
c.c:10: warning: user-defined warning %X=fopen(%_,%Y): .
c.c:10: instance = {X <- f, Y <- &"rw"[0]},
c.c:10: reached: f = f.1.
c.c:11: warning: user-defined warning %X=fopen(%_,%Y): .
c.c:11: instance = {X <- f, Y <- D.2121},
c.c:11: reached: f = f.2.
c.c:12: warning: user-defined warning %X=fopen(%_,%Y): .
c.c:12: instance = {X <- f, Y <- D.2123},
c.c:12: reached: f = f.3.

Everything is there!

But that is not the example you gave before, I want to match "rw" strings using what you gave: gcc --tree-check="%_ = fopen(%_, "rw")" *.c

So it does not work as you expected or even asked for really.

Thanks,
Andrew Pinski


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]