Hi,
this patch fixes PR77558, an ice-on-invalid-code 6/7 regression.
The fix for PR71602 introduced the invalid-code test-case
c-c++-common/va-arg-va-list-type.c:
...
__builtin_va_list *pap;
void
fn1 (void)
{
__builtin_va_arg (pap, double); /* { dg-error "first argument to
'va_arg' not of type 'va_list'" } */
}
...
The test-case passes for x86_64, but fails for aarch64 and ICEs for arm.
The ICE happens because the patch for PR71602 is incomplete. The patch
tries to be more strict about returning a canonical va_list only for
actual va_lists, but doesn't implement this for structure va_list types,
such as we have for arm, aarch64 and alpha.
This patch adds the missing part, and fixes the ICE.
OK for trunk, 6-branch?
Thanks,
- Tom
Remove RECORD_TYPE special-casing in std_canonical_va_list_type
2016-09-25 Tom de Vries <t...@codesourcery.com>
PR middle-end/77558
* builtins.c (std_canonical_va_list_type): Remove RECORD_TYPE
special-casing.
---
gcc/builtins.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 9a19a75..f91e6d3 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -4089,10 +4089,8 @@ std_canonical_va_list_type (tree type)
wtype = va_list_type_node;
htype = type;
- /* Treat structure va_list types. */
- if (TREE_CODE (wtype) == RECORD_TYPE && POINTER_TYPE_P (htype))
- htype = TREE_TYPE (htype);
- else if (TREE_CODE (wtype) == ARRAY_TYPE)
+
+ if (TREE_CODE (wtype) == ARRAY_TYPE)
{
/* If va_list is an array type, the argument may have decayed
to a pointer type, e.g. by being passed to another function.