Summary: | __builtin_printf optimization conflicts with POSIX semantics | ||
---|---|---|---|
Product: | gcc | Reporter: | Rich Felker <bugdal> |
Component: | c | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | UNCONFIRMED --- | ||
Severity: | normal | ||
Priority: | P3 | ||
Version: | unknown | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | ||
Attachments: | test case |
Description
Rich Felker
2014-07-08 00:37:03 UTC
Since printf("") does not need to obtain ownership of stdout there is no conflict here. There is no requirement that it *must* obtain ownership even if not needed. Agreed. Yes it does need to obtain ownership of the file: to set the orientation to byte mode. This is required even by ISO C (without POSIX). A simpler test case: printf(""); printf("%d\n", fwide(stdout)); Sorry, that should be: printf(""); printf("%d\n", fwide(stdout, 0)); I reopened this, but now that I'm reporting a new symptom that's independent of the original symptom, I'm wondering whether I should file a separate bug report for it, or continue the issue under this original report. Which way is best? Both have the same fix (removing the invalid optimization or replacing it with a valid one), but the user-visible erroneous behaviors are distinct. |