This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/36675] New: va_list argument breaks inlining (ambiguous warning).
- From: "laurent dot deniau at cern dot ch" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Jun 2008 13:39:21 -0000
- Subject: [Bug c/36675] New: va_list argument breaks inlining (ambiguous warning).
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
If it's not a bug (the code run correctly), I suggest that the first warning
below should say "can never be inlined because it uses va_list argument". But I
do not understand why an argument of type va_list forbid inlining (not observed
in previous version AFAIK) while I understand why ellipsis can forbid it.
gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
Target: i486-linux-gnu
gcc -std=c99 -Wall -W -Winline -O3 variadic.c
variadic.c: In function 'fv':
variadic.c:8: warning: function 'fv' can never be inlined because it uses
variable argument lists
variadic.c: In function 'vf':
variadic.c:8: warning: inlining failed in call to 'fv': function not inlinable
variadic.c:21: warning: called from here
cat variadic.c
#include <stdarg.h>
#include <stdio.h>
static inline int f(int a, va_list va) {
return a + va_arg(va,int);
}
static inline int fv(int a, va_list va) {
int res;
va_list vac;
va_copy(vac, va);
res = f(a, vac);
va_end(vac);
return res;
}
static int vf(int a, ...) {
int ret;
va_list va;
va_start(va, a);
ret = fv(a, va);
va_end(va);
return ret;
}
int main(void) {
printf("%d\n", vf(1,2));
}
--
Summary: va_list argument breaks inlining (ambiguous warning).
Product: gcc
Version: 4.1.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: laurent dot deniau at cern dot ch
GCC host triplet: Debian etch i486 (x86_32) and x86_64
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36675