piclist 2008\07\22\181738a >
Thread: What to do about compiler bug and source code?
www.piclist.com/techref/index.htm?key=what+about+compiler
picon face BY : Tomás Ó hÉilidheemail (remove spam text)





William Couture wrote:
{Quote hidden}

I had a program before that worked perfectly on several different
platforms (Windows, Mac, Linux) with several different compilers until I
compiled it with the highest optimiser turned on for a particular
compiler ( -O3 with gcc ). Since the code worked perfectly on so many
different systems up until that point, my initial reaction was that
there must be a bug in the compiler. Anyway, the offending code turned
out to be:

   void StrToLower(char *p)
   {
       while (   *p++ = tolower( (char unsigned)*p )   );
   }

The problem here is that the behaviour is "unspecified" when it comes to
whether "*p++" or "*p" is evaluated first. For some reason, when I upped
the optimisation, "*p" became the expression that was evaluated first.

I'm not saying there's definitely not a bug in the compiler, but I'd
definitely scrutanise the code for sequence point violations and also
for unspecified behaviour. If you forced me to bet my house on what was
the problem, I'd reluctantly have to go with the code.


> I'm going to contact IAR shortly, but since I can't reproduce it in a
> sample fragment, I'm
> sure that IAR will want the entire source.  But, since it has our
> propritary code, work
> does not want the source to be sent out.
>
> How would you handle this situation?


I'd be interested in glancing over the code if you wouldn't mind sending
me a snippet. I'd pay particular attention to lines of code that mention
the same variable name more than once.

<48865C5A.9050501@lavabit.com> 7bit

In reply to: <8ffe5b0c0807221045y2108b155r792421dd1261abe0@mail.gmail.com>
See also: www.piclist.com/techref/index.htm?key=what+about+compiler
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) What to do about compiler bug and source code?

month overview.

new search...