This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][1/n][C] Do not sign-extend sizetypes


On Mon, Apr 11, 2011 at 7:25 AM, Richard Guenther <rguenther@suse.de> wrote:
>
> This is another try at making sizetype behavior more consistent with
> other integral types. ?In particular this series will eventually
> succeed in making TYPE_UNSIGNED tell the truth for sizetypes ...
>
> This first patch replaces a hack in the C frontend to handle
> zero-sized arrays (int a[] = {}) by setting the upper bound of
> the domain to integer_minus_one_node. ?This works by luck only
> as the code later calls build_index_type which happily combines
> (and converts) this with a sizetype zero lower bound. ?Simply
> using an integer typed domain fixes this, so the patch makes
> the C frontend use build_range_type instead.
>
> Similarly the stor-layout.c code fails to properly use
> signed arithmetic when it needs to. ?The present code presumably
> already handles some cases, but not that special case of
> adding one to -1.
>
> The rest of the patch is simple stuff I noticed when going over
> the code.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu for all
> languages including Ada and Objective-C++.
>
> Are the c-family changes ok?
>
> Thanks,
> Richard.
>
> 2011-04-11 ?Richard Guenther ?<rguenther@suse.de>
>
> ? ? ? ?* stor-layout.c (layout_type): Compute all array index size operations
> ? ? ? ?in the original type.
> ? ? ? ?(initialize_sizetypes): Add comment.
> ? ? ? ?(set_sizetype): Do not set TREE_TYPE of a TREE_VEC.
>
> ? ? ? ?c-family/
> ? ? ? ?* c-common.c (complete_array_type): Build a range type of
> ? ? ? ?proper type.
>

This caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53605

-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]