* Richard Biener: >> By disassembling the exe file generated by icc, I found that icc will >> merge these two blocks with the example code below. So I think there >> maybe some ways to make it. > > ... glibc for example allows user-provided printf format callbacks so > printf might call back into the current TU and modify globals in such > callback. That's a GNU extension to printf that ICC likely doesn't > support > (https://www.gnu.org/software/libc/manual/html_node/Customizing-Printf.html), > so that we're currently not doing this is for correctness. > > I'm not sure if this extension is much used or if it is maybe > deprecated.
There's also fopencookie, which is more widely available. The GNU C library supports assignment to stdout, so an fopencookie stream could be the target of printf, also triggering callbacks. But I'm not sure if callbacks updating global variables should prevent GCC from treating printf et al. as leaf functions. Thanks, Florian