diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-07-03 08:18:09 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-07-03 08:18:09 +0000 |
commit | 23a035714b98dd8e31b26907349ac9c4a4ab7126 (patch) | |
tree | 62fd1d29ef96b1eead4ac5167bf27841c90a3586 | |
parent | b26a4c3cd8086d42139d05da8ebc2620c7a7ad38 (diff) | |
download | gcc-23a035714b98dd8e31b26907349ac9c4a4ab7126.tar.gz |
2008-07-02 Richard Guenther <rguenther@suse.de>
PR c++/36128
* typeck.c (cp_build_function_call): Move code to verify
builtin function arguments ...
* call.c (build_cxx_call): ... here.
* g++.dg/other/builtin1.C: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@137408 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/call.c | 7 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/builtin1.C | 6 |
5 files changed, 25 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6475b43fc1b..5ef7e2e1005 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2008-07-03 Richard Guenther <rguenther@suse.de> + + PR c++/36128 + * typeck.c (cp_build_function_call): Move code to verify + builtin function arguments ... + * call.c (build_cxx_call): ... here. + 2008-07-02 Jason Merrill <jason@redhat.com> * Make-lang.in (cp/typeck2.o): Add $(REAL_H) dependency. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index d41465db638..368d95a677f 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -5418,6 +5418,13 @@ build_cxx_call (tree fn, int nargs, tree *argarray) && cfun) cp_function_chain->can_throw = 1; + /* Check that arguments to builtin functions match the expectations. */ + if (fndecl + && DECL_BUILT_IN (fndecl) + && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL + && !check_builtin_function_arguments (fndecl, nargs, argarray)) + return error_mark_node; + /* Some built-in function calls will be evaluated at compile-time in fold (). */ fn = fold_if_not_in_template (fn); diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 14cbd9d8dd2..409f34068d4 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -2887,13 +2887,6 @@ cp_build_function_call (tree function, tree params, tsubst_flags_t complain) if (nargs < 0) return error_mark_node; - /* Check that arguments to builtin functions match the expectations. */ - if (fndecl - && DECL_BUILT_IN (fndecl) - && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL - && !check_builtin_function_arguments (fndecl, nargs, argarray)) - return error_mark_node; - /* Check for errors in format strings and inappropriately null parameters. */ check_function_arguments (TYPE_ATTRIBUTES (fntype), nargs, argarray, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1cfcad45c05..3feefc8985a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-07-03 Richard Guenther <rguenther@suse.de> + + PR c++/36128 + * g++.dg/other/builtin1.C: New testcase. + 2008-07-02 Joseph Myers <joseph@codesourcery.com> * g++.dg/compat/struct-layout-1.exp: Compile generator on build diff --git a/gcc/testsuite/g++.dg/other/builtin1.C b/gcc/testsuite/g++.dg/other/builtin1.C new file mode 100644 index 00000000000..88665819987 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/builtin1.C @@ -0,0 +1,6 @@ +/* { dg-do compile } */ + +void foo() +{ + __builtin_isless (foo, 0); /* { dg-error "non-floating-point arguments" } */ +} |