Re: netbsd-11 gcc bug

Robert Elz <[email protected]> Sun, 24 May 2026 02:29:11 +0700
Newsgroups gmane.os.netbsd.devel.toolchain
Message-ID <[email protected]>
    Date:        Sat, 23 May 2026 20:47:16 +0200
    From:        Manuel Bouyer <[email protected]>
    Message-ID:  <[email protected]>

  | 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