From: Tom de Vries <Tom_deVries@mentor.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: [PATCH, PR77558] Remove RECORD_TYPE special-casing in std_canonical_va_list_type
Date: Sun, 25 Sep 2016 13:00:00 -0000 [thread overview]
Message-ID: <2908590d-f799-7053-9f52-2f0b65803c4e@mentor.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 754 bytes --]
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
[-- Attachment #2: 0001-Remove-RECORD_TYPE-special-casing-in-std_canonical_va_list_type.patch --]
[-- Type: text/x-patch, Size: 893 bytes --]
Remove RECORD_TYPE special-casing in std_canonical_va_list_type
2016-09-25 Tom de Vries <tom@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.
next reply other threads:[~2016-09-25 9:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-25 13:00 Tom de Vries [this message]
2016-10-07 15:25 ` Tamar Christina
2016-10-10 9:54 ` Richard Biener
2016-10-11 12:01 ` Christophe Lyon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2908590d-f799-7053-9f52-2f0b65803c4e@mentor.com \
--to=tom_devries@mentor.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).