re PR c/30949 ("incompatible pointer type" warning does not point to declaration)

2008-10-22  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR c/30949
	* c-typeck.c (convert_for_assignment): Do not give declaration's
	location for builtins. Spell out which type was expected and which
	was given.
testsuite/
	* gcc.target/i386/sse-vect-types.c: Update.
	* gcc.dg/simd-5.c: Update.
	* gcc.dg/assign-warn-2.c: Update.
	* gcc.dg/simd-2.c: Update.
	* gcc.dg/simd-6.c: Update.
	* gcc.dg/assign-warn-1.c: Update.
	* gcc.dg/dfp/composite-type.c: Update.
	* gcc.dg/simd-1.c: Update.
	* gcc.dg/pr36997.c: Update.

From-SVN: r141298
This commit is contained in:
Manuel López-Ibáñez 2008-10-22 16:33:17 +00:00
parent 92010a793b
commit a7da8b427f
12 changed files with 57 additions and 26 deletions

View file

@ -1,3 +1,10 @@
2008-10-22 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c/30949
* c-typeck.c (convert_for_assignment): Do not give declaration's
location for builtins. Spell out which type was expected and which
was given.
2008-10-22 Nick Clifton <nickc@redhat.com>
* config/frv/frv.h (HARD_REGNO_RENAME_OK): Define. Do not allow

View file

@ -4012,7 +4012,8 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype,
{ \
case ic_argpass: \
if (pedwarn (LOCATION, OPT, AR, parmnum, rname)) \
inform (fundecl ? DECL_SOURCE_LOCATION (fundecl) : LOCATION, \
inform ((fundecl && !DECL_IS_BUILTIN (fundecl)) \
? DECL_SOURCE_LOCATION (fundecl) : LOCATION, \
"expected %qT but argument is of type %qT", \
type, rhstype); \
break; \
@ -4451,15 +4452,21 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype,
/* ??? This should not be an error when inlining calls to
unprototyped functions. */
error ("incompatible type for argument %d of %qE", parmnum, rname);
inform ((fundecl && !DECL_IS_BUILTIN (fundecl))
? DECL_SOURCE_LOCATION (fundecl) : input_location,
"expected %qT but argument is of type %qT", type, rhstype);
break;
case ic_assign:
error ("incompatible types in assignment");
error ("incompatible types when assigning to type %qT from type %qT",
type, rhstype);
break;
case ic_init:
error ("incompatible types in initialization");
error ("incompatible types when initializing type %qT using type %qT",
type, rhstype);
break;
case ic_return:
error ("incompatible types in return");
error ("incompatible types when returning type %qT but %qT was expected",
rhstype, type);
break;
default:
gcc_unreachable ();

View file

@ -1,3 +1,16 @@
2008-10-22 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c/30949
* gcc.target/i386/sse-vect-types.c: Update.
* gcc.dg/simd-5.c: Update.
* gcc.dg/assign-warn-2.c: Update.
* gcc.dg/simd-2.c: Update.
* gcc.dg/simd-6.c: Update.
* gcc.dg/assign-warn-1.c: Update.
* gcc.dg/dfp/composite-type.c: Update.
* gcc.dg/simd-1.c: Update.
* gcc.dg/pr36997.c: Update.
2008-10-21 Paul Thomas <pault@gcc.gnu.org>
PR libfortran/36795

View file

@ -112,15 +112,17 @@ struct s { int a; };
TESTARG(stria, struct s, int); /* { dg-error "incompatible type for argument 1 of 'striaF'" } */
TESTARP(strib, struct s, int); /* { dg-error "incompatible type for argument 1 of 'stribFp.x'" } */
TESTASS(stric, struct s, int); /* { dg-error "incompatible types in assignment" } */
TESTASS(stric, struct s, int); /* { dg-error "incompatible types when assigning to type 'struct s' from type 'int'" } */
TESTINI(strid, struct s, int); /* { dg-error "invalid initializer" } */
TESTRET(strie, struct s, int); /* { dg-error "incompatible types in return" } */
TESTRET(strie, struct s, int); /* { dg-error "incompatible types when returning type 'int' but 'struct s' was expected" } */
TESTARG(istra, int, struct s); /* { dg-error "incompatible type for argument 1 of 'istraF'" } */
TESTARP(istrb, int, struct s); /* { dg-error "incompatible type for argument 1 of 'istrbFp.x'" } */
TESTASS(istrc, int, struct s); /* { dg-error "incompatible types in assignment" } */
TESTINI(istrd, int, struct s); /* { dg-error "incompatible types in initialization" } */
TESTRET(istre, int, struct s); /* { dg-error "incompatible types in return" } */
TESTASS(istrc, int, struct s); /* { dg-error "incompatible types when assigning to type 'int' from type 'struct s'" } */
TESTINI(istrd, int, struct s); /* { dg-error "incompatible types when initializing type 'int' using type 'struct s'" } */
TESTRET(istre, int, struct s); /* { dg-error "incompatible types when returning type 'struct s' but 'int' was expected" } */
/* Match all extra informative notes. */
/* { dg-message "note: expected '\[^\n'\]*' but argument is of type '\[^\n'\]*'" "note: expected" { target *-*-* } 0 } */

View file

@ -113,13 +113,13 @@ struct s { int a; };
TESTARG(stria, struct s, int); /* { dg-error "incompatible type for argument 1 of 'striaF'" } */
TESTARP(strib, struct s, int); /* { dg-error "incompatible type for argument 1 of 'stribFp.x'" } */
TESTASS(stric, struct s, int); /* { dg-error "incompatible types in assignment" } */
TESTASS(stric, struct s, int); /* { dg-error "incompatible types when assigning to type 'struct s' from type 'int'" } */
TESTINI(strid, struct s, int); /* { dg-error "invalid initializer" } */
TESTRET(strie, struct s, int); /* { dg-error "incompatible types in return" } */
TESTRET(strie, struct s, int); /* { dg-error "incompatible types when returning type 'int' but 'struct s' was expected" } */
TESTARG(istra, int, struct s); /* { dg-error "incompatible type for argument 1 of 'istraF'" } */
TESTARP(istrb, int, struct s); /* { dg-error "incompatible type for argument 1 of 'istrbFp.x'" } */
TESTASS(istrc, int, struct s); /* { dg-error "incompatible types in assignment" } */
TESTINI(istrd, int, struct s); /* { dg-error "incompatible types in initialization" } */
TESTRET(istre, int, struct s); /* { dg-error "incompatible types in return" } */
TESTASS(istrc, int, struct s); /* { dg-error "incompatible types when assigning to type 'int' from type 'struct s'" } */
TESTINI(istrd, int, struct s); /* { dg-error "incompatible types when initializing type 'int' using type 'struct s'" } */
TESTRET(istre, int, struct s); /* { dg-error "incompatible types when returning type 'struct s' but 'int' was expected" } */
/* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } 0 } */

View file

@ -32,15 +32,15 @@ do \
d##TYPE = f2_##TYPE(h3_##TYPE); \
} while(0)
DECIMAL_COMPOSITE_DECL(32); /* { dg-error "incompatible types in assignment" } */
DECIMAL_COMPOSITE_DECL(32); /* { dg-error "incompatible types when assigning to type '\[^\n\]*' from type '\[^\n\]*'" } */
/* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } 35 } */
DECIMAL_COMPOSITE_DECL(64); /* { dg-error "incompatible types in assignment" } */
DECIMAL_COMPOSITE_DECL(64); /* { dg-error "incompatible types when assigning to type '\[^\n\]*' from type '\[^\n\]*'" } */
/* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } 39 } */
DECIMAL_COMPOSITE_DECL(128); /* { dg-error "incompatible types in assignment" } */
DECIMAL_COMPOSITE_DECL(128); /* { dg-error "incompatible types when assigning to type '\[^\n\]*' from type '\[^\n\]*'" } */
/* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } 43 } */

View file

@ -5,4 +5,5 @@ typedef int __m64 __attribute__ ((__vector_size__ (8), __may_alias__));
__m64 _mm_add_si64 (__m64 __m1, __m64 __m2)
{
return (__m64) __builtin_ia32_paddq ((long long)__m1, (long long)__m2); /* { dg-error "incompatible type" } */
/* { dg-message "note: expected 'long long int __vector__' but argument is of type 'long long int'" "" { target *-*-* } 7 } */
}

View file

@ -25,21 +25,21 @@ hanneke ()
a = b;
/* Assignment of different types. */
b = c; /* { dg-error "incompatible types in assignment" } */
d = a; /* { dg-error "incompatible types in assignment" } */
b = c; /* { dg-error "incompatible types when assigning" } */
d = a; /* { dg-error "incompatible types when assigning" } */
/* Casting between SIMDs of the same size. */
e = (typeof (e)) a;
/* Different signed SIMD assignment. */
f = a; /* { dg-message "note: use -flax-vector-conversions to permit conversions between vectors with differing element types or numbers of subparts" } */
/* { dg-error "incompatible types in assignment" "" { target *-*-* } 35 } */
/* { dg-error "incompatible types when assigning" "" { target *-*-* } 35 } */
/* Casted different signed SIMD assignment. */
f = (uv4si) a;
/* Assignment between scalar and SIMD of different size. */
foo = a; /* { dg-error "incompatible types in assignment" } */
foo = a; /* { dg-error "incompatible types when assigning" } */
/* Casted assignment between scalar and SIMD of same size. */
foo = (typeof (foo)) foo2;

View file

@ -23,14 +23,14 @@ hanneke ()
a = b;
/* Assignment of different types. */
b = c; /* { dg-error "incompatible types in assignment" } */
d = a; /* { dg-error "incompatible types in assignment" } */
b = c; /* { dg-error "incompatible types when assigning" } */
d = a; /* { dg-error "incompatible types when assigning" } */
/* Casting between SIMDs of the same size. */
e = (typeof (e)) a;
/* Assignment between scalar and SIMD of different size. */
foo = a; /* { dg-error "incompatible types in assignment" } */
foo = a; /* { dg-error "incompatible types when assigning" } */
/* Casted assignment between scalar and SIMD of same size. */
foo = (typeof (foo)) foo2; /* { dg-error "aggregate value used where a float was expected" } */

View file

@ -5,4 +5,4 @@
#define vector __attribute__ ((vector_size (8)))
vector char x = (vector char) {1,2,3,4,5,6,7,8}; /* { dg-bogus "initializer" } */
vector char y = (vector short) {1,2,3,4}; /* { dg-message "note: use -flax-vector-conversions to permit conversions between vectors with differing element types or numbers of subparts" } */
/* { dg-error "incompatible types in initialization" "" { target *-*-* } 7 } */
/* { dg-error "incompatible types when initializing" "" { target *-*-* } 7 } */

View file

@ -5,4 +5,4 @@
#define vector __attribute__ ((vector_size (8)))
vector char x = (vector char) {1,2,3,4,5,6,7,8}; /* { dg-bogus "initializer" } */
vector char y = (vector short) {1,2,3,4}; /* { dg-message "note: use -flax-vector-conversions to permit conversions between vectors with differing element types or numbers of subparts" } */
/* { dg-error "incompatible types in initialization" "" { target *-*-* } 7 } */
/* { dg-error "incompatible types when initializing" "" { target *-*-* } 7 } */

View file

@ -10,3 +10,4 @@ __m128d foo1(__m128d z, __m128d a, int N) {
}
return a;
}
/* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } 0 } */