diff options
author | Richard Guenther <rguenther@suse.de> | 2008-04-23 13:47:38 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2008-04-23 13:47:38 +0000 |
commit | f3f75f693d12f58acbb37d393280081621eb3f58 (patch) | |
tree | 0ec573150b9f8a82ee9900eae5388c150fd6adc9 /gcc/c-common.c | |
parent | 09725d5e8d80ae185255eaa51f16570869f413bc (diff) | |
download | gcc-f3f75f693d12f58acbb37d393280081621eb3f58.zip gcc-f3f75f693d12f58acbb37d393280081621eb3f58.tar.gz gcc-f3f75f693d12f58acbb37d393280081621eb3f58.tar.bz2 |
re PR c/36021 (__attribute__((alloc_size(n))) with function of no arguments causes gcc to segfault)
2008-04-23 Richard Guenther <rguenther@suse.de>
PR middle-end/36021
* c-common.c (handle_alloc_size_attribute): Use type_num_arguments.
* gcc.dg/attr-alloc_size-2.c: New testcase.
From-SVN: r134595
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index 351c628..a18752e 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -5941,12 +5941,7 @@ static tree handle_alloc_size_attribute (tree *node, tree ARG_UNUSED (name), tree args, int ARG_UNUSED (flags), bool *no_add_attrs) { - tree params = TYPE_ARG_TYPES (*node); - unsigned arg_count = 0; - - for (; TREE_CHAIN (params); params = TREE_CHAIN (params)) - arg_count ++; - + unsigned arg_count = type_num_arguments (*node); for (; args; args = TREE_CHAIN (args)) { tree position = TREE_VALUE (args); |