[llvm-bugs] [Bug 26678] New: Confusing note and error message from Clang

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Feb 19 23:27:14 PST 2016


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: unassignedclangbugs at nondot.org
          Reporter: 1101.debian at gmail.com
                CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160220/fad61f52/attachment-0001.html>


More information about the llvm-bugs mailing list