public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/28079]  New: #line range not verified
@ 2006-06-19  7:05 sabre at nondot dot org
  2006-06-21  7:19 ` [Bug preprocessor/28079] #line range not verified without -pedantic pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: sabre at nondot dot org @ 2006-06-19  7:05 UTC (permalink / raw)
  To: gcc-bugs

Preprocessing this:
#line 12312312312435

produces:

# 2936042099 ".../foo.c"

C99 specifies that the argument to #line shall be > 0 and < 2^31-1, and even if
it didn't, truncation like this should at least be warned about.

-Chris


-- 
           Summary: #line range not verified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sabre at nondot dot org


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


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

* [Bug preprocessor/28079] #line range not verified without -pedantic
  2006-06-19  7:05 [Bug preprocessor/28079] New: #line range not verified sabre at nondot dot org
@ 2006-06-21  7:19 ` pinskia at gcc dot gnu dot org
  2008-02-10 15:53 ` manu at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-06-21  7:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-06-21 05:07 -------
[kudzu:~] pinskia% gcc t.c -pedantic-errors -std=c99
t.c:1:7: error: line number out of range
t.c:-1358925197: error: ISO C forbids an empty source file

With -pedantic we just get a warning.

I don't know if we should warn even with -pedantic.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
           Keywords|                            |diagnostic
            Summary|#line range not verified    |#line range not verified
                   |                            |without -pedantic


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


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

* [Bug preprocessor/28079] #line range not verified without -pedantic
  2006-06-19  7:05 [Bug preprocessor/28079] New: #line range not verified sabre at nondot dot org
  2006-06-21  7:19 ` [Bug preprocessor/28079] #line range not verified without -pedantic pinskia at gcc dot gnu dot org
@ 2008-02-10 15:53 ` manu at gcc dot gnu dot org
  2008-02-10 16:13 ` manu at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-02-10 15:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from manu at gcc dot gnu dot org  2008-02-10 15:52 -------
Tom, as the libcpp maintainer, could you give your opinion about this? I
personally think a warning could be useful, it may point out some bug in an
auto-generated file. Moreover, I think that the standard also require us to
warn (with -pedantic) for the wrapping case.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org,
                   |                            |tromey at redhat dot com
             Status|UNCONFIRMED                 |WAITING


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


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

* [Bug preprocessor/28079] #line range not verified without -pedantic
  2006-06-19  7:05 [Bug preprocessor/28079] New: #line range not verified sabre at nondot dot org
  2006-06-21  7:19 ` [Bug preprocessor/28079] #line range not verified without -pedantic pinskia at gcc dot gnu dot org
  2008-02-10 15:53 ` manu at gcc dot gnu dot org
@ 2008-02-10 16:13 ` manu at gcc dot gnu dot org
  2008-02-25 21:11 ` tromey at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-02-10 16:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from manu at gcc dot gnu dot org  2008-02-10 16:12 -------
Also, I noticed that there is an implicit conversion from ulong to uint when
calling _cpp_do_file_change in do_linemarker. That is the point where the
truncation takes place.


-- 


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


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

* [Bug preprocessor/28079] #line range not verified without -pedantic
  2006-06-19  7:05 [Bug preprocessor/28079] New: #line range not verified sabre at nondot dot org
                   ` (2 preceding siblings ...)
  2008-02-10 16:13 ` manu at gcc dot gnu dot org
@ 2008-02-25 21:11 ` tromey at gcc dot gnu dot org
  2008-05-13 19:53 ` tromey at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tromey at gcc dot gnu dot org @ 2008-02-25 21:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from tromey at gcc dot gnu dot org  2008-02-25 21:10 -------
Sorry for the delay on this.

I never remember our rules about when to emit pedantic warnings
and the like.  I think libcpp should follow the overall gcc approach
here, whatever that is.

I agree that warning about truncation is a good idea.
Silently doing the wrong thing is unfriendly.


-- 


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


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

* [Bug preprocessor/28079] #line range not verified without -pedantic
  2006-06-19  7:05 [Bug preprocessor/28079] New: #line range not verified sabre at nondot dot org
                   ` (3 preceding siblings ...)
  2008-02-25 21:11 ` tromey at gcc dot gnu dot org
@ 2008-05-13 19:53 ` tromey at gcc dot gnu dot org
  2008-07-22  9:47 ` manu at gcc dot gnu dot org
  2008-07-22  9:48 ` manu at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: tromey at gcc dot gnu dot org @ 2008-05-13 19:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from tromey at gcc dot gnu dot org  2008-05-13 19:52 -------
I don't see why this should be marked "wait".
Changing back to "new".


-- 

tromey at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-05-13 19:52:30
               date|                            |


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


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

* [Bug preprocessor/28079] #line range not verified without -pedantic
  2006-06-19  7:05 [Bug preprocessor/28079] New: #line range not verified sabre at nondot dot org
                   ` (4 preceding siblings ...)
  2008-05-13 19:53 ` tromey at gcc dot gnu dot org
@ 2008-07-22  9:47 ` manu at gcc dot gnu dot org
  2008-07-22  9:48 ` manu at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-07-22  9:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from manu at gcc dot gnu dot org  2008-07-22 09:46 -------
Subject: Bug 28079

Author: manu
Date: Tue Jul 22 09:45:58 2008
New Revision: 138049

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=138049
Log:
2008-07-22  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

        PR 28079
libcpp/
        * directives.c (strtolinenum): Handle overflow.
        (do_line): Give a warning if line number overflowed.
        (do_linemarker): Update call to strtolinenum.

gcc/testsuite/
        * gcc.dg/cpp/line6.c: New.

Added:
    trunk/gcc/testsuite/gcc.dg/cpp/line6.c
Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/libcpp/ChangeLog
    trunk/libcpp/directives.c


-- 


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


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

* [Bug preprocessor/28079] #line range not verified without -pedantic
  2006-06-19  7:05 [Bug preprocessor/28079] New: #line range not verified sabre at nondot dot org
                   ` (5 preceding siblings ...)
  2008-07-22  9:47 ` manu at gcc dot gnu dot org
@ 2008-07-22  9:48 ` manu at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-07-22  9:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from manu at gcc dot gnu dot org  2008-07-22 09:48 -------
Fixed in GCC 4.4


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2008-07-22  9:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-19  7:05 [Bug preprocessor/28079] New: #line range not verified sabre at nondot dot org
2006-06-21  7:19 ` [Bug preprocessor/28079] #line range not verified without -pedantic pinskia at gcc dot gnu dot org
2008-02-10 15:53 ` manu at gcc dot gnu dot org
2008-02-10 16:13 ` manu at gcc dot gnu dot org
2008-02-25 21:11 ` tromey at gcc dot gnu dot org
2008-05-13 19:53 ` tromey at gcc dot gnu dot org
2008-07-22  9:47 ` manu at gcc dot gnu dot org
2008-07-22  9:48 ` manu 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).