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

            Bug ID: 26678
           Summary: Confusing note and error message from Clang
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangb...@nondot.org
          Reporter: 1101.deb...@gmail.com
                CC: llvm-bugs@lists.llvm.org
    Classification: Unclassified

Upon attempt to compile this code:

#include <stdio.h>
#include <unistd.h>

void
foo(int i)
{
  if (i < 0)
     goto whoops;

  if (i == 0)
     printf("foo\n");

  if (i > 0)
     goto corrupt;
  return;

whoops:
  printf("whoops\n");
  return

corrupt:
  printf("corrupt\n");
}

Clang prints the following:

foo.c:21:1: error: use of undeclared identifier 'corrupt'; did you mean
'crypt'?
corrupt:
^~~~~~~
crypt
/usr/include/unistd.h:542:7: note: 'crypt' declared here
char    *crypt(const char *, const char *);
         ^
foo.c:21:8: error: expected ';' after return statement
corrupt:
       ^
       ;
foo.c:14:11: error: use of undeclared label 'corrupt'
     goto corrupt;
          ^
3 errors generated.

Which is not correct, since 'corrupt' is correct label, even though it's
defined after incorrect line ('return' statement doesn't terminate with ';')

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to