public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/39559]  New: constants too large for intmax_t need pedwarns
@ 2009-03-26  1:33 jsm28 at gcc dot gnu dot org
  2009-03-30  0:44 ` [Bug preprocessor/39559] " jsm28 at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-26  1:33 UTC (permalink / raw)
  To: gcc-bugs

unsigned long long l = 9223372036854775808LL;

should get an error with -std=c99 -pedantic-errors, but instead gets a warning:

t.c:1:24: warning: integer constant is so large that it is unsigned

C99 does not allow decimal constants without "U" suffix to get an
unsigned type.  I think the preprocessor should pedwarn in this case
(for C99, not C90), to catch the use of such constants in
#if conditions as well.

The preprocessor already pedwarns for a value large enough to be outside
the range of uintmax_t (which is used to set the preprocessor's
internal precision), so I believe this case of a constant inside the range
of uintmax_t but outside that of intmax_t, in decimal without "U" suffix,
is the only current case of this bug.

See <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38934#c15> for some
historical discussion (but it doesn't appear types wider than intmax_t
can ever appear this way after all).


-- 
           Summary: constants too large for intmax_t need pedwarns
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jsm28 at gcc dot gnu dot org
OtherBugsDependingO 16989
             nThis:


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39559


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug preprocessor/39559] constants too large for intmax_t need pedwarns
  2009-03-26  1:33 [Bug preprocessor/39559] New: constants too large for intmax_t need pedwarns jsm28 at gcc dot gnu dot org
@ 2009-03-30  0:44 ` jsm28 at gcc dot gnu dot org
  2009-04-25 18:46 ` jsm28 at gcc dot gnu dot org
  2009-04-25 18:52 ` jsm28 at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-30  0:44 UTC (permalink / raw)
  To: gcc-bugs



-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-03-30 00:44:04
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39559


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug preprocessor/39559] constants too large for intmax_t need pedwarns
  2009-03-26  1:33 [Bug preprocessor/39559] New: constants too large for intmax_t need pedwarns jsm28 at gcc dot gnu dot org
  2009-03-30  0:44 ` [Bug preprocessor/39559] " jsm28 at gcc dot gnu dot org
@ 2009-04-25 18:46 ` jsm28 at gcc dot gnu dot org
  2009-04-25 18:52 ` jsm28 at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-04-25 18:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jsm28 at gcc dot gnu dot org  2009-04-25 18:46 -------
Subject: Bug 39559

Author: jsm28
Date: Sat Apr 25 18:46:03 2009
New Revision: 146777

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=146777
Log:
libcpp:
        PR preprocessor/39559
        * expr.c (cpp_interpret_integer): Use a pedwarn for decimal
        constants larger than intmax_t in C99 mode.

gcc/testsuite:
        * gcc.dg/c99-intconst-2.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/c99-intconst-2.c
Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/libcpp/ChangeLog
    trunk/libcpp/expr.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39559


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug preprocessor/39559] constants too large for intmax_t need pedwarns
  2009-03-26  1:33 [Bug preprocessor/39559] New: constants too large for intmax_t need pedwarns jsm28 at gcc dot gnu dot org
  2009-03-30  0:44 ` [Bug preprocessor/39559] " jsm28 at gcc dot gnu dot org
  2009-04-25 18:46 ` jsm28 at gcc dot gnu dot org
@ 2009-04-25 18:52 ` jsm28 at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-04-25 18:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jsm28 at gcc dot gnu dot org  2009-04-25 18:52 -------
Fixed for 4.5.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to work|                            |4.5.0
         Resolution|                            |FIXED
   Target Milestone|---                         |4.5.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39559


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-04-25 18:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-26  1:33 [Bug preprocessor/39559] New: constants too large for intmax_t need pedwarns jsm28 at gcc dot gnu dot org
2009-03-30  0:44 ` [Bug preprocessor/39559] " jsm28 at gcc dot gnu dot org
2009-04-25 18:46 ` jsm28 at gcc dot gnu dot org
2009-04-25 18:52 ` jsm28 at gcc dot gnu dot org

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).