[ECOS] Dividing by zero does NOT generate exception

Ilija Kocho ilijak@siva.com.mk
Sat Mar 5 13:52:00 GMT 2011


On 04.03.2011 23:14, Quanren Xiong wrote:
> Hi,
>
> I am using  ECOS 2.0.33.  To my suprise, the following code does NOT
> generate an exception.
>
> "int b=1; int c=b/0;" The value in variable c will be 0.
Maybe the optimizer removes the code. Of course the question is why
compiler does bot complain for div by 0?
Is variable c referenced somewhere by the code?
Hint: Try to declare c  (and b) volatile.

Hope this helps.

// Ilija


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list