printf has the correct behaviour as the value 0 is a special case.
Quoting POSIX [1]:
| #
| Specifies that the value is to be converted to an alternative form.
| For o conversion, it increases the precision (if necessary) to force
| the first digit of the result to be zero. For x or X conversion
| specifiers, a non-zero result shall have 0x (or 0X) prefixed to it.
| For a, A, e, E, f, F, g , and G conversion specifiers, the result
| shall always contain a radix character, even if no digits follow the
| radix character. Without this flag, a radix character appears in the
| result of these conversions only if a digit follows it. For g and G
| conversion specifiers, trailing zeros shall not be removed from the
| result as they normally are. For other conversion specifiers, the
| behavior is undefined.
| 0.
As you can see the '0x' prefix is added only for a non-zero value.
That is why '0000' is the correct output here.
I am therefore closing the bug.
[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/printf.html