Commit f3f75f69 by Richard Guenther Committed by Richard Biener

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
parent 09725d5e
2008-04-23 Richard Guenther <rguenther@suse.de>
PR middle-end/36021
* c-common.c (handle_alloc_size_attribute): Use type_num_arguments.
2008-04-22 Tomas Bily <tbily@suse.cz> 2008-04-22 Tomas Bily <tbily@suse.cz>
* tree-cfg.c (verify_expr): Check for NON_LVALUE_EXPR as unreachable * tree-cfg.c (verify_expr): Check for NON_LVALUE_EXPR as unreachable
......
...@@ -5941,12 +5941,7 @@ static tree ...@@ -5941,12 +5941,7 @@ static tree
handle_alloc_size_attribute (tree *node, tree ARG_UNUSED (name), tree args, handle_alloc_size_attribute (tree *node, tree ARG_UNUSED (name), tree args,
int ARG_UNUSED (flags), bool *no_add_attrs) int ARG_UNUSED (flags), bool *no_add_attrs)
{ {
tree params = TYPE_ARG_TYPES (*node); unsigned arg_count = type_num_arguments (*node);
unsigned arg_count = 0;
for (; TREE_CHAIN (params); params = TREE_CHAIN (params))
arg_count ++;
for (; args; args = TREE_CHAIN (args)) for (; args; args = TREE_CHAIN (args))
{ {
tree position = TREE_VALUE (args); tree position = TREE_VALUE (args);
......
2008-04-23 Richard Guenther <rguenther@suse.de>
PR middle-end/36021
* gcc.dg/attr-alloc_size-2.c: New testcase.
2008-04-23 Kai Tietz <kai.tietz@onevision.com> 2008-04-23 Kai Tietz <kai.tietz@onevision.com>
* gcc.dg/20020919-1.c (loc_size_t): New type. * gcc.dg/20020919-1.c (loc_size_t): New type.
/* { dg-do compile } */
char *foo() __attribute__((alloc_size(1))); /* { dg-warning "outside range" } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment