public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/32564]  New: [libcpp] ICE in print_location() when stat() in remove_duplicates() fails
@ 2007-06-30 15:01 John dot Tytgat at aaug dot net
  2007-06-30 15:02 ` [Bug c/32564] " John dot Tytgat at aaug dot net
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: John dot Tytgat at aaug dot net @ 2007-06-30 15:01 UTC (permalink / raw)
  To: gcc-bugs

I had gcc 4.1.1 configured in such a way that when the resulting cc1 got
invoked, the stat() call in remove_duplicates() failed with an errno different
than ENOENT (calling chain at that moment was: remove_duplications() <-
merge_include_chains() <- register_include_chains() <- c_common_post_options()
<- toplev_main()).

This results in calling cpp_errno() -> cpp_error() -> _cpp_begin_message() and
finally print_location() which ICEs because map variable was NULL.  The reason
is that print_location()'s 'line' parameter was bogus (random value).  That
value was determined in cpp_error() as src_loc : "src_loc =
pfile->cur_token[-1].src_loc;". The pfile->cur_token[-1] struct contains bogus
values at this point.

In attached patch I address this ICE twofold:
1) Make src_loc 0 in cpp_error() when no tokens have been read yet.
2) Check for NULL result of linemap_lookup().


-- 
           Summary: [libcpp] ICE in print_location() when stat() in
                    remove_duplicates() fails
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: John dot Tytgat at aaug dot net


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


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

* [Bug c/32564] [libcpp] ICE in print_location() when stat() in remove_duplicates() fails
  2007-06-30 15:01 [Bug c/32564] New: [libcpp] ICE in print_location() when stat() in remove_duplicates() fails John dot Tytgat at aaug dot net
@ 2007-06-30 15:02 ` John dot Tytgat at aaug dot net
  2007-11-02 10:58 ` [Bug preprocessor/32564] " John dot Tytgat at aaug dot net
  2008-04-18 17:28 ` tromey at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: John dot Tytgat at aaug dot net @ 2007-06-30 15:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from John dot Tytgat at aaug dot net  2007-06-30 15:02 -------
Created an attachment (id=13807)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13807&action=view)
Suggested fix


-- 


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


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

* [Bug preprocessor/32564] [libcpp] ICE in print_location() when stat() in remove_duplicates() fails
  2007-06-30 15:01 [Bug c/32564] New: [libcpp] ICE in print_location() when stat() in remove_duplicates() fails John dot Tytgat at aaug dot net
  2007-06-30 15:02 ` [Bug c/32564] " John dot Tytgat at aaug dot net
@ 2007-11-02 10:58 ` John dot Tytgat at aaug dot net
  2008-04-18 17:28 ` tromey at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: John dot Tytgat at aaug dot net @ 2007-11-02 10:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from John dot Tytgat at aaug dot net  2007-11-02 10:58 -------
My suggested patch breaks warning/error reporting as it no longer outputs the
src filename and linenumber where those warnings/errors are happening
(something I just now realise).


-- 


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


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

* [Bug preprocessor/32564] [libcpp] ICE in print_location() when stat() in remove_duplicates() fails
  2007-06-30 15:01 [Bug c/32564] New: [libcpp] ICE in print_location() when stat() in remove_duplicates() fails John dot Tytgat at aaug dot net
  2007-06-30 15:02 ` [Bug c/32564] " John dot Tytgat at aaug dot net
  2007-11-02 10:58 ` [Bug preprocessor/32564] " John dot Tytgat at aaug dot net
@ 2008-04-18 17:28 ` tromey at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: tromey at gcc dot gnu dot org @ 2008-04-18 17:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from tromey at gcc dot gnu dot org  2008-04-18 17:27 -------
I think this is a duplicate of PR 34866 (fixed on the trunk).


*** This bug has been marked as a duplicate of 34866 ***


-- 

tromey at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2008-04-18 17:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-30 15:01 [Bug c/32564] New: [libcpp] ICE in print_location() when stat() in remove_duplicates() fails John dot Tytgat at aaug dot net
2007-06-30 15:02 ` [Bug c/32564] " John dot Tytgat at aaug dot net
2007-11-02 10:58 ` [Bug preprocessor/32564] " John dot Tytgat at aaug dot net
2008-04-18 17:28 ` tromey 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).