tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

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



    Date:        Sun, 29 Aug 2021 09:05:51 -0000 (UTC)
    From:        christos%astron.com@localhost (Christos Zoulas)
    Message-ID:  <sgfilf$bgk$1%ciao.gmane.io@localhost>

  | In article <20210829083343.GB15015%mail.duskware.de@localhost>,
  | Martin Husemann  <martin%duskware.de@localhost> 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



Home | Main Index | Thread Index | Old Index