Re: [PATCH] testsuite/ubsan/overflow-div-3.c: Use SIGTRAP for MIPS

2024-06-21 Thread Maciej W. Rozycki
On Fri, 21 Jun 2024, YunQiang Su wrote: > > Then GCC emits the wrong trap instruction, wherever it comes from and > > whatever has caused it. The correct ones for integer division by zero > > Thanks so much. It is not the bug of Linux kernel or GCC. > It is a bug of me ;) and qemu. > > Qemu di

Re: [PATCH] testsuite/ubsan/overflow-div-3.c: Use SIGTRAP for MIPS

2024-06-20 Thread YunQiang Su
> > Then GCC emits the wrong trap instruction, wherever it comes from and > whatever has caused it. The correct ones for integer division by zero Thanks so much. It is not the bug of Linux kernel or GCC. It is a bug of me ;) and qemu. Qemu didn't pass the code of TEQ correctly; and I haven't ru

Re: [PATCH] testsuite/ubsan/overflow-div-3.c: Use SIGTRAP for MIPS

2024-06-20 Thread Maciej W. Rozycki
On Thu, 20 Jun 2024, Richard Biener wrote: > > > The DIV instructions of MIPS won't be trapped themself if the divisor > > > is zero. The compiler will emit a conditional trap instruct for it. > > > So the signal will be SIGTRAP instead of SIGFPE. > > > > It's an OS kernel bug if you get SIGTRAP

Re: [PATCH] testsuite/ubsan/overflow-div-3.c: Use SIGTRAP for MIPS

2024-06-20 Thread Richard Biener
On Thu, Jun 20, 2024 at 12:57 PM Maciej W. Rozycki wrote: > > On Thu, 20 Jun 2024, YunQiang Su wrote: > > > The DIV instructions of MIPS won't be trapped themself if the divisor > > is zero. The compiler will emit a conditional trap instruct for it. > > So the signal will be SIGTRAP instead of SI

Re: [PATCH] testsuite/ubsan/overflow-div-3.c: Use SIGTRAP for MIPS

2024-06-20 Thread Maciej W. Rozycki
On Thu, 20 Jun 2024, YunQiang Su wrote: > The DIV instructions of MIPS won't be trapped themself if the divisor > is zero. The compiler will emit a conditional trap instruct for it. > So the signal will be SIGTRAP instead of SIGFPE. It's an OS kernel bug if you get SIGTRAP for integer division

[PATCH] testsuite/ubsan/overflow-div-3.c: Use SIGTRAP for MIPS

2024-06-20 Thread YunQiang Su
The DIV instructions of MIPS won't be trapped themself if the divisor is zero. The compiler will emit a conditional trap instruct for it. So the signal will be SIGTRAP instead of SIGFPE. gcc/testsuite * c-c++-common/ubsan/overflow-div-3.c: Use SIGTRAP for MIPS. --- gcc/testsuite/c-c++-co