printf()calls into calls to
puts(). This is plainly unacceptable for at least two reasons:
printf()might have side-effects that
puts()doesn't (f.ex. see this bug report).
- It makes
LD_PRELOADinterception of certain functions ineffective.
This "optimization" takes place even when I compile my program with the
-ansiswitch. I haven't been able to find a switch to turn off this "optimization". In addition, the generated code in this case is plain wrong. No optimization should change the semantics of the program (which it does in this case).
C has always been the language in the lines of do what I say. How many other such surprises are hidden in gcc?
What they have done with this "optimization" is on the level with (if not worse than) MS's adaptation of C++ for CIL. Strangely, so many people bark at MS for their "wrong-doings", but the bug report cited above never even got a response. Well, at least I'm going to say this: shame on you gcc developers!