[llvm-bugs] [Bug 42604] New: -Wuninitialized for struct assignment from GNU C statement expression
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Jul 12 09:37:05 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42604
Bug ID: 42604
Summary: -Wuninitialized for struct assignment from GNU C
statement expression
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: C
Assignee: unassignedclangbugs at nondot.org
Reporter: ndesaulniers at google.com
CC: arnd at linaro.org, blitzrakete at gmail.com,
dgregor at apple.com, erik.pilkington at gmail.com,
llvm-bugs at lists.llvm.org, natechancellor at gmail.com,
richard-llvm at metafoo.co.uk, srhines at google.com
Consider the following example:
void init(int*);
void foo(void) {
int i = ({
init(&i);
i;
});
}
struct widget {
int x, y;
};
void init2(struct widget*);
void bar(void) {
struct widget my_widget = ({
init2(&my_widget);
my_widget;
});
}
warning: variable 'my_widget' is uninitialized when used within its own
initialization [-Wuninitialized]
It seems like it's ok to do so for non-aggregate types, but aggregates issue
the warning. I think it should not be a warning 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/20190712/00046b3b/attachment.html>
More information about the llvm-bugs
mailing list