[llvm-bugs] [Bug 27645] New: Wrong "error: cannot jump from this indirect goto statement to one of its possible targets"

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 4 08:17:52 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=27645

            Bug ID: 27645
           Summary: Wrong "error: cannot jump from this indirect goto
                    statement to one of its possible targets"
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: cherepan at mccme.ru
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Source code:

----------------------------------------------------------------------
int main()
{
  void *p = &&first;
  goto *p;

 first:;

  int n = 1;
  char a[n];

  void *q = &&second;
  goto *q;

 second:;
}
----------------------------------------------------------------------

Results:

----------------------------------------------------------------------
$ clang -std=gnu11 test.c && ./a.out
test.c:4:3: error: cannot jump from this indirect goto statement to one of its
possible targets
  goto *p;
  ^
test.c:14:2: note: possible target of indirect goto statement
 second:;
 ^
test.c:9:8: note: jump bypasses initialization of variable length array
  char a[n];
       ^
1 error generated.
----------------------------------------------------------------------

clang version: clang version 3.9.0 (trunk 268228)

The source code is safe and the clang error is wrong. OTOH my testcase is
artificial and maybe better analysis just doesn't worth the trouble.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160504/95119ba8/attachment-0001.html>


More information about the llvm-bugs mailing list