This is the mail archive of the gcc-bugs@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]

Re: sizetype overflow?


    What is the purpose of the following patch?

    Fri Oct 20 13:33:16 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

        * fold-const.c (force_fit_type): Unsigned values can overflow
        if they are sizetype.

    As far as I can tell, all it does is break the following test:

To make sure that we correctly give an overflow in all cases where an object's
size is too large.  This is required, for example, in Ada.

    unsigned long foo(void)
    {
      return ~(sizeof(long)-1);
    }
    $ ./cc1 -quiet -W zz.c
    zz.c: In function `foo':
    zz.c:3: warning: large integer implicitly truncated to unsigned type

Perhaps C should do the same as C++, where the user-visible sizetype is
not the internal sizetype?

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