[llvm-bugs] [Bug 26468] New: -Wuninitialized warning on empty struct

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Feb 3 17:45:36 PST 2016


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

            Bug ID: 26468
           Summary: -Wuninitialized warning on empty struct
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hjl.tools at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

[hjl at gnu-6 empty-2]$ cat x.c
struct empty {};

struct empty
foo (void)
{
  struct empty s;
  return s;
}
[hjl at gnu-6 empty-2]$ make
/export/build/gnu/llvm-clang-bootstrap/stage1/build-x86_64-linux/bin/clang -m32
-S -O -Wall x.c
x.c:7:10: warning: variable 's' is uninitialized when used here
      [-Wuninitialized]
  return s;
         ^
x.c:6:3: note: variable 's' is declared here
  struct empty s;
  ^
1 warning generated.
[hjl at gnu-6 empty-2]$ 

Shouldn't empty struct be a special case here?

-- 
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/20160204/873b4b8a/attachment.html>


More information about the llvm-bugs mailing list