PR preprocessor/59935 - caret diagnostics crashes on non-file locations
gcc/ChangeLog * input.c (location_get_source_line): Bail out on when line number is zero, and test the return value of lookup_or_add_file_to_cache_tab. gcc/testsuite/ChangeLog * c-c++-common/cpp/warning-zero-location.c: New test. * c-c++-common/cpp/warning-zero-location-2.c: Likewise. Signed-off-by: Dodji Seketeli <dodji@seketeli.org> From-SVN: r207195
This commit is contained in:
parent
07ec81f958
commit
367c82866e
@ -1,3 +1,10 @@
|
||||
2014-01-28 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR preprocessor/59935
|
||||
* input.c (location_get_source_line): Bail out on when line number
|
||||
is zero, and test the return value of
|
||||
lookup_or_add_file_to_cache_tab.
|
||||
|
||||
2014-01-28 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/58742
|
||||
|
@ -698,7 +698,13 @@ location_get_source_line (expanded_location xloc,
|
||||
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)
|
||||
|
@ -1,3 +1,9 @@
|
||||
2014-01-28 Dodji Seketeli <dodji@redhat.com>
|
||||
|
||||
PR preprocessor/59935
|
||||
* c-c++-common/cpp/warning-zero-location.c: New test.
|
||||
* c-c++-common/cpp/warning-zero-location-2.c: Likewise.
|
||||
|
||||
2014-01-27 Steve Ellcey <sellcey@mips.com>
|
||||
|
||||
* gcc.target/mips/pr52125.c: Add -mno-optgp option.
|
||||
|
10
gcc/testsuite/c-c++-common/cpp/warning-zero-location-2.c
Normal file
10
gcc/testsuite/c-c++-common/cpp/warning-zero-location-2.c
Normal file
@ -0,0 +1,10 @@
|
||||
/*
|
||||
{ dg-options "-D _GNU_SOURCE -fdiagnostics-show-caret" }
|
||||
{ dg-do compile }
|
||||
*/
|
||||
|
||||
#line 4636 "configure"
|
||||
#include <xxxxxxxxxxxx.h>
|
||||
int main() { return 0; }
|
||||
|
||||
/* { dg-error "No such file or directory" { target *-*-* } 4636 } */
|
8
gcc/testsuite/c-c++-common/cpp/warning-zero-location.c
Normal file
8
gcc/testsuite/c-c++-common/cpp/warning-zero-location.c
Normal file
@ -0,0 +1,8 @@
|
||||
/*
|
||||
{ dg-options "-D _GNU_SOURCE -fdiagnostics-show-caret" }
|
||||
{ dg-do compile }
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE /* { dg-warning "redefined" } */
|
||||
|
||||
/* { dg-message "" "#define _GNU_SOURCE" {target *-*-* } 0 }
|
Loading…
Reference in New Issue
Block a user