public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/16192] New: Bug in expression evaluation when operand is missing
@ 2004-06-25  6:04 gnu at behdad dot org
  2004-06-25  6:32 ` [Bug preprocessor/16192] " pinskia at gcc dot gnu dot org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: gnu at behdad dot org @ 2004-06-25  6:04 UTC (permalink / raw)
  To: gcc-bugs

Seems like there's a bug in evaluating expressions in #if statements where one
of the operands is missing.  Seems like a value from the top of the stack is
used instead...

Here is the minimal code that goes wrong:

#if (1 < 2) && ( == 2)
JUNK JUNK JUNK
#endif

and it outputs "JUNK JUNK JUNK" while should not.  If you change one of the "2"s
to something else, it doesn't happen; that's why I guess it's just taking the
missing operand from the top of the stack...

Needless to say, something like this fails for the same reason (which was were I
found the bug):

#if (x < 2) && (y == 2)
do something
#endif

-- 
           Summary: Bug in expression evaluation when operand is missing
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gnu at behdad dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-redhat-linux
  GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16192


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2004-09-13 17:43 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-25  6:04 [Bug preprocessor/16192] New: Bug in expression evaluation when operand is missing gnu at behdad dot org
2004-06-25  6:32 ` [Bug preprocessor/16192] " pinskia at gcc dot gnu dot org
2004-06-25  6:39 ` gnu at behdad dot org
2004-06-25 17:47 ` zack at gcc dot gnu dot org
2004-06-25 17:48 ` zack at gcc dot gnu dot org
2004-06-25 17:48 ` zack at gcc dot gnu dot org
2004-06-25 17:54 ` zack at gcc dot gnu dot org
2004-06-25 18:24 ` neil at gcc dot gnu dot org
2004-06-26 18:11 ` gnu at behdad dot org
2004-06-28 20:28 ` cvs-commit at gcc dot gnu dot org
2004-06-28 20:41 ` [Bug preprocessor/16192] [3.5 only] " pinskia at gcc dot gnu dot org
2004-07-04 12:57 ` cvs-commit at gcc dot gnu dot org
2004-07-04 12:58 ` neil at gcc dot gnu dot org
2004-09-13 17:43 ` [Bug preprocessor/16192] [4.0 Regression] " giovannibajo at libero dot it

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).