This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c/2707: gcc does not warn on truncate
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c/2707: gcc does not warn on truncate
- From: jhabermann at tricord dot com
- Date: 1 May 2001 17:57:39 -0000
- Reply-To: jhabermann at tricord dot com
>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: