diff mbox

[3/4] Fix assert in build_va_arg, case 2b

Message ID 21f9118f-c829-f6d0-0056-406d71c0b46f@mentor.com
State New
Headers show

Commit Message

Tom de Vries Aug. 24, 2016, 6:14 a.m. UTC
Hi,

this patch fixes an assert in build_va_arg. Instead of testing for 
pointer equality, we use the same test as is used in 
std_canonical_va_list_type.

Bootstrapped and reg-tested on x86_64.

OK for trunk?

Thanks,
- Tom

Comments

Joseph Myers Aug. 29, 2016, 3:50 p.m. UTC | #1
On Wed, 24 Aug 2016, Tom de Vries wrote:

> Hi,
> 
> this patch fixes an assert in build_va_arg. Instead of testing for pointer
> equality, we use the same test as is used in std_canonical_va_list_type.
> 
> Bootstrapped and reg-tested on x86_64.
> 
> OK for trunk?

OK.
diff mbox

Patch

Fix assert in build_va_arg, case 2b

2016-08-22  Tom de Vries  <tom@codesourcery.com>

	* c-common.c (build_va_arg): Fix type comparison assert.

---
 gcc/c-family/c-common.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index a289d2b..3b61e64 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -5894,7 +5894,10 @@  build_va_arg (location_t loc, tree expr, tree type)
     {
       /* Case 2b: va_list is pointer to array elem type.  */
       gcc_assert (POINTER_TYPE_P (va_type));
-      gcc_assert (TREE_TYPE (va_type) == TREE_TYPE (canon_va_type));
+
+      /* Comparison as in std_canonical_va_list_type.  */
+      gcc_assert (TYPE_MAIN_VARIANT (TREE_TYPE (va_type))
+		  == TYPE_MAIN_VARIANT (TREE_TYPE (canon_va_type)));
 
       /* Don't take the address.  We've already got '&ap'.  */
       ;