------- Comment #19 from gustavodn at gmail dot com 2008-01-15 21:08 ------- (In reply to comment #17) > This will be fixed yesterday if printf("%s\n", s) were equivalent to puts(s) > in > glibc.
[+] The standard requires them to be equivalent? Per standard, they can't be equivalent if both are undefined when NULL is passed, right? > Also there is a way to disable the optimization: "-fno-builtin-printf". > > People that don't rely on undefined behaviour don't deserve to be punished > with > suboptimal code. It is not undefined, per glibc. GCC is defining undefined behavior, just as much as glibc, to optimize, that should be documented or fixed. (In reply to comment #18) > There is an explanation for the optimisation, a potential fix [*] and there is > a workaround. > > [*] http://sourceware.org/bugzilla/show_bug.cgi?id=5618 [+] -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25609