This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Dividing by zero does NOT generate exception


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]