]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ipa/100791 - copy fntype when processing __builtin_va_arg_pack
authorRichard Biener <rguenther@suse.de>
Fri, 28 May 2021 11:31:35 +0000 (13:31 +0200)
committerRichard Biener <rguenther@suse.de>
Wed, 16 Jun 2021 12:05:36 +0000 (14:05 +0200)
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)

gcc/testsuite/gcc.dg/pr100791.c [new file with mode: 0644]
gcc/tree-inline.c

diff --git a/gcc/testsuite/gcc.dg/pr100791.c b/gcc/testsuite/gcc.dg/pr100791.c
new file mode 100644 (file)
index 0000000..96cf34f
--- /dev/null
@@ -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" } */
index 0ef80c93fc4674222725580832fb41e163359b14..ac2ab14744a266491e71b15219be921306860c89 100644 (file)
@@ -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));