James Kuyper
7/17/2011 8:44:00 PM
On 07/17/2011 12:46 PM, tm wrote:
> On 17 Jul., 14:39, James Kuyper <jameskuy...@verizon.net> wrote:
>> On 07/17/2011 05:58 AM, tm wrote:
>>
>>> Hello,
>>
>>> I discovered a compiler bug in lcc-win32 under Windows XP.
>>
>> Why are you posting this here, instead of contacting the vendor
>> directly?
>
> Because jacob navia often discusses in this group.
Yes, and so do a few people who regularly post bug reports against lcc,
not too dissimilar from yours, for the sole apparent purpose of baiting
jacob into an intemperate response. A hallmark of those reports is that
the "bug" usually depends in some subtle fashion upon some
well-documented extension to C supported by lcc-win32. I don't know
lcc-win32's extensions well-enough to be sure that your code has not run
afoul of one of them.
>> While I did not examine your code closely, I did notice one minor issue:
>> ...
>>
>>> #include "stdio.h"
>>
>> That should be <stdio.h>; it can make a difference which one you use.
>
> For the purpose of showing this bug, this does not make
> any difference.
Until you know what caused the bug, you can't be sure. An incompatible
file named stdio.h in a location that is searched when you use "", but
is not searched when you use <>, could in principle be the reason why
printf() doesn't print the value you expected it to print. I consider
this extremely unlikely, which is why I labeled it a "minor issue", but
I still recommend correcting it.
>> You haven't chosen the correct options to put gcc
>> into a fully conforming mode - you need to use at least -ansi -pedantic.
>
> No, The expression
>
> op_char(name[0]) || char_class(name[0])==LEFTPARENCHAR
>
> where name[0] is '$' and op_char('$') is 1, should
> always return 1, independend of K&R, ANSI C89, ANSI C99
> and probably also for a future version. The expression
But in their default modes, like most other compilers, neither of those
compilers implements any of the languages you listed, so even if you're
right about those four languages, that doesn't guarantee that you're
right about the default lcc-win32 or gnu versions of C. Keep in mind,
also, that the problem could be in some entirely different part of the
code. It might not be the implementation of || that is producing
unexpected results, but a problem elsewhere in your code that manifests
itself in this location.
> 1 || anyting
>
> should always evaluate to 1, independend of C version
> or compiler. Otherwise it is not C.
That depends upon how you define "C"; jacob's definition is more
flexible than mine, but I doubt that lcc-win32 deliberately implements
|| in a way significantly incompatible with the requirements of the C
standard. However, it's quite possible that some other aspect of your
program is causing these symptoms.
--
James Kuyper