Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000095 [cparser] targets minor always 2012-09-17 15:38 2016-01-03 03:28
Reporter Matze View Status public  
Assigned To Matze
Priority low Resolution fixed  
Status closed   Product Version 0.9.13
Summary 0000095: alignment of struct members
Description system V and/or gcc have a strange interpretation of alignment: The alignment of types like double or long long is reported as 8 (__alignof__(double)==8) when aligning fields inside a struct the maximum alignment used is 4.

Currently we use the "struct_alignment" hack in cparser to deal with this. However some more experimenting turned out that the hack has to be at the place where struct fields are aligned, and must also skip arrays. cparser does currently not skip arrays.
So the hack needs to be revised, grep gcc source for ADJUST_FIELD_ALIGNMENT/BIGGEST_FIELD_ALIGNMENT if you wanna see details.
Additional Information
Tags No tags attached.
Attached Files

- Relationships

-  Notes
luzero (reporter)
2013-10-14 02:42

The current gcc does not use ADJUST_FIELD_ALIGNMENT at all.
Matze (administrator)
2013-10-29 14:08
edited on: 2013-10-29 14:09

Seems I had a typo in the bugreport, it's called ADJUST_FIELD_ALIGN. I have "gcc-4.8-20130120" here (ubuntu package sources) and you can find the following for i386:

   x86_field_alignment (FIELD, COMPUTED)
x86_field_alignment (tree field, int computed)
  enum machine_mode mode;
  tree type = TREE_TYPE (field);

    return computed;
  mode = TYPE_MODE (strip_array_types (type));
  if (mode == DFmode || mode == DCmode
      || GET_MODE_CLASS (mode) == MODE_INT
    return MIN (32, computed);
  return computed;
users are in stor-layout.c for example.

cparser at least fails to replicate the strip_array_types() part. But first I'd like to see a bit of surveying what all the gcc targets are doing (and in which configurations they are doing it)...

Matze (administrator)
2014-07-14 16:12

fixed in revision c57c00b219b6a8209fa0b5ab99ea9384ba7f04e9

- Issue History
Date Modified Username Field Change
2012-09-17 15:38 Matze New Issue
2012-09-28 12:56 Matze Status new => confirmed
2013-10-14 02:42 luzero Note Added: 0000181
2013-10-29 14:08 Matze Note Added: 0000187
2013-10-29 14:09 Matze Note Edited: 0000187
2014-07-14 16:12 Matze Note Added: 0000218
2014-07-14 16:12 Matze Assigned To => Matze
2014-07-14 16:12 Matze Status confirmed => resolved
2014-07-14 16:12 Matze Resolution open => fixed
2016-01-03 03:28 Matze Status resolved => closed

Mantis 1.1.5[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker