Skip to content

anonymous unions and designated initializers do not work together #4150

@llvmbot

Description

@llvmbot
Bugzilla Link 3778
Resolution FIXED
Resolved on Mar 12, 2010 00:57
Version unspecified
OS All
Reporter LLVM Bugzilla Contributor
CC @DougGregor,@tkremenek

Extended Description

In one of the data structures of coreboot we use an anonymous union with additional information depending on the .type field of that structure. It seems the static analyzer does not like that:

static.c:57:44: error: field designator 'apic_cluster' refers to a member of an anonymous union
.path = {.type=DEVICE_PATH_APIC_CLUSTER,{.apic_cluster={ .cluster = 0x0 }}},
^
In file included from static.c:1:
In file included from /home/patrick/work/coreboot-v2/src/include/device/device.h:6:
/home/patrick/work/coreboot-v2/src/include/device/path.h:69:28: note: field designator refers here
struct apic_cluster_path apic_cluster;
^

What's funny about this is that it does know which field in the anonymous union the code refers to, but it considers it wrong.

Please let me know what information you need and I will try to get it to you.

This is an open source firmware, and we have a test run of all our targets here:
http://coreboot.org/~stepan/llvm/coreboot-builds

We plan to use the static analyzer in a checkin hook as soon as we managed to get rid of the parser rejects.

Metadata

Metadata

Assignees

Labels

bugzillaIssues migrated from bugzillaclang:frontendLanguage frontend issues, e.g. anything involving "Sema"

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions