re PR c/56989 (wrong location in error message)

PR c/56989
	* c-typeck.c (default_conversion): Use better location for
	error call.

	* gcc.dg/pr56989.c: New test.

From-SVN: r209969
This commit is contained in:
Marek Polacek 2014-05-01 07:08:19 +00:00 committed by Marek Polacek
parent d2d9bc36ee
commit 5436fa2e87
4 changed files with 32 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2014-05-01 Marek Polacek <polacek@redhat.com>
PR c/56989
* c-typeck.c (default_conversion): Use better location for
error call.
2014-04-30 Marek Polacek <polacek@redhat.com>
* c-typeck.c (build_binary_op): Call ubsan_instrument_division

View File

@ -2107,7 +2107,8 @@ default_conversion (tree exp)
if (code == VOID_TYPE)
{
error ("void value not ignored as it ought to be");
error_at (EXPR_LOC_OR_LOC (exp, input_location),
"void value not ignored as it ought to be");
return error_mark_node;
}

View File

@ -1,3 +1,8 @@
2014-05-01 Marek Polacek <polacek@redhat.com>
PR c/56989
* gcc.dg/pr56989.c: New test.
2014-04-30 Ian Lance Taylor <iant@google.com>
* go.test/go-test.exp (go-gc-tests): For rundir, pass extra files

View File

@ -0,0 +1,19 @@
/* PR c/56989 */
/* { dg-do compile } */
extern void voidf (void);
extern int intf (void);
int
f (void)
{
if (intf () < 0
|| voidf () < 0) /* { dg-error "10:void value not ignored as it ought to be" } */
return 1;
if (voidf () < 0 /* { dg-error "7:void value not ignored as it ought to be" } */
|| intf () < 0)
return 1;
return 0;
}