<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - overrestrictive asm goto gotolabels limitations"
   href="https://bugs.llvm.org/show_bug.cgi?id=45903">45903</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>overrestrictive asm goto gotolabels limitations
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>10.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jacob@shuf.ro
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>First of all, I apologize if this is the wrong venue for this bug report.
The following does not compile, even though I believe it should:
---------------------------------------------------
cleanup_cb(*p1) {}

foo(int n) {
  int cond;

  if (({
        asm goto("" ::"r"(cond) : : label0);
        1;
      }))
  label0:;

  int a[n];

  if (({
        asm goto("" ::"r"(cond) : : label1);
        1;
      }))
  label1:;

}

main() {}
---------------------------------------------------
jshufro@660:~/asmgoto$ clang-10 main.c
main.c:1:13: warning: type specifier missing, defaults to 'int'
[-Wimplicit-int]
cleanup_cb(*p1) {}
            ^
main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
cleanup_cb(*p1) {}
^
main.c:1:18: warning: non-void function does not return a value [-Wreturn-type]
cleanup_cb(*p1) {}
                 ^
main.c:3:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
foo(int n) {
^
main.c:7:9: error: cannot jump from this asm goto statement to one of its
possible targets
        asm goto("" ::"r"(cond) : : label0);
        ^
main.c:18:3: note: possible target of asm goto statement
  label1:;
  ^
main.c:12:7: note: jump bypasses initialization of variable length array
  int a[n];
      ^
main.c:22:1: warning: type specifier missing, defaults to 'int'
[-Wimplicit-int]
main() {}
^
5 warnings and 1 error generated.
---------------------------------------------------

This is C-Reduced to be fairly minimal. Replacing the variable length array
with an __attribute__((cleanup)) variable causes a similar issue. It's worth
noting that the error is noting a possible target of asm goto that isn't listed
in the GoToLabels.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>