LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 26468 - -Wuninitialized warning on empty struct
Summary: -Wuninitialized warning on empty struct
Status: NEW
Alias: None
Product: clang
Classification: Unclassified
Component: -New Bugs (show other bugs)
Version: trunk
Hardware: PC Linux
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-03 19:45 PST by H.J. Lu
Modified: 2016-02-03 19:45 PST (History)
1 user (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2016-02-03 19:45:36 PST
[hjl@gnu-6 empty-2]$ cat x.c
struct empty {};

struct empty
foo (void)
{
  struct empty s;
  return s;
}
[hjl@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@gnu-6 empty-2]$ 

Shouldn't empty struct be a special case here?