On Sat, 27 Sep 2025, YunQiang Su wrote:
> > > > What problem are you trying to solve?
> > >
> > > See the talk in GCC mailing list about testsuite/ubsan/overflow-div-3.c
> > > Qemu emits SIGTRAP instead of SIGFPE, due to it didn't initialize the
> > > code of conditional trap to env.
> >
> > Self-contained information about the reproducer needs to be included in
> > the change description. A general statement such as "this and that does
> > not work" or referring to another mailing list is not sufficient.
>
> I am trying to fix the problem like this
> gcc/testsuite/gcc.c-torture/execute/20101011-1.c
>
> void
> sigfpe (int signum __attribute__ ((unused)))
> {
> exit (0);
> }
>
> int
> main ()
> {
> #if DO_TEST
> signal (SIGFPE, sigfpe);
> k = i / j;
> abort ();
I gather QEMU in the user emulation mode fails to interpret the embedded
break or trap code of a `teq $2,$0,7' or similar instruction produced by
the compiler as a part of the integer division machine code sequence for
the source code quoted above, and consequently issues the wrong signal to
the program emulated. Is that a correct statement of the problem?
If so, then it has to be stated in the change description. Then Richard
has correctly identified the fix to make.
Maciej