gcc version 4.3.0 20070704 (experimental)
Following test case derived from the Linux ACPI code warns
toverflow.c: In function 'f':
toverflow.c:8: warning: integer overflow in expression
but the warning is not correct because 0 + ULONG_MAX doesn't really overflow.
typedef void *acpi_handle;
typedef unsigned long long UINT64;
typedef unsigned long long acpi_native_uint;
typedef unsigned char u8;
int f(acpi_handle device)
{
if (device == ((acpi_handle *) (void *) ((((u8 *) (void *) ((((void
*)0)))) + (acpi_native_uint)((UINT64)(~((UINT64) 0)))))))
return 1;
return 0;
}
--
Summary: bogus integer overflow warning
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ak at muc dot de
GCC build triplet: x86_64-linux
GCC host triplet: x86_64-linux
GCC target triplet: x86_64-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32628