[cfe-dev] Likely problem in canonical declaration

Abramo Bagnara abramobagnara at tin.it
Thu Jan 14 09:44:31 PST 2010


Compiling this snippet:

void foo() {
  int i;
  __sync_fetch_and_add(&i, 1);
  __sync_fetch_and_add(&i, 1);
}

I get for builtin call to __sync_fetch_and_add_4 two different Decl* and
although I found this a bit strange I've thought this is not a big problem.

What I think dangerous is that these two Decl* does not have neither the
same value for getCanonicalDecl(), so I guess they're considered two
distinct functions.

Do you confirm that this behaviour is symptom of a bug?





More information about the cfe-dev mailing list