summaryrefslogtreecommitdiff
path: root/gcc/c/c-typeck.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c/c-typeck.c')
-rw-r--r--gcc/c/c-typeck.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index 59a3c6153b..09cca41ade 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -3530,7 +3530,12 @@ parser_build_binary_op (location_t location, enum tree_code code,
result.original_type = NULL;
if (TREE_CODE (result.value) == ERROR_MARK)
- return result;
+ {
+ set_c_expr_source_range (&result,
+ arg1.get_start (),
+ arg2.get_finish ());
+ return result;
+ }
if (location != UNKNOWN_LOCATION)
protected_set_expr_location (result.value, location);
@@ -8480,6 +8485,8 @@ set_nonincremental_init_from_string (tree str,
wchar_bytes = TYPE_PRECISION (TREE_TYPE (TREE_TYPE (str))) / BITS_PER_UNIT;
charwidth = TYPE_PRECISION (char_type_node);
+ gcc_assert ((size_t) wchar_bytes * charwidth
+ <= ARRAY_SIZE (val) * HOST_BITS_PER_WIDE_INT);
type = TREE_TYPE (constructor_type);
p = TREE_STRING_POINTER (str);
end = p + TREE_STRING_LENGTH (str);
@@ -8505,7 +8512,7 @@ set_nonincremental_init_from_string (tree str,
bitpos = (wchar_bytes - byte - 1) * charwidth;
else
bitpos = byte * charwidth;
- val[bitpos % HOST_BITS_PER_WIDE_INT]
+ val[bitpos / HOST_BITS_PER_WIDE_INT]
|= ((unsigned HOST_WIDE_INT) ((unsigned char) *p++))
<< (bitpos % HOST_BITS_PER_WIDE_INT);
}
@@ -13533,7 +13540,8 @@ c_build_qualified_type (tree type, int type_quals, tree orig_qual_type,
: build_qualified_type (type, type_quals));
/* A variant type does not inherit the list of incomplete vars from the
type main variant. */
- if (RECORD_OR_UNION_TYPE_P (var_type))
+ if (RECORD_OR_UNION_TYPE_P (var_type)
+ && TYPE_MAIN_VARIANT (var_type) != var_type)
C_TYPE_INCOMPLETE_VARS (var_type) = 0;
return var_type;
}