[Bug c/91373] gcc6.2.0: ((U32)((U16 * U16)) >> 31) cannot always get correct result with gcc -O2

2019-08-06 Thread qiang.fu at verisilicon dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91373 --- Comment #7 from Qiang --- Sorry to be a bother and thanks all of you. '-fsanitize=undefined' & '-fwrapv' are new item to me. '-fsanitize=undefined' is helpful to me to find out the similar issue in our code. '-fwrapv' may hide other

[Bug c/91373] gcc6.2.0: ((U32)((U16 * U16)) >> 31) cannot always get correct result with gcc -O2

2019-08-06 Thread qiang.fu at verisilicon dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91373 --- Comment #2 from Qiang --- Hi Andrew, Thank your for your quickly reply. I still have some questions about this issue. It's very natural to write down the following code. All arguments are declared with 'U16', and the return type is 'U32'.

[Bug c/91373] New: gcc6.2.0: ((U32)((U16 * U16)) >> 31) cannot always get correct result with gcc -O2

2019-08-05 Thread qiang.fu at verisilicon dot com
FIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: qiang.fu at verisilicon dot com Target Milestone: --- Created attachment 46676 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46676=edit main.c Hi, I met