PR c/17730
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 30 Sep 2004 18:17:54 +0000 (18:17 +0000)
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 30 Sep 2004 18:17:54 +0000 (18:17 +0000)
* c-typeck.c (lvalue_or_else): Pass msgid directly to error.

testsuite:
* gcc.dg/pr17730-1.c: New test

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@88343 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/c-typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr17730-1.c [new file with mode: 0644]

index 29486e3..4cdbe1b 100644 (file)
@@ -1,3 +1,8 @@
+2004-09-30  Joseph S. Myers  <jsm@polyomino.org.uk>
+
+       PR c/17730
+       * c-typeck.c (lvalue_or_else): Pass msgid directly to error.
+
 2004-09-30  Diego Novillo  <dnovillo@redhat.com>
 
        * tree-ssa-alias.c (collect_points_to_info_r): Move analysis of
index d744296..1d79b23 100644 (file)
@@ -2682,7 +2682,9 @@ lvalue_p (tree ref)
 }
 
 /* Return nonzero if REF is an lvalue valid for this language;
-   otherwise, print an error message and return zero.  */
+   otherwise, print an error message and return zero.  MSGID
+   is a format string which receives no arguments, but in which
+   formats such as %< and %> may occur.  */
 
 static int
 lvalue_or_else (tree ref, const char *msgid)
@@ -2690,7 +2692,7 @@ lvalue_or_else (tree ref, const char *msgid)
   int win = lvalue_p (ref);
 
   if (! win)
-    error ("%s", msgid);
+    error (msgid);
 
   return win;
 }
index 13e29d9..819d422 100644 (file)
@@ -1,3 +1,8 @@
+2004-09-30  Joseph S. Myers  <jsm@polyomino.org.uk>
+
+       PR c/17730
+       * gcc.dg/pr17730-1.c: New test
+
 2004-09-29  Joseph S. Myers  <jsm@polyomino.org.uk>
 
        PR c/7425
diff --git a/gcc/testsuite/gcc.dg/pr17730-1.c b/gcc/testsuite/gcc.dg/pr17730-1.c
new file mode 100644 (file)
index 0000000..0fede2f
--- /dev/null
@@ -0,0 +1,5 @@
+/* Test formatting of message for invalid lvalue.  Bug 17730.  */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+char *p = &'C'; /* { dg-error "error: invalid lvalue in unary '&'" } */