[LLVMbugs] [Bug 16883] New: if declaration and definition of a function differ in scope, emit a warning

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Aug 14 05:19:24 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=16883

            Bug ID: 16883
           Summary: if declaration and definition of a function differ in
                    scope, emit a warning
           Product: clang
           Version: 3.3
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: alexander.huemer at xx.vu
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Hi,

i just stumbled upon a piece of code like this:

static int foo(void);

int foo(void)
{
        volatile int a = 3;

        return a;
}

According to http://std.dkuug.dk/JTC1/SC22/open/n2620/n2620.txt --> 6.1.2.2 #7
the behavior in this situation is undefined.

       If, within a  translation  unit,  the  same  identifier
       appears   with  both  internal  and  external  linkage,  the
       behavior is undefined.

Steps to Reproduce:
the code above goes into foo.c
$ clang -Weverything -c foo.c

Actual Results:
clang does not emit a warning when compiling with -Weverything.
scan-build does not warn either, with all checkers enabled.

Expected Results:
clang should emit a warning when compiling such code.

-- 
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/20130814/bd84c2cf/attachment.html>


More information about the llvm-bugs mailing list