[PATCH] C frontend: cast-expressions sometimes retain type qualifiers
Patrick Palka
patrick@parcs.ath.cx
Sun Aug 17 13:12:00 GMT 2014
On Sun, Aug 17, 2014 at 8:27 AM, Marek Polacek <polacek@redhat.com> wrote:
> On Sat, Aug 16, 2014 at 09:54:33PM -0400, Patrick Palka wrote:
>> --- a/gcc/c/c-typeck.c
>> +++ b/gcc/c/c-typeck.c
>> @@ -4947,6 +4947,8 @@ build_c_cast (location_t loc, tree type, tree expr)
>> || TREE_CODE (type) == UNION_TYPE)
>> pedwarn (loc, OPT_Wpedantic,
>> "ISO C forbids casting nonscalar to the same type");
>> +
>> + value = convert (type, value);
>
> Maybe a comment saying why we convert the value here anyway would be
> useful. Otherwise LGTM.
OK, I'll add the comment "Convert to remove any qualifiers from
VALUE's type" to the patch.
More information about the Gcc-patches
mailing list