Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Feb 2016 16:57:50 -0800
From:      Steve Kargl <sgk@troutmask.apl.washington.edu>
To:        freebsd-toolchain@freebsd.org
Subject:   confusing messages from clang
Message-ID:  <20160220005749.GA84382@troutmask.apl.washington.edu>

next in thread | raw e-mail | index | archive | help
If anyone is interesting fixing FreeBSD's C compiler, it
would be appreciated.

% cat foo.c
#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");
}

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


No, I did not mean crypt.  'corrupt' is a defined label.
The missing semicolon occurs in line 19, but the line is
not properly identified in error output.

-- 
Steve



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160220005749.GA84382>