This is the mail archive of the gcc@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: Signedness of fortran size_type_node


On 5/2/06, Richard Guenther <richard.guenther@gmail.com> wrote:
On 5/2/06, Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz> wrote:
> Hello,
>
> I have just noticed that size_type_node is signed in fortran frontend
> (it caused an ice for me because unsigned_type_for returns it for
> pointers, and I inserted an assert that the result of unsigned_type_for
> is unsigned).
>
> According to the comment in tree.h, size_type_node should correspond to
> "The C type `size_t'", and standard specifies that size_t is unsigned.
>
> Is this a bug in fortran frontend, or is size_type_node intentionally
> set in a different way?

Nothing uses size_type_node in the fortran frontend, so it's surely a bug there.
Also there is the (the bogus)

2003-08-19 Diego Novillo <dnovillo@redhat.com>

        * trans-types.c (gfc_init_types): Initialize
        signed_size_type_node with size_type_node.

Same problem for Ada:


 /* In Ada, we use a signed type for SIZETYPE.  Use the signed type
    corresponding to the size of Pmode.  In most cases when ptr_mode and
    Pmode differ, C will use the width of ptr_mode as sizetype.  But we get
    far better code using the width of Pmode.  Make this here since we need
    this before we can expand the GNAT types.  */
 size_type_node = gnat_type_for_size (GET_MODE_BITSIZE (Pmode), 0);
 set_sizetype (size_type_node);

though there it seems to be intentional!?

Richard.


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