https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128618

--- Comment #5 from Hans-Peter Nilsson <hp at gcc dot gnu.org> ---
(In reply to Jerry DeLisle from comment #4)
> (In reply to Hans-Peter Nilsson from comment #3)
> > (In reply to Jerry DeLisle from comment #1)
> > > Created attachment 66134 [details]
> > > Draft patch to fix this
> > > 
> > > Hi Hans-Peter, can you test this to see if it fixes it. If so I can get it
> > > pushed today.
> > > 
> > > Thanks for the report. (I did get word of this from others.)
> > 
> > This one works too, thanks.  In the meantime, I committed mine, since it
> > came with a ChangeLog entry.
> > 
> > They both have their merits: mine mostly for simplicity, and that I believe
> > most common 32-bit systems running fortran do have 64-bit atomics, so mine
> > affecting more code than yours, is unlikely to matter in practice.  Having
> > said that, feel absolutely free to revert it and apply yours instead!
> 
> I OKed yours because it was simpler. So I tossed it over to the LLM to
> compare. The three pages of verbosity suggest your patch leaves an obscure
> opportunity for a race condition.

Yeah, but that race condition requires a multi-threading target where the
conditions will evaluate differently, as covered by my "unlikely to matter in
practice" sentence above.  More likely IMHO, a future libgfortran atomicity
patch will lean too hard on that macro again and miss that it needs extra
testing for 64-bit, despite there now being a reusable solution...unless
everybody gets in the habit of first feeding the patch to a friendly LLM, that
is.

> The patch I attached here avoids that but
> must not be layered on top of yours to do so.

Yes, exactly.

> So I think I will commit the one I attached with yours backed out. (leaning
> toward the robust). The commit logs are easy enough to do

:)

Glad to see it still fixed!

Reply via email to