Skip to content

Clarification of rules for flattening structs containing arrays of empty records #358

@asb

Description

@asb

The hard FP calling convention currently states "Fields containing empty structs or unions are ignored while flattening, even in C++, unless they have nontrivial copy constructors or destructors." It appears that g++ doesn't ignore an array of empty records in a struct. If this is indeed the desired behaviour, it would be good to document it.

$ cat t.c
struct empty { struct { struct { } e; }; };
struct s { struct empty e[1]; float f; };

float test_s(struct s a) {
  return a.f+1.0;
}

In the above example, the float is passed in a0 with g++ but fa0 with gcc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions