This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug preprocessor/16192] New: Bug in expression evaluation when operand is missing


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]