This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/21988] New: GCC should optimize printf("%s",foo) and printf("foo") into fputs(foo,stdout)
- From: "ghazi at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Jun 2005 17:50:45 -0000
- Subject: [Bug tree-optimization/21988] New: GCC should optimize printf("%s",foo) and printf("foo") into fputs(foo,stdout)
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
GCC should optimize printf("%s",foo) and printf("foo") into fputs(foo,stdout)
and fputs("foo",stdout) respectively. As noted here:
http://gcc.gnu.org/ml/gcc-patches/2000-09/msg00859.html
We can capture stdout in an inline function using fixincl, perhaps adding the
__always_inline__ attribute. Then do the above transformation.
In at least the printf("%s", foo) case, the result fputs(foo,stdout) has the
same number of arguments, so it might not even be a -Os problem.
--
Summary: GCC should optimize printf("%s",foo) and printf("foo")
into fputs(foo,stdout)
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P2
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ghazi at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21988