From: Markus Trippelsdorf <markus@trippelsdorf.de>
To: Dodji Seketeli <dodji@redhat.com>
Cc: "Jakub Jelinek" <jakub@redhat.com>,
"Bernd Edlinger" <bernd.edlinger@hotmail.de>,
"GCC Patches" <gcc-patches@gcc.gnu.org>,
"Tom Tromey" <tromey@redhat.com>,
"Manuel López-Ibáñez" <lopezibanez@gmail.com>
Subject: Re: [PATCH] preprocessor/58580 - preprocessor goes OOM with warning for zero literals
Date: Fri, 24 Jan 2014 23:02:00 -0000 [thread overview]
Message-ID: <20140124230239.GH396@x4> (raw)
In-Reply-To: <878uu5qs3q.fsf@redhat.com>
On 2014.01.24 at 17:09 +0100, Dodji Seketeli wrote:
> Jakub Jelinek <jakub@redhat.com> writes:
>
> > On Fri, Jan 24, 2014 at 04:40:52PM +0100, Dodji Seketeli wrote:
> >> > The patch causes http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59935 .
> >> > The follow-up patch (fp == NULL check) doesn't help.
> >>
> >> I am looking into that, sorry for the inconvenience.
> >
> > I'd say we want something like following. Note that while the c == NULL
> > bailout would be usually sufficient, if you'll do:
> > echo foobar > '<command-line>'
> > it would still crash. Line 0 is used only for the special locations
> > (command line, built-in macros) and there is no file associated with it
> > anyway.
> >
> > --- gcc/input.c.jj 2014-01-24 16:32:34.000000000 +0100
> > +++ gcc/input.c 2014-01-24 16:41:42.012671452 +0100
> > @@ -698,7 +698,13 @@ location_get_source_line (expanded_locat
> > static char *buffer;
> > static ssize_t len;
> >
> > - fcache * c = lookup_or_add_file_to_cache_tab (xloc.file);
> > + if (xloc.line == 0)
> > + return NULL;
> > +
> > + fcache *c = lookup_or_add_file_to_cache_tab (xloc.file);
> > + if (c == NULL)
> > + return NULL;
> > +
> > bool read = read_line_num (c, xloc.line, &buffer, &len);
> >
> > if (read && line_len)
>
> Indeed.
>
> Though, I am testing the patch below that makes read_line_num gracefully
> handle empty caches or zero locations. The rest of the code should just
> work with that as is.
>
> * input.c (read_line_num): Gracefully handle non-file locations or
> empty caches.
Unfortunately this doesn't fix yet another issue:
markus@x4 /tmp % cat foo.c
#line 4636 "configure"
#include <xxxxxxxxxxxx.h>
int main() { return 0; }
markus@x4 /tmp % gcc foo.c
configure:4636:26: fatal error: xxxxxxxxxxxx.h: No such file or directory
gcc: internal compiler error: Segmentation fault (program cc1)
0x40cc8e execute
../../gcc/gcc/gcc.c:2841
0x40cf09 do_spec_1
../../gcc/gcc/gcc.c:4641
0x40fc91 process_brace_body
../../gcc/gcc/gcc.c:5924
0x40fc91 handle_braces
../../gcc/gcc/gcc.c:5838
0x40d692 do_spec_1
../../gcc/gcc/gcc.c:5295
0x40fc91 process_brace_body
../../gcc/gcc/gcc.c:5924
0x40fc91 handle_braces
../../gcc/gcc/gcc.c:5838
0x40d692 do_spec_1
../../gcc/gcc/gcc.c:5295
0x40d28e do_spec_1
../../gcc/gcc/gcc.c:5410
0x40fc91 process_brace_body
../../gcc/gcc/gcc.c:5924
0x40fc91 handle_braces
../../gcc/gcc/gcc.c:5838
0x40d692 do_spec_1
../../gcc/gcc/gcc.c:5295
0x40fc91 process_brace_body
../../gcc/gcc/gcc.c:5924
0x40fc91 handle_braces
../../gcc/gcc/gcc.c:5838
0x40d692 do_spec_1
../../gcc/gcc/gcc.c:5295
0x40fc91 process_brace_body
../../gcc/gcc/gcc.c:5924
0x40fc91 handle_braces
../../gcc/gcc/gcc.c:5838
0x40d692 do_spec_1
../../gcc/gcc/gcc.c:5295
0x40fc91 process_brace_body
../../gcc/gcc/gcc.c:5924
0x40fc91 handle_braces
../../gcc/gcc/gcc.c:5838
Please submit a full bug report,
with preprocessed source if appropriate.
--
Markus
next prev parent reply other threads:[~2014-01-24 23:02 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-31 14:48 Bernd Edlinger
2013-10-31 15:06 ` Jakub Jelinek
2013-10-31 15:19 ` Dodji Seketeli
2013-10-31 18:26 ` Jakub Jelinek
2013-11-04 11:52 ` Dodji Seketeli
2013-11-04 11:59 ` Jakub Jelinek
2013-11-04 15:42 ` Dodji Seketeli
2013-11-05 0:10 ` Bernd Edlinger
2013-11-05 9:50 ` Dodji Seketeli
2013-11-05 11:19 ` Bernd Edlinger
2013-11-05 11:43 ` Dodji Seketeli
2013-11-06 22:27 ` Bernd Edlinger
2013-11-04 12:06 ` Bernd Edlinger
2013-11-04 12:15 ` Jakub Jelinek
2013-11-04 12:32 ` Bernd Edlinger
2013-11-04 15:21 ` Dodji Seketeli
2013-11-11 10:49 ` Dodji Seketeli
2013-11-11 14:35 ` Jakub Jelinek
2013-11-11 17:13 ` Dodji Seketeli
2013-11-12 16:42 ` Dodji Seketeli
2013-11-13 5:10 ` Bernd Edlinger
2013-11-13 9:40 ` Dodji Seketeli
2013-11-13 9:43 ` Bernd Edlinger
2013-11-13 9:49 ` Dodji Seketeli
2013-11-13 9:49 ` Dodji Seketeli
2013-11-13 9:51 ` Jakub Jelinek
2013-11-14 15:12 ` Dodji Seketeli
2013-12-09 20:11 ` Tom Tromey
2014-01-21 12:28 ` Bernd Edlinger
2014-01-22 8:16 ` Dodji Seketeli
2014-01-23 17:12 ` Jakub Jelinek
2014-01-24 2:58 ` Bernd Edlinger
2014-01-24 7:53 ` Dodji Seketeli
2014-01-24 15:05 ` Markus Trippelsdorf
2014-01-24 15:41 ` Dodji Seketeli
2014-01-24 15:44 ` Jakub Jelinek
2014-01-24 16:09 ` Dodji Seketeli
2014-01-24 16:13 ` Jakub Jelinek
2014-01-24 23:02 ` Markus Trippelsdorf [this message]
2014-01-24 23:20 ` Markus Trippelsdorf
2014-01-28 13:20 ` Dodji Seketeli
2014-01-28 13:23 ` Dodji Seketeli
2014-01-28 18:40 ` H.J. Lu
2014-01-29 11:28 ` Dodji Seketeli
-- strict thread matches above, loose matches on Subject: below --
2013-10-31 13:45 Dodji Seketeli
2013-10-31 17:30 ` Manuel López-Ibáñez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140124230239.GH396@x4 \
--to=markus@trippelsdorf.de \
--cc=bernd.edlinger@hotmail.de \
--cc=dodji@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=lopezibanez@gmail.com \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).