------- Comment #1 from jakub at gcc dot gnu dot org  2010-03-22 18:01 -------
Well, in this particular case I believe it is correct.
In *.optimized we have:
f ()
{
<bb 2>:
  # DEBUG y => 1
  # DEBUG x => 1
  return 1;
}
where return 1, the only actual statement left, has the function body lexical
block as opposed to the nested lexical block, and as no insn is in the scope of
that block, it doesn't make any sense to emit it.

I have a different testcase though:
void
foo (int k, int l, int m, int n)
{
  l++;
  {
    int h = n;
    { int i = k; k++; }
    { int j = m; m++; }
  }
  asm volatile ("" : : "r" (k), "r" (l), "r" (m));
}
and the generated code on x86_64 has 3 addl $1, reg insns, and still optimizing
away the nested lexical blocks.  In this case I believe two of them should be
said to be in the inner scope.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43479

Reply via email to