From mboxrd@z Thu Jan 1 00:00:00 1970 From: behanna@zbzoom.net To: gcc-gnats@gcc.gnu.org Subject: preprocessor/3049: Conditional compilation using "#if A==B" broken on i386 Red Hat 7.0. Date: Mon, 04 Jun 2001 14:16:00 -0000 Message-id: <20010604211351.31907.qmail@sourceware.cygnus.com> X-SW-Source: 2001-06/msg00097.html List-Id: >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 >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 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: