Thanks for reporting us.
We are working on this internally and will get back to you soon. Meanwhile, you can try using the Intel icx compiler to get the expected results.
Thanks & Regards
Can you use a workaround or icx/icpx? I would recommend using icx/icpx because at some point, the classic C/C++ compilers will enter “Legacy Product Support” mode signaling the end of regular updates to the classic compiler base, and they will no longer appear in oneAPI toolkits.
Please see the article for more details:
Hey, thanks for responses!
> Can you use a workaround or icx/icpx?
Well, I am not a user of icc, and I'm not using icc in any production project. I only found the problem, when doing a research project with no current practical use. I was only testing "if it works" on icc compiler and stumbled across the problem when unit-testing. I was implementing ckd library https://gitlab.com/Kamcuk/ckd based on proposition to the standard http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2792.pdf . If it's for example not "worth fixing", that's "fine for me". I have a path in the library that does not use any `__builtin` functions, and it works fine on icc anyway.
> I would recommend using icx/icpx because at some point, the classic C/C++ compilers
Sure, `icx -xc` works fine.
As a workaround in icc, a temporary variable can be used:
int x = a;
int o1 = __builtin_mul_overflow(x, 1, &c1);
We are going to close this issue as "wont fix".
Sorry for the inconvenience.