aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Myers <jsm@polyomino.org.uk>2004-10-12 09:32:17 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2004-10-12 09:32:17 +0100
commit3789b316508f81b2b12ae20b64a8a0ede9c6c86e (patch)
tree503a2dfc7f624bf18a4100ac6311c19a27ef961c
parent35f06ae4663c6f187a952fa7f0d1659a3e2f7574 (diff)
downloadgcc-3789b316508f81b2b12ae20b64a8a0ede9c6c86e.zip
gcc-3789b316508f81b2b12ae20b64a8a0ede9c6c86e.tar.gz
gcc-3789b316508f81b2b12ae20b64a8a0ede9c6c86e.tar.bz2
re PR c/17301 (ICE on wrong usage of __builtin_stdarg_start)
PR c/17301 * c-typeck.c (convert_arguments): Return error_mark_node if there are too few arguments. (build_function_call): Handle error_mark_node return from convert_arguments. testsuite: * gcc.dg/pr17301-2.c: New test. From-SVN: r88921
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/c-typeck.c11
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr17301-2.c9
4 files changed, 31 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5f387f8..1ba7210 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2004-10-12 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ PR c/17301
+ * c-typeck.c (convert_arguments): Return error_mark_node if there
+ are too few arguments.
+ (build_function_call): Handle error_mark_node return from
+ convert_arguments.
+
2004-10-06 Paolo Bonzini <bonzini@gnu.org>
* configure.ac (symbolic_link): Replace with $LN_S.
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 5fe3b9d..7cc1024 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -1987,6 +1987,9 @@ build_function_call (tree function, tree params)
coerced_params
= convert_arguments (TYPE_ARG_TYPES (fntype), params, function, fundecl);
+ if (coerced_params == error_mark_node)
+ return error_mark_node;
+
/* Check that the arguments to the function are valid. */
check_function_arguments (TYPE_ATTRIBUTES (fntype), coerced_params);
@@ -2014,7 +2017,8 @@ build_function_call (tree function, tree params)
/* Convert the argument expressions in the list VALUES
to the types in the list TYPELIST. The result is a list of converted
- argument expressions.
+ argument expressions, unless there are too few arguments in which
+ case it is error_mark_node.
If TYPELIST is exhausted, or when an element has NULL as its type,
perform the default conversions.
@@ -2219,7 +2223,10 @@ convert_arguments (tree typelist, tree values, tree function, tree fundecl)
}
if (typetail != 0 && TREE_VALUE (typetail) != void_type_node)
- error ("too few arguments to function %qE", function);
+ {
+ error ("too few arguments to function %qE", function);
+ return error_mark_node;
+ }
return nreverse (result);
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 13217f7..766dcec 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2004-10-12 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ PR c/17301
+ * gcc.dg/pr17301-2.c: New test.
+
2004-10-11 Mark Mitchell <mark@codesourcery.com>
PR c++/15876
diff --git a/gcc/testsuite/gcc.dg/pr17301-2.c b/gcc/testsuite/gcc.dg/pr17301-2.c
new file mode 100644
index 0000000..e89b953
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr17301-2.c
@@ -0,0 +1,9 @@
+/* Invalid use of __builtin_stdarg_start should not cause an ICE. Bug
+ 17301. Case with no arguments. */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+void foo (char *format, ...)
+{
+ __builtin_stdarg_start (); /* { dg-error "error: too few arguments to function '__builtin_stdarg_start'" } */
+}