https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119241
--- Comment #18 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Richard Biener from comment #17) > Created attachment 60834 [details] > functional patch with bugs > > So this is a functional patch ontop of prerequesites that were posted for > review. There's bugs. At least we have > > FAIL: cobol.dg/group1/display2.cob -O0 output pattern test > FAIL: cobol.dg/group1/display2.cob -O1 output pattern test > FAIL: cobol.dg/group1/display2.cob -O2 output pattern test > FAIL: cobol.dg/group1/display2.cob -O3 -fomit-frame-pointer -funroll-loops > -fpeel-loops -ftracer -finline-functions output pattern test > FAIL: cobol.dg/group1/display2.cob -O3 -g output pattern test > FAIL: cobol.dg/group1/display2.cob -Os output pattern test > > === cobol Summary === > > # of expected passes 309 > # of unexpected failures 6 > # of expected failures 6 > > where the FAIL is > > FAIL: cobol.dg/group1/display2.cob -O0 output pattern test > Output was: > 1.00000000000000000000000000000000e+0 2.00000000000000000000000000000000e+0 > > Should match: > 1 2 It's the following hunk. real_to_decimal always uses e+exp notation and a lower-case 'E'. So we might want to post-process the string instead of trying to re-format. @@ -4884,7 +4883,8 @@ parser_display_internal(tree file_descriptor, // We make use of that here char ach[128]; - strfromf128(ach, sizeof(ach), "%.33E", refer.field->data.value_of()); + real_to_decimal (ach, TREE_REAL_CST_PTR (refer.field->data.value_of()), + sizeof(ach), 33, 0); char *p = strchr(ach, 'E'); if( !p ) { @@ -4901,9 +4901,8 @@ parser_display_internal(tree file_descriptor, else { int precision = 32 - exp; - char achFormat[24]; - sprintf(achFormat, "%%.%df", precision); - strfromf128(ach, sizeof(ach), achFormat, refer.field->data.value_of()); + real_to_decimal (ach, TREE_REAL_CST_PTR (refer.field->data.value_of()), + sizeof(ach), precision, 0); } __gg__remove_trailing_zeroes(ach); }