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: system ASSERT problem


On Wed, Mar 21, 2007 at 11:32:02AM +0100, Tomasz Kuty??a wrote:
> 
> >>I got strange problem with my application. When I compile system with 
> >>global compiler flags
> >>
> >>-ml -m4 -O2 -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef 
> >>-Woverloaded-virtual -ggdb -ffunction-sections -fdata-sections -fno-rtti 
> >>-fno-exceptions -fvtable-gc -finit-priority -save-temps
> >>
> >>I got info on terminal:
> >>
> >>ASSERT FAIL: <3>mcard.c[193]int mcard_write_bmask() Valid card handler 
> >>required
> >>ASSERT FAIL: mcard.c             [ 193] int 
> >>mcard_write_bmask()                                                       
> >>Valid card handler required
> >>
> >>But when I remove '-O2' flag the problems doesn't occur. What can be the 
> >>problem???
> >>    
> >
> >There is no mcard.c in the repository, so i guess it is something you
> >have added. Without the code it is hard to guess what is happening.
> Below is the code that generates the ASSERT:
> 
> int mcard_write_bmask(mcard_t *card)
> {
>   CYG_CHECK_DATA_PTR(card, "valid card pointer required");
>   CYG_CHECK_DATA_PTR(card->bmask, "valid mask pointer required");
>   CYG_ASSERT(card->mcard_hdl,"Valid card handler required");
> 
>   if( !card->mcard_hdl ) return -EINVAL;
>   if( !card->bmask ) return -EINVAL;

Well the asserts are wrong anyway. The code correctly handle the cases
which the asserts are testing for, so the asserts are not needed. 

As to why this happens now, are you really sure the asserts were
enabled in your old configuration without -O2? Is it really
reproducible? 

If it is reproducible the way forward is to see the assembly language
the compiler produces for both the working and none working case.

    Andrew

-- 
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]