https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60181
Paul Zimmermann <zimmerma+gcc at loria dot fr> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |zimmerma+gcc at loria dot fr --- Comment #9 from Paul Zimmermann <zimmerma+gcc at loria dot fr> --- Here is another example: $ cat t.c #include <complex.h> #include <stdio.h> #include <stdlib.h> _Complex double __attribute__ ((noinline)) calc_div (_Complex double a, _Complex double b) { return a / b; } _Complex double __attribute__ ((noinline)) calc_mul (_Complex double a, _Complex double b) { return a * b; } int main (int argc, char **argv) { double x, y, z, t; _Complex double a, b, c, d; x = -1.0689346237980500e+252; y = 7.8846096489686452e-145; z = 5.1152592576527620e-318; t = 6.7327111521288819e+78; a = calc_div (x + y * I, z + t * I); b = (x + y * I) / (z + t * I); printf ("calc_div: %ap + %ap * i\n", creal (a), cimag (a)); printf ("div: %ap + %ap * i\n", creal (b), cimag (b)); x = -4.8798814420289904e-22; y = -6.4569205261627488e+209; z = -1.0918976936190148e+147; t = -8.2942999263695497e-85; c = calc_mul (x + y * I, z + t * I); d = (x + y * I) * (z + t * I); printf ("calc_mul: %ap + %ap * i\n", creal (c), cimag (c)); printf ("mul: %ap + %ap * i\n", creal (d), cimag (d)); return 0; } With gcc version 9.2.1 20200123 (Debian 9.2.1-25) on x86_64 I get: $ gcc -O0 t.c; ./a.out calc_div: 0x1.5ac8471ecdabp-741p + 0x1.48aa457eda0eep+575p * i div: 0x1.5ac8471ecdabp-741p + 0x1.48aa457eda0eep+575p * i calc_mul: -0x1.07a6046b053p+410p + infp * i mul: -0x1.07a6046b053p+410p + infp * i $ gcc -O2 t.c; ./a.out calc_div: 0x1.5ac8471ecdabp-741p + 0x1.48aa457eda0eep+575p * i div: -0x1.4d35f7c831ef5p-746p + 0x1.48aa457eda0eep+575p * i calc_mul: -0x1.07a6046b053p+410p + infp * i mul: -0x1.07a6046b053p+410p + infp * i For division, the correctly rounded result is the one for "div" with -O2 (negative real part). For multiplication, all results are incorrectly rounded, we should get -0x1.07a6046b05347p410 if I'm correct. I understand there is no accuracy requirement, but I thought with -O2 gcc was using GNU MPC to get correct rounding, thus with -O2 both the "div" and "mul" results should be correctly rounded. Why isn't it the case for mul?