Wiki Roadmap Timeline Tickets New Ticket Source Search Help / Guide About Trac Login

Ticket #294 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

More incorrect alignment of unions

Reported by: fvbommel Assigned to: ChristianK
Priority: major Milestone:
Component: unspecified Version: hg tip
Keywords: Cc:

Description

union Foo { short[3] arr; long l; }
struct Bar { ushort a; Foo f; }

In the IR:

    %foo.Bar = type { i16, %foo.Foo }
    %foo.Foo = type { [3 x i16], i16 }

So the second field of Bar seems to be at offset 2, not long.alignof. This is probably because the struct layout code assumes LLVM will align the union to the proper alignment, but since the LLVM type has a different alignment than the D type...

(Related to #293, as they are both due to .alignof mismatch between D and LLVM types, but the solution is different since the problem is in different code)

Change History

05/14/09 11:21:14 changed by lindquist

The groundwork for fixing this is in rev [1351], it's disabled though as it needs to be properly investigated for regressions.

05/15/09 11:07:13 changed by lindquist

  • status changed from new to closed.
  • resolution set to fixed.

Fixed in rev [1356]. The types are now:

        %foo.Bar = type { i16, i16, i32, %foo.Foo }
        %foo.Foo = type { [3 x i16], i16 }
Copyright © 2008, LDC Development Team.