public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/10170: Is this a bug of GCC? or it's a C syntax
@ 2003-03-20 21:26 Kinh Nguyen
0 siblings, 0 replies; 3+ messages in thread
From: Kinh Nguyen @ 2003-03-20 21:26 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c/10170; it has been noted by GNATS.
From: Kinh Nguyen <xkinh@yahoo.com>
To: bangerth@dealii.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc:
Subject: Re: c/10170: Is this a bug of GCC? or it's a C syntax
Date: Thu, 20 Mar 2003 13:21:37 -0800 (PST)
I totally agree with you about the C syntax and the
way GCC handles it. I just hope the GCC would detect
and give a warning so life would be easier for C
programmers. I made a mistake in typing when I
modified a big program. It gave me a lot of head-ache
to figure out the problem.
Thanks
Kinh
--- bangerth@dealii.org wrote:
> Synopsis: Is this a bug of GCC? or it's a C syntax
>
> State-Changed-From-To: open->closed
> State-Changed-By: bangerth
> State-Changed-When: Thu Mar 20 18:44:53 2003
> State-Changed-Why:
> Your code is perfectly legal: you take the
> address of a
> function and in the if-statement, it is
> implicitly compared
> against zero. Since the function's address is
> non-zero,
> the printf-branch is executed.
>
> Other compilers will certainly not give you
> errors on this
> code, since it is legal. They may give you
> warnings, as
> icc does here, for example:
> g/x> icc x.c
> x.c(4): warning #279: controlling expression is
> constant
> if (alwayzero)
> ^
>
> W.
>
>
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10170
__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: c/10170: Is this a bug of GCC? or it's a C syntax
@ 2003-03-20 18:44 bangerth
0 siblings, 0 replies; 3+ messages in thread
From: bangerth @ 2003-03-20 18:44 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, nobody, xkinh
Synopsis: Is this a bug of GCC? or it's a C syntax
State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Thu Mar 20 18:44:53 2003
State-Changed-Why:
Your code is perfectly legal: you take the address of a
function and in the if-statement, it is implicitly compared
against zero. Since the function's address is non-zero,
the printf-branch is executed.
Other compilers will certainly not give you errors on this
code, since it is legal. They may give you warnings, as
icc does here, for example:
g/x> icc x.c
x.c(4): warning #279: controlling expression is constant
if (alwayzero)
^
W.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10170
^ permalink raw reply [flat|nested] 3+ messages in thread
* c/10170: Is this a bug of GCC? or it's a C syntax
@ 2003-03-20 18:26 xkinh
0 siblings, 0 replies; 3+ messages in thread
From: xkinh @ 2003-03-20 18:26 UTC (permalink / raw)
To: gcc-gnats
>Number: 10170
>Category: c
>Synopsis: Is this a bug of GCC? or it's a C syntax
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Mar 20 18:26:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Kinh Nguyen
>Release: 3.2.2 and earlier
>Organization:
>Environment:
Linux, Sun
>Description:
compile the following program and run it. Is it a GCC bug or
it's a c syntax? (I'm not sure but other compilers give
an error message).
#include <stdio.h>
int alwayzero();
main(){
if (alwayzero)
printf("Is this a GCC bug or it's the C syntax\n");
}
int alwayzero() {return 0;}
>How-To-Repeat:
Try to compile and run the program. Other compile will give error messages
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-03-20 21:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-20 21:26 c/10170: Is this a bug of GCC? or it's a C syntax Kinh Nguyen
-- strict thread matches above, loose matches on Subject: below --
2003-03-20 18:44 bangerth
2003-03-20 18:26 xkinh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).