On Fri, Jan 24, 2014 at 05:09:29PM +0100, Dodji Seketeli wrote: > * input.c (read_line_num): Gracefully handle non-file locations or > empty caches. > > diff --git a/gcc/input.c b/gcc/input.c > index 547c177..b05e1da 100644 > --- a/gcc/input.c > +++ b/gcc/input.c > @@ -600,7 +600,8 @@ static bool > read_line_num (fcache *c, size_t line_num, > char ** line, ssize_t *line_len) > { > - gcc_assert (line_num > 0); > + if (!c || line_num < 1) > + return false; > > if (line_num <= c->line_num) > {
Ok. > --- /dev/null > +++ b/gcc/testsuite/c-c++-common/cpp/warning-zero-location.c > @@ -0,0 +1,6 @@ > +/* > + { dg-options "-D _GNU_SOURCE" } > + { dg-do compile } > + */ > + > +#define _GNU_SOURCE /* { dg-warning "redefined" } */ I doubt this would fail without the patch though, because fno-diagnostics-show-caret is added by default to flags. So, I'd say you need also -fdiagnostics-show-caret in dg-options to reproduce it. Jakub