Re: Division by zero on A53 which does not raise an exception

2022-11-29 Thread Szabolcs Nagy via Gcc
The 11/28/2022 21:37, Stephen Smith via Binutils wrote: > I am working on a project which is using an A53 core. The core does not > raise an exception if there is a division by zero (for either integer or > floating point division). floating-point division by zero signals the FE_DIVBYZERO exce

Re: Division by zero on A53 which does not raise an exception

2022-11-29 Thread Richard Biener via Gcc
On Tue, Nov 29, 2022 at 5:39 AM Stephen Smith via Gcc wrote: > > I am working on a project which is using an A53 core. The core does not > raise an exception if there is a division by zero (for either integer or > floating point division). > > The designers chose to set status bits for the float

Re: Division by zero

2007-02-12 Thread Bernd Jendrissek
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Sat, Feb 10, 2007 at 03:09:41PM +0200, Robert Dewar wrote: > Ian Lance Taylor wrote: > > "Jie Zhang" <[EMAIL PROTECTED]> writes: > >> But now gcc seems to optimize it away. For the following function: > >> > >> $ cat t.c > >> #include > >> void foo

Re: Division by zero

2007-02-10 Thread Jie Zhang
On 2/11/07, Paolo Bonzini <[EMAIL PROTECTED]> wrote: > I'm going to use an asm (). Yeah, an asm volatile ("" : : "r" (x) : ) should please GCC and still be portable to different platforms. I thought using an asm () for each port to cause an exception specific for that port. Such that divide-b

Re: Division by zero

2007-02-10 Thread Paolo Bonzini
I'm going to use an asm (). Yeah, an asm volatile ("" : : "r" (x) : ) should please GCC and still be portable to different platforms. Paolo

Re: Division by zero

2007-02-10 Thread Jie Zhang
On 2/10/07, Steven Bosscher <[EMAIL PROTECTED]> wrote: On 2/10/07, Jie Zhang <[EMAIL PROTECTED]> wrote: > The code I posted in my first email is from libgloss/libnosys/_exit.c. > It's used to cause an exception deliberately. From your replies, it > seems it should find another way to do that. Ma

Re: Division by zero

2007-02-10 Thread Jie Zhang
On 2/10/07, Robert Dewar <[EMAIL PROTECTED]> wrote: Jie Zhang wrote: > The code I posted in my first email is from libgloss/libnosys/_exit.c. > It's used to cause an exception deliberately. From your replies, it > seems it should find another way to do that. Any code that tries to raise an exce

Re: Division by zero

2007-02-10 Thread Robert Dewar
Jie Zhang wrote: The code I posted in my first email is from libgloss/libnosys/_exit.c. It's used to cause an exception deliberately. From your replies, it seems it should find another way to do that. Any code that tries to raise an exception deliberately is certainly depending on undefined be

Re: Division by zero

2007-02-10 Thread Steven Bosscher
On 2/10/07, Jie Zhang <[EMAIL PROTECTED]> wrote: The code I posted in my first email is from libgloss/libnosys/_exit.c. It's used to cause an exception deliberately. From your replies, it seems it should find another way to do that. Maybe you can use __builtin_trap() ? Gr. Steven

Re: Division by zero

2007-02-10 Thread Jie Zhang
On 2/10/07, Robert Dewar <[EMAIL PROTECTED]> wrote: Ian Lance Taylor wrote: > "Jie Zhang" <[EMAIL PROTECTED]> writes: > >> But now gcc seems to optimize it away. For the following function: >> >> $ cat t.c >> #include >> void foo (int rc) >> { >> int x = rc / INT_MAX; >> x = 4 / x; >> } > >

Re: Division by zero

2007-02-10 Thread Robert Dewar
Ian Lance Taylor wrote: "Jie Zhang" <[EMAIL PROTECTED]> writes: But now gcc seems to optimize it away. For the following function: $ cat t.c #include void foo (int rc) { int x = rc / INT_MAX; x = 4 / x; } I believe we still keep division by zero in general. In your example it gets opti

Re: Division by zero

2007-02-09 Thread Ian Lance Taylor
"Jie Zhang" <[EMAIL PROTECTED]> writes: > But now gcc seems to optimize it away. For the following function: > > $ cat t.c > #include > void foo (int rc) > { > int x = rc / INT_MAX; > x = 4 / x; > } I believe we still keep division by zero in general. In your example it gets optimized away