public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c/4558: -Wall option waring for -2147483648
@ 2001-10-12 17:46 waratah
  0 siblings, 0 replies; only message in thread
From: waratah @ 2001-10-12 17:46 UTC (permalink / raw)
  To: gcc-gnats

>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:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-10-12 17:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-12 17:46 c/4558: -Wall option waring for -2147483648 waratah

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).