public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
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	[thread overview]
Message-ID: <20010604211351.31907.qmail@sourceware.cygnus.com> (raw)

>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:


             reply	other threads:[~2001-06-04 14:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-04 14:16 behanna [this message]
2001-06-04 15:36 Neil Booth
2001-06-04 16:06 preprocessor/3049: Conditional compilation using "#if A==B"broken " Chris BeHanna

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010604211351.31907.qmail@sourceware.cygnus.com \
    --to=behanna@zbzoom.net \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).