https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105376
--- Comment #3 from joseph at codesourcery dot com <joseph at codesourcery dot com> --- For this transformation to be correct for DFP, you need a 2 with quantum exponent 0. Converting from either integer or binary floating-point 2 will work for that. However, I note that decimal_to_decnumber has case rvc_normal: if (!r->decimal) { /* dconst{1,2,m1,half} are used in various places in the middle-end and optimizers, allow them here as an exception by converting them to decimal. */ so the existing code ought to work as-is. Maybe there is a problem with padding in REAL_VALUE_TYPE meaning the comparisons don't work as intended?