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

c/2707: gcc does not warn on truncate



>Number:         2707
>Category:       c
>Synopsis:       gcc does not warn on truncate
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 01 11:06:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     jhabermann@tricord.com
>Release:        unknown-1.0
>Organization:
>Environment:

>Description:
gcc does not warn when assigning a "larger" variable
to a smaller one.  Example:

#include <stdio.h>
int
main(int argc, char **argv)
{
    unsigned long i32;
    unsigned short i16;
    i32 = 0xffffffff;
    i16 = i32; /* should warn here, I think */
    printf("i32 = 0x%lx, i16 = 0x%x\n", i32, (unsigned int)i16);
    printf("sizeof(i32) = %d, sizeof(i16) = %d\n", sizeof(i32),
	sizeof(i16));
    return(0);
}

>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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