This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
preprocessor/3049: Conditional compilation using "#if A==B" broken on i386 Red Hat 7.0.
- To: gcc-gnats at gcc dot gnu dot org
- Subject: preprocessor/3049: Conditional compilation using "#if A==B" broken on i386 Red Hat 7.0.
- From: behanna at zbzoom dot net
- Date: 4 Jun 2001 21:13:51 -0000
- Reply-To: behanna at zbzoom dot net
>Number: 3049
>Category: preprocessor
>Synopsis: Conditional compilation using "#if A==B" broken on i386 Red Hat 7.0.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jun 04 14:16:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Chris BeHanna <behanna@zbzoom.net>
>Release: gcc version 2.96 20000731 (Red Hat Linux 7.0)
>Organization:
>Environment:
output of uname -a:
Linux sunflower 2.2.16-22smp #1 SMP Tue Aug 22 16:39:21 EDT 2000 i686 unknown
>Description:
Specifically, code that is conditionally compiled using
#if BYTE_ORDER == BIG_ENDIAN
// stuff
#endif
#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
// stuff
#endif
results in both sections of code getting processed on Red Hat 7.0 if _XOPEN_SOURCE is defined. The problem does not occur if _XOPEN_SOURCE is not defined. The attached program reproduces this problem.
>How-To-Repeat:
Compile the attached program with g++ 2.96 20000731 on Red Hat 7.0 PC with the following command:
g++ -D_XOPEN_SOURCE -o t t.cpp
Execute it. The output will be
big endian
little endian or PDP endian
(i.e., both sections of code are compiled instead of only the LITTLE_ENDIAN section).
As you might expect, this completely prevents any code that includes <arpa/nameser_compat.h> from being able to compile.
>Fix:
I honestly don't know. If I have time, I'll dig into the source and see if there's anything obvious, and submit a patch.
>Release-Note:
>Audit-Trail:
>Unformatted: