Re: [PATCH 1/3] gcc: Add missing parentheses around ternary operator

Robert Elz <[email protected]>
Newsgroups gmane.os.netbsd.devel.toolchain
Message-ID <[email protected]>
    Date:        Sun, 29 Aug 2021 09:05:51 -0000 (UTC)
    From:        [email protected] (Christos Zoulas)
    Message-ID:  <[email protected]>

  | In article <[email protected]>,
  | Martin Husemann  <[email protected]> wrote:
  | >On Sun, Aug 29, 2021 at 05:53:09PM +1000, Damien Zammit wrote:
  | >Heh, ok. I think it was carried over from here:
  | >
  | >	http://mail-index.netbsd.org/source-changes/2004/11/30/0000.html
  |
  | Heh, so it was Jim Wise and not Thor... And I was involved too. I guess
  | my memory is not as good as it used to be :-)

There, when it was done in gcc3, it was correct (no ?: operator used).

The bug seems to have been introduced when this mod was pulled up to gcc4
(and then retained ever since) - the "| ?:" method was used to replace the
block of code that was used originally (and which can be seen by starting
at the URL above and locating this:
	cvs rdiff -r1.1.1.1 -r1.2 src/gnu/dist/gcc/gcc/cppfiles.c
for the actual code inserted).

However, this looks to have been a particularly benign bug, the only
effects seem to have been to always open in O_NONBLOCK mode (that's
harmless), to never set O_NOCTTY (not sure when cpp would ever be used
on a tty for that to matter), and not to clear O_NONBLOCK when not
in "restricted" mode ... that is, I think, when using cpp as part of
compiling C code (etc) - where the file opened should be a "normal" file
(in any rational usage anyway, I guess someone could "ln -s /dev/... foo.c"
but such a person deserves to get bizarre behaviour) and that O_NONBLOCK
remains set is irrelevant.

Still it is nice to see that kind of thing get corrected - finally
(15 years, and a bit, after the bug was introduced: 2006-05-12).

kre
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.