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: unassignedclangb...@nondot.org
          Reporter: ndesaulni...@google.com
                CC: a...@linaro.org, blitzrak...@gmail.com,
                    dgre...@apple.com, erik.pilking...@gmail.com,
                    llvm-bugs@lists.llvm.org, natechancel...@gmail.com,
                    richard-l...@metafoo.co.uk, srhi...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to