[PATCH] D154696: [Clang] Diagnose jumps into statement expressions

Nathan Chancellor via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 13 16:30:45 PDT 2023


nathanchance added a comment.

I suspect this is the same issue but our CI pointed out another instance of this error in some x86 code (https://storage.tuxsuite.com/public/clangbuiltlinux/continuous-integration2/builds/2SW8BY7moEweMJC6DJpzidlGYt8/build.log), which does not appear to use local labels with the same name, but rather unique label names. `cvise` spits out:

  void emulator_cmpxchg_emulated() {
    int __ret = ({
      asm goto(" .pushsection \"__ex_table\",\"a\"\n"
               " .popsection\n"
               :
               :
               :
               : efaultu16);
      __ret;
    });
  efaultu16:
    ({
      asm goto(" .pushsection \"__ex_table\",\"a\"\n"
               " .popsection\n"
               :
               :
               :
               : efaultu32);
    efaultu32:;
    });
  }



  $ clang -fsyntax-only x86.i
  x86.i:3:5: error: cannot jump from this asm goto statement to one of its possible targets
      3 |     asm goto(" .pushsection \"__ex_table\",\"a\"\n"
        |     ^
  x86.i:19:3: note: possible target of asm goto statement
     19 |   efaultu32:;
        |   ^
  x86.i:12:3: note: jump enters a statement expression
     12 |   ({
        |   ^
  1 error generated.

which certainly seems bogus to me.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154696/new/

https://reviews.llvm.org/D154696



More information about the cfe-commits mailing list