[llvm-commits] [llvm-gcc-4.2] r126672 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Stuart Hastings
stuart at apple.com
Mon Feb 28 11:48:00 PST 2011
Author: stuart
Date: Mon Feb 28 13:48:00 2011
New Revision: 126672
URL: http://llvm.org/viewvc/llvm-project?rev=126672&view=rev
Log:
Skip anonymous union fields when initializing. Radar 9055247.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=126672&r1=126671&r2=126672&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Feb 28 13:48:00 2011
@@ -8582,10 +8582,10 @@
// Convert the constant itself.
Constant *Val = Convert(VEC_index(constructor_elt, elt, 0)->value);
- // Unions are initialized using the first member field. Find it.
+ // Unions are initialized using the first non-anonymous member field. Find it.
tree Field = TYPE_FIELDS(TREE_TYPE(exp));
assert(Field && "cannot initialize union with no fields");
- while (TREE_CODE(Field) != FIELD_DECL) {
+ while (TREE_CODE(Field) != FIELD_DECL || DECL_NAME(Field) == NULL_TREE) {
Field = TREE_CHAIN(Field);
assert(Field && "cannot initialize union with no fields");
}
More information about the llvm-commits
mailing list