c/4558: -Wall option waring for -2147483648
waratah@zip.com.au
waratah@zip.com.au
Fri Oct 12 17:47:00 GMT 2001
>Number: 4558
>Category: c
>Synopsis: -Wall option waring for -2147483648
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Oct 12 17:46:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Ken Foskey
>Release: 2.95.4
>Organization:
>Environment:
Linux debian Woody (2.4)
>Description:
I have a potential problem with GCC -Wall. I have included relevant lines from the Open Office code:
> typedef signed long sal_Int32;
specific line generating warning is:
static const sal_Int32 DEF_NO = (sal_Int32)-2147483648;
Warning is:
../../unxlngi3.pro/inc/com/sun/star/awt/VclWindowPeerAttribute.hdl:42:
warning: decimal integer constant is so large that it is unsigned
>From limits.h:
/* Minimum and maximum values a `signed long int' can hold. */
# if __WORDSIZE == 64
# define LONG_MAX 9223372036854775807L
# else
# define LONG_MAX 2147483647L
# endif
# define LONG_MIN (-LONG_MAX - 1L)
According to this, the value is valid in long arithmetic and also in 'int',
>From limits.h:
/* Minimum and maximum values a `signed int' can hold. */
# define INT_MIN (-INT_MAX - 1)
# define INT_MAX 2147483647
There is a suggestion from Sydney LUG that it is creating the number as a postive 2147483648 and then negating it. 2147483648 is not a valid positive number. Note how the limits.h actually never does it as one step.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list