aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1993-09-23 02:03:14 +0000
committerRichard Stallman <rms@gnu.org>1993-09-23 02:03:14 +0000
commit0e03210994d4f820e6f8fa1d871dbbee070bfbfe (patch)
treeadd7ae013ff4913b89f5bd7ff3f63c5ef3680bec /gcc
parent27f32a5400bc4949662ed57282bb33ec5d4d43db (diff)
downloadgcc-0e03210994d4f820e6f8fa1d871dbbee070bfbfe.zip
gcc-0e03210994d4f820e6f8fa1d871dbbee070bfbfe.tar.gz
gcc-0e03210994d4f820e6f8fa1d871dbbee070bfbfe.tar.bz2
(set_init_index): Handle and allow CONST_DECL.
(build_c_cast): When making a CONSTRUCTOR for a union cast, specify its type. (default_conversion): Implement -fallow-single-precision. From-SVN: r5424
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-typeck.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 9ce2929..4cdbc2c 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -960,7 +960,8 @@ default_conversion (exp)
return convert (unsigned_type_node, exp);
return convert (integer_type_node, exp);
}
- if (flag_traditional && TYPE_MAIN_VARIANT (type) == float_type_node)
+ if (flag_traditional && !flag_allow_single_precision
+ && TYPE_MAIN_VARIANT (type) == float_type_node)
return convert (double_type_node, exp);
if (code == VOID_TYPE)
{
@@ -4016,8 +4017,8 @@ build_c_cast (type, expr)
}
else
name = "";
- return digest_init (type, build_nt (CONSTRUCTOR, NULL_TREE,
- build_tree_list (field, value)),
+ return digest_init (type, build (CONSTRUCTOR, type,
+ build_tree_list (field, value)),
0, 0);
}
error ("cast to union type from type not present in union");
@@ -5824,6 +5825,20 @@ void
set_init_index (first, last)
tree first, last;
{
+ while ((TREE_CODE (first) == NOP_EXPR
+ || TREE_CODE (first) == CONVERT_EXPR
+ || TREE_CODE (first) == NON_LVALUE_EXPR)
+ && (TYPE_MODE (TREE_TYPE (first))
+ == TYPE_MODE (TREE_TYPE (TREE_OPERAND (first, 0)))))
+ (first) = TREE_OPERAND (first, 0);
+ if (last)
+ while ((TREE_CODE (last) == NOP_EXPR
+ || TREE_CODE (last) == CONVERT_EXPR
+ || TREE_CODE (last) == NON_LVALUE_EXPR)
+ && (TYPE_MODE (TREE_TYPE (last))
+ == TYPE_MODE (TREE_TYPE (TREE_OPERAND (last, 0)))))
+ (last) = TREE_OPERAND (last, 0);
+
if (TREE_CODE (first) != INTEGER_CST)
error_init ("nonconstant array index in initializer%s", " for `%s'", NULL);
else if (last != 0 && TREE_CODE (last) != INTEGER_CST)