summaryrefslogtreecommitdiff
path: root/gcc/objc
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2001-12-11 18:07:01 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2001-12-11 18:07:01 +0000
commit1cd45b1e8c593b73ab0b966b75116317f944df94 (patch)
treeb4e402b9bf496cdba08d71d0c4c767f612105bf1 /gcc/objc
parent801a4a66383d8c9e457be3ba8f709fe3a3ef4eaf (diff)
downloadgcc-1cd45b1e8c593b73ab0b966b75116317f944df94.tar.gz
* objc/objc-act.c (build_constructor): Cast initializer values
to the proper field types. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@47884 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/objc')
-rw-r--r--gcc/objc/objc-act.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index a04f631e405..bf770e9cb89 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -1371,8 +1371,27 @@ static tree
build_constructor (type, elts)
tree type, elts;
{
- tree constructor = build (CONSTRUCTOR, type, NULL_TREE, elts);
+ tree constructor, f, e;
+ /* ??? Most of the places that we build constructors, we don't fill in
+ the type of integers properly. Convert them all en masse. */
+ if (TREE_CODE (type) == ARRAY_TYPE)
+ {
+ f = TREE_TYPE (type);
+ if (TREE_CODE (f) == POINTER_TYPE || TREE_CODE (f) == INTEGER_TYPE)
+ for (e = elts; e ; e = TREE_CHAIN (e))
+ TREE_VALUE (e) = convert (f, TREE_VALUE (e));
+ }
+ else
+ {
+ f = TYPE_FIELDS (type);
+ for (e = elts; e ; e = TREE_CHAIN (e), f = TREE_CHAIN (f))
+ if (TREE_CODE (TREE_TYPE (f)) == POINTER_TYPE
+ || TREE_CODE (TREE_TYPE (f)) == INTEGER_TYPE)
+ TREE_VALUE (e) = convert (TREE_TYPE (f), TREE_VALUE (e));
+ }
+
+ constructor = build (CONSTRUCTOR, type, NULL_TREE, elts);
TREE_CONSTANT (constructor) = 1;
TREE_STATIC (constructor) = 1;
TREE_READONLY (constructor) = 1;