Bug 48731

Summary: regression: __attribute__((flatten)) produces error with function calling variadic functions
Product: gcc Reporter: Florent Bruneau <florent.bruneau_gcc>
Component: cAssignee: Richard Biener <rguenth>
Status: RESOLVED FIXED    
Severity: normal CC: florent.bruneau_gcc
Priority: P3    
Version: 4.6.0   
Target Milestone: 4.6.1   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2011-04-23 09:13:41
Attachments: preprocessed example source

Description Florent Bruneau 2011-04-22 19:10:15 UTC
Created attachment 24075 [details]
preprocessed example source

Function with the flatten attribute that call variadic function do not compile anymore with gcc-4.6. It worked perfectly with gcc-4.5. The attachment provide a simple example of code.

Compilation flag:
% gcc-4.6 -std=gnu99 --save-temp -O3 -c flatten_variadic.c

Resulting error:
flatten_variadic.c: In function ‘blah2’:
flatten_variadic.c:5:23: error: ‘va_start’ used in function with fixed args

GCC: gcc-4.6 (Debian 4.6.0-4) 4.6.1 20110419 (prerelease)
System: Debian: Linux edelzwicker 2.6.38-2-amd64 #1 SMP Thu Apr 7 04:28:07 UTC 2011 x86_64 GNU/Linux
Comment 1 Richard Biener 2011-04-23 09:13:41 UTC
I will have a look.
Comment 2 Richard Biener 2011-04-26 12:59:33 UTC
Author: rguenth
Date: Tue Apr 26 12:59:22 2011
New Revision: 172963

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172963
Log:
2011-04-26  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/48731
	* ipa-inline.c (cgraph_flatten): Test if function is inlinable.

	* gcc.dg/torture/pr48731.c: New testcase.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/gcc.dg/torture/pr48731.c
Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/ipa-inline.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
Comment 3 Richard Biener 2011-04-26 13:00:58 UTC
Author: rguenth
Date: Tue Apr 26 13:00:53 2011
New Revision: 172964

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172964
Log:
2011-04-26  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/48731
	* gcc.dg/torture/pr48731.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr48731.c
Modified:
    trunk/gcc/testsuite/ChangeLog
Comment 4 Richard Biener 2011-04-26 13:01:55 UTC
Fixed.