tech-toolchain archive

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

Re: netbsd-11 gcc bug



    Date:        Sat, 23 May 2026 20:47:16 +0200
    From:        Manuel Bouyer <bouyer%antioche.eu.org@localhost>
    Message-ID:  <ahH2NFJ58JQpjOBi%antioche.eu.org@localhost>

  | We're just taking computing the address here, we're not telling anything
  | about its validity.

I believe the argument is that you're computing an address based upon
a NULL pointer, which has unspecified representation, hence the result
is undefined (we know NULL is 0, but C doesn't).   One of the many
stupidities inflicted upon the C language by the compiler people who
want to be able to use every trick they can to be able to generate
faster code.

  | I guess there's still variants of offsetof() around which uses this.

Perhaps.

  | So what are you suggesting ? changing line 1214 to
  | if ((fdp != &fr->fr_dif || fr == NULL) && (fin->fin_out == 0)) {

It would need to be

	if ((fr == NULL || fdp != &fr->fr_dif) && fin->fin_out == 0) {

(removing the parens around the == test is just style).   The way you
wrote it the compiler would just omit the fr == NULL test, as by doing
the addr comparison first you've already promised that fr != NULL).

kre




Home | Main Index | Thread Index | Old Index