re PR c/30949 ("incompatible pointer type" warning does not point to declaration)
authorManuel López-Ibáñez <manu@gcc.gnu.org>
Wed, 22 Oct 2008 16:33:17 +0000 (16:33 +0000)
committerManuel López-Ibáñez <manu@gcc.gnu.org>
Wed, 22 Oct 2008 16:33:17 +0000 (16:33 +0000)
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

12 files changed:
gcc/ChangeLog
gcc/c-typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/assign-warn-1.c
gcc/testsuite/gcc.dg/assign-warn-2.c
gcc/testsuite/gcc.dg/dfp/composite-type.c
gcc/testsuite/gcc.dg/pr36997.c
gcc/testsuite/gcc.dg/simd-1.c
gcc/testsuite/gcc.dg/simd-2.c
gcc/testsuite/gcc.dg/simd-5.c
gcc/testsuite/gcc.dg/simd-6.c
gcc/testsuite/gcc.target/i386/sse-vect-types.c

index ffbb6072b9b60c1c3e31ca013f5f503327a9ecc7..7e72bca41ce38b80f3e33a2cc564ca907baa518b 100644 (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
index da98c43c4bf7dae1808b2ed1eb3c797a6478a5c7..52042fa657761ed133d7363a1eaada4c8361af5e 100644 (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 ();
index 0f322dcc928df5c3ce49a52113c4499420727eba..76fc9db49ac44f7429550ce2deb802790b5e8a71 100644 (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
index 4c603829d59586fa74e4289bed4479cddbd5000c..a0cfd890f1093122696a3160564cde38eff4912f 100644 (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 } */
index 4656961f6c45b1f0fe608d89bbd9df5311d5b927..f3d861d7405b7af84aab83974503c2971b69b881 100644 (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 } */
index b2e7632e62adaf96125486f49411db5c50663087..2abc82175958febb72f0c2ec4f8736dde0e044de 100644 (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 } */
 
 
index b7b892d81765c242f1556d1e2152120851af1ab4..1fbb8fd6946c29b740c97228c78d9a6f5cd3ef0b 100644 (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 } */
 }
index d0064ad4d32210a5c14e5640942e56327884491e..e00e1dd693127a279c8ece1c812dfaf46037e8e0 100644 (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;
index 09e28a7798af7c81dcd087c8cbc35878911fdf47..13e1caba6cb1c8e9ad0815ea50d95e7c81f8adde 100644 (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" } */
index 2a3147004db707c9aab55e758c3e9e2380f9adc5..cb0ecf8982a8422d56594ed9cd70aefb2b733404 100644 (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 } */
index d8ae1a590cd3d73f062da600fc374c26a8316f80..969697994dc6df61868464bc8104adc98a3b4318 100644 (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 } */
index de799aba2c48bc3f8d5c59e53f2b19ce866acff3..9cb6f3e07cd45fe6fa8c9cd68af71e3e605f11e7 100644 (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 } */