[llvm-bugs] [Bug 34092] New: Misleading warning produced for tentative array definition

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Aug 6 07:32:42 PDT 2017


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

            Bug ID: 34092
           Summary: Misleading warning produced for tentative array
                    definition
           Product: clang
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rda at lemma-one.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 18918
  --> https://bugs.llvm.org/attachment.cgi?id=18918&action=edit
Example of tentative definitions. Compile with clang -o tentative tentative.c

It is valid (if strange) C to give a tentative definition of an array with an
array bound unspecified and then specify the bound in a subsequent declaration.
clang immediately issues a warning "tentative array definition assumed to have
one element" when it encounters the tentative definition. This is misleading
because the compiler should not make that assumption until it has processed the
entire translation unit and found that the composite type has an unspecified
bound. (See C99 section 6.9.2 External Object Definitions, particularly Example
2.)

The attached example shows that the compiler is actually conforming with the
standard despite the warning.

-- 
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/20170806/5668fd0a/attachment.html>


More information about the llvm-bugs mailing list