https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78959
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |WAITING Last reconfirmed| |2017-01-01 Ever confirmed|0 |1 --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- The test output "4105" => 4 indicates that on HP-UX the %hhd directive doesn't convert the int argument (4105) to unsigned char to end up with 9 as the test expects. I think that's a bug in the HP-UX sprintf (do you have a way of reporting it and/or finding out if HP will fix it?), although there is/was some uncertainty about whether passing a value outside the range of char to %hhd is valid (https://groups.google.com/forum/#!topic/comp.std.c/evMVFdOufys). One way to way to deal with this in GCC might be to add a configure test to detect the bug and adjust the byte count in the gimple-ssa-sprintf pass based on its result. Another might be to add a target hook describing the behavior and making the pass conditional on it. Or, if the code isn't considered valid the test could simply be marked XFAIL on HP-UX.