public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r11-8578] ipa/100791 - copy fntype when processing __builtin_va_arg_pack
Date: Wed, 16 Jun 2021 13:12:41 +0000 (GMT)	[thread overview]
Message-ID: <20210616131241.A5BAD384640D@sourceware.org> (raw)

https://gcc.gnu.org/g:bfd841cacd6f0a641413912cea39a4561c73f0cb

commit r11-8578-gbfd841cacd6f0a641413912cea39a4561c73f0cb
Author: Richard Biener <rguenther@suse.de>
Date:   Fri May 28 13:31:35 2021 +0200

    ipa/100791 - copy fntype when processing __builtin_va_arg_pack
    
    This missing copying exposed a type mismatch in the IL.
    
    2021-05-28  Richard Biener  <rguenther@suse.de>
    
            PR ipa/100791
            * tree-inline.c (copy_bb): When processing __builtin_va_arg_pack
            copy fntype from original call.
    
            * gcc.dg/pr100791.c: New testcase.
    
    (cherry picked from commit 359c0a86e2974a9f3036bc05b6e6c661f2c463cf)

Diff:
---
 gcc/testsuite/gcc.dg/pr100791.c | 9 +++++++++
 gcc/tree-inline.c               | 1 +
 2 files changed, 10 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/pr100791.c b/gcc/testsuite/gcc.dg/pr100791.c
new file mode 100644
index 00000000000..96cf34f14a4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr100791.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+static inline int __attribute__((__always_inline__))
+foo ()
+{
+  return log_bad_request(0, __builtin_va_arg_pack()); /* { dg-warning "implicit" } */
+}
+void log_bad_request() { foo (0); } /* { dg-warning "conflicting types" } */
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 0ef80c93fc4..ac2ab14744a 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -2124,6 +2124,7 @@ copy_bb (copy_body_data *id, basic_block bb,
 		 GF_CALL_VA_ARG_PACK.  */
 	      gimple_call_copy_flags (new_call, call_stmt);
 	      gimple_call_set_va_arg_pack (new_call, false);
+	      gimple_call_set_fntype (new_call, gimple_call_fntype (call_stmt));
 	      /* location includes block.  */
 	      gimple_set_location (new_call, gimple_location (stmt));
 	      gimple_call_set_lhs (new_call, gimple_call_lhs (call_stmt));


                 reply	other threads:[~2021-06-16 13:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210616131241.A5BAD384640D@sourceware.org \
    --to=rguenth@gcc.gnu.org \
    --cc=gcc-cvs@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).