Hi,
Division by zero is undefined. We chose to keep it:
http://gcc.gnu.org/ml/gcc-patches/2001-06/msg01068.html
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;
}
$ gcc -O2 -S t.c
$ cat t.s
"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
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
oo (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 because it is dead code. Nothing uses x.
And it is certainly reasonable to do this optimization given
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
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
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
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
I'm going to use an asm ().
Yeah, an asm volatile ("" : : "r" (x) : ) should please GCC and still be
portable to different platforms.
Paolo
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
gt;
> >> $ 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 aw
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 floating point case but not
raise an exception.With the integer
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 s
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_
14 matches
Mail list logo