Fixed a bug .
ExistingInit was a null pointer, so I added a check.
After this change, I could get similar result as GCC .
yamaguchi on Apr 2 2017, 9:56 PM.Authored by
Fixed a bug .
Please fix these things:
~/llvm/build/bin/clang -cc1 test.c test.c:41:6: error: field designator 'dog' does not refer to any field in type 'struct_0' .dog = 0x00000000, ^ warning: initializer overrides prior initialization of this subobject
The warning: is obviously missing the note: Previous initialization here and doesn't make a lot of sense that way, so let's skip the whole thing altogether. We should check if ExistingInit is a nullptr before we start printing the warning (which is a few lines above the note printing).
Moved if (ExistingInit) above, so that warning will not printed without notes, and fixed indents.
Is this a minimal test case that can produce the issue? It'd be awesome if you can reduce it.
sema-segvcheck.c is not a good name for this test because that name can be used for any crash bug. You want to see other files in the same directory to name your file so that it's consistent with other files. If you don't come up with a name, I'd name it pr32280.c.
@yamaguchi, I'd support Akira's comment. Could you place the minimal test example in the suggested file?
I've been trying to minimal the testcase, add comments to describe what it is testing, and fix styles of the testcase properly.