https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122835

--- Comment #24 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Regarding C++, we already do the right thing:
struct S { S (); ~S (); };

void
foo ()
{
  asm goto ("" : : : : l0, l1);
l0:
  S s;
l1:
  {
    S t;
l2:;
  }
  asm goto ("" : : : : l2, l3);
l3:;
}

a.C: In function ‘void foo()’:
a.C:9:1: error: jump to label ‘l1’
    9 | l1:
      | ^~
a.C:6:28: note:   from here
    6 |   asm goto ("" : : : : l0, l1);
      |                            ^~
a.C:8:5: note:   crosses initialization of ‘S s’
    8 |   S s;
      |     ^
a.C:12:1: error: jump to label ‘l2’
   12 | l2:;
      | ^~
a.C:14:24: note:   from here
   14 |   asm goto ("" : : : : l2, l3);
      |                        ^~
a.C:11:7: note:   skips initialization of ‘S t’
   11 |     S t;
      |       ^

Reply via email to