This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR target/18761, C++ ABI wrong with embed types as the first element


In C++, we get TYPE_DECLs in TYPE_FIELDS of a record/union. When we are
finding the alignment for that struct/union on rs6000-darwin and rs6000-aix.
The problem here is that we don't look passed TYPE_DECLs and other DECLS which
are no FIELD_DECLs, we only look passed VAR_DECLs (which are static variables).
This patch which fixes the problem.



OK? Bootstrapped and tested on powerpc-darwin.


Thanks,
Andrew Pinski

ChangeLog:

	* config/rs6000/rs6000.c (rs6000_special_round_type_align):
	Skip all DECLs except for FIELD_DECLs.

Patch:

Attachment: temp.diff.txt
Description: Text document



Testcase (I think this is correct for all targets but I don't know for sure):

union A {
  double d;
};
union B {
  enum E { e };
  double d;
};
struct AlignA {
  char c;
  A a;
};
struct AlignB {
  char c;
  B b;
};
extern "C" void abort ();
int main () {
  if ( __alignof__ (AlignA) != __alignof__ (AlignB))
    abort ();
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]