Skip to content

sizeof computation fails for nested derived types (pointer to array or array of pointers) #9

Closed
@ian-ross

Description

@ian-ross

Bug imported from C2HS Trac

Trac ticket created: 2008-08-01T13:32:18-0700; last modified: 2011-01-19T16:39:31-0800


c2hs reports the wrong size of nested derived types.

struct pointer_to_array {
  int (*y)[4  ];
} PTA;
struct array_of_pointers {
  int* y[4];
} AOP;
diff fail2_via_c.out fail2_via_c2hs.out
1,2c1,2
< __tydef__array_of_pointers__: 16
< __tydef__pointer_to_array__: 4

---
> __tydef__array_of_pointers__: 4
> __tydef__pointer_to_array__: 16

The reason for this is that the analysis code assumes that pointer to T is represented as CPointerDeclr TDeclr, but it is actually parsed as TDeclr (...(CPointerDeclr)...).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions