From 5d9a283ac6aaa10d7f1052dba4cde7a8a63c88fc Mon Sep 17 00:00:00 2001
From: Martin Sebor <msebor@redhat.com>
Date: Tue, 14 Mar 2017 22:16:27 +0000
Subject: re PR middle-end/80020 (gcc confused about aligned_alloc argument
 order)

	PR middle-end/80020
	* builtin-attrs.def (ATTR_ALLOC_SIZE_2_NOTHROW_LIST): New macro.
	* builtins.def (aligned_alloc): Use it.

	PR middle-end/80020
	* gcc.dg/attr-alloc_size-6.c: Correct aligned_alloc argument order.
	* gcc.dg/attr-alloc_size-7.c: Same.
	* gcc.dg/attr-alloc_size-9.c: Same.
	* gcc.dg/builtin-alloc-size.c: Same.
	* gcc.dg/pr80020.c: New test.

From-SVN: r246145
---
 gcc/builtin-attrs.def | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'gcc/builtin-attrs.def')

diff --git a/gcc/builtin-attrs.def b/gcc/builtin-attrs.def
index 2753288..38fb1bb 100644
--- a/gcc/builtin-attrs.def
+++ b/gcc/builtin-attrs.def
@@ -156,9 +156,12 @@ DEF_ATTR_TREE_LIST (ATTR_COLD_CONST_NORETURN_NOTHROW_LEAF_LIST, ATTR_CONST,\
 			ATTR_NULL, ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST)
 
 /* Allocation functions like malloc and realloc whose first argument
-   specifies the size of the allocated object.  */
+   with _SIZE_1, or second argument with _SIZE_2, specifies the size
+   of the allocated object.  */
 DEF_ATTR_TREE_LIST (ATTR_MALLOC_SIZE_1_NOTHROW_LIST, ATTR_ALLOC_SIZE,	\
 			ATTR_LIST_1, ATTR_MALLOC_NOTHROW_LIST)
+DEF_ATTR_TREE_LIST (ATTR_ALLOC_SIZE_2_NOTHROW_LIST, ATTR_ALLOC_SIZE,	\
+			ATTR_LIST_2, ATTR_MALLOC_NOTHROW_LIST)
 DEF_ATTR_TREE_LIST (ATTR_MALLOC_SIZE_1_NOTHROW_LEAF_LIST, ATTR_ALLOC_SIZE, \
 		        ATTR_LIST_1, ATTR_MALLOC_NOTHROW_LEAF_LIST)
 /* Alloca is just like malloc except that it never returns null.  */
-- 
cgit v1.1

