This fixes PR53214 - we should not mark flto-report, fwpa or ftrans as Optimization, otherwise you can control them with the optimize attribute and they get munged when streamed to ltrans units from WPA.
Will commit this to trunk and 4.7 after giving it a round of testing. Richard. 2012-05-04 Richard Guenther <rguent...@suse.de> * common.opt (flto-report): Do not mark as Optimization. lto/ * lang.opt (fwpa): Do not mark as Optimization. (fltrans): Likewise. * gcc.dg/lto/pr53214_0.c: New testcase. Index: gcc/common.opt =================================================================== *** gcc/common.opt (revision 187148) --- gcc/common.opt (working copy) *************** Common Joined RejectNegative UInteger Va *** 1424,1430 **** -flto-compression-level=<number> Use zlib compression level <number> for IL flto-report ! Common Report Var(flag_lto_report) Init(0) Optimization Report various link-time optimization statistics fmath-errno --- 1424,1430 ---- -flto-compression-level=<number> Use zlib compression level <number> for IL flto-report ! Common Report Var(flag_lto_report) Init(0) Report various link-time optimization statistics fmath-errno Index: gcc/lto/lang.opt =================================================================== *** gcc/lto/lang.opt (revision 187148) --- gcc/lto/lang.opt (working copy) *************** Language *** 25,31 **** LTO fltrans ! LTO Report Var(flag_ltrans) Optimization Run the link-time optimizer in local transformation (LTRANS) mode. fltrans-output-list= --- 25,31 ---- LTO fltrans ! LTO Report Var(flag_ltrans) Run the link-time optimizer in local transformation (LTRANS) mode. fltrans-output-list= *************** LTO Joined Var(ltrans_output_list) *** 33,39 **** Specify a file to which a list of files output by LTRANS is written. fwpa ! LTO Driver Report Var(flag_wpa) Optimization Run the link-time optimizer in whole program analysis (WPA) mode. fresolution= --- 33,39 ---- Specify a file to which a list of files output by LTRANS is written. fwpa ! LTO Driver Report Var(flag_wpa) Run the link-time optimizer in whole program analysis (WPA) mode. fresolution= Index: gcc/testsuite/gcc.dg/lto/pr53214_0.c =================================================================== --- gcc/testsuite/gcc.dg/lto/pr53214_0.c (revision 0) +++ gcc/testsuite/gcc.dg/lto/pr53214_0.c (revision 0) @@ -0,0 +1,8 @@ +/* { dg-lto-do run } */ + +double a(double) __attribute__ ((optimize(1), used)); +double a(double r) +{ + return r; +} +int main () { return 0; }