From: Manuel López-Ibáñez Date: Wed, 22 Oct 2008 16:33:17 +0000 (+0000) Subject: re PR c/30949 ("incompatible pointer type" warning does not point to declaration) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a7da8b427fa7de6a459a0a3b33eca9de953aea62;p=gcc.git re PR c/30949 ("incompatible pointer type" warning does not point to declaration) 2008-10-22 Manuel López-Ibáñez 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ffbb6072b9b..7e72bca41ce 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2008-10-22 Manuel López-Ibáñez + + 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 * config/frv/frv.h (HARD_REGNO_RENAME_OK): Define. Do not allow diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index da98c43c4bf..52042fa6577 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -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 (); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0f322dcc928..76fc9db49ac 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,16 @@ +2008-10-22 Manuel López-Ibáñez + + 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 PR libfortran/36795 diff --git a/gcc/testsuite/gcc.dg/assign-warn-1.c b/gcc/testsuite/gcc.dg/assign-warn-1.c index 4c603829d59..a0cfd890f10 100644 --- a/gcc/testsuite/gcc.dg/assign-warn-1.c +++ b/gcc/testsuite/gcc.dg/assign-warn-1.c @@ -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 } */ diff --git a/gcc/testsuite/gcc.dg/assign-warn-2.c b/gcc/testsuite/gcc.dg/assign-warn-2.c index 4656961f6c4..f3d861d7405 100644 --- a/gcc/testsuite/gcc.dg/assign-warn-2.c +++ b/gcc/testsuite/gcc.dg/assign-warn-2.c @@ -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 } */ diff --git a/gcc/testsuite/gcc.dg/dfp/composite-type.c b/gcc/testsuite/gcc.dg/dfp/composite-type.c index b2e7632e62a..2abc8217595 100644 --- a/gcc/testsuite/gcc.dg/dfp/composite-type.c +++ b/gcc/testsuite/gcc.dg/dfp/composite-type.c @@ -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 } */ diff --git a/gcc/testsuite/gcc.dg/pr36997.c b/gcc/testsuite/gcc.dg/pr36997.c index b7b892d8176..1fbb8fd6946 100644 --- a/gcc/testsuite/gcc.dg/pr36997.c +++ b/gcc/testsuite/gcc.dg/pr36997.c @@ -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 } */ } diff --git a/gcc/testsuite/gcc.dg/simd-1.c b/gcc/testsuite/gcc.dg/simd-1.c index d0064ad4d32..e00e1dd6931 100644 --- a/gcc/testsuite/gcc.dg/simd-1.c +++ b/gcc/testsuite/gcc.dg/simd-1.c @@ -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; diff --git a/gcc/testsuite/gcc.dg/simd-2.c b/gcc/testsuite/gcc.dg/simd-2.c index 09e28a7798a..13e1caba6cb 100644 --- a/gcc/testsuite/gcc.dg/simd-2.c +++ b/gcc/testsuite/gcc.dg/simd-2.c @@ -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" } */ diff --git a/gcc/testsuite/gcc.dg/simd-5.c b/gcc/testsuite/gcc.dg/simd-5.c index 2a3147004db..cb0ecf8982a 100644 --- a/gcc/testsuite/gcc.dg/simd-5.c +++ b/gcc/testsuite/gcc.dg/simd-5.c @@ -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 } */ diff --git a/gcc/testsuite/gcc.dg/simd-6.c b/gcc/testsuite/gcc.dg/simd-6.c index d8ae1a590cd..969697994dc 100644 --- a/gcc/testsuite/gcc.dg/simd-6.c +++ b/gcc/testsuite/gcc.dg/simd-6.c @@ -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 } */ diff --git a/gcc/testsuite/gcc.target/i386/sse-vect-types.c b/gcc/testsuite/gcc.target/i386/sse-vect-types.c index de799aba2c4..9cb6f3e07cd 100644 --- a/gcc/testsuite/gcc.target/i386/sse-vect-types.c +++ b/gcc/testsuite/gcc.target/i386/sse-vect-types.c @@ -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 } */