Re: patch: garbage error strings in libpq - Mailing list pgsql-patches

From Neil Conway
Subject Re: patch: garbage error strings in libpq
Date
Msg-id 42CBD070.9060101@samurai.com
Whole thread Raw
In response to Re: patch: garbage error strings in libpq  (jtv@xs4all.nl)
Responses Re: patch: garbage error strings in libpq  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
jtv@xs4all.nl wrote:
> That is pretty much what I remember hearing at the time.

> A well-known way to trigger undefined behaviour is "x++=x++;" because
> there is no sequence point between the two side effects.  Try it: gcc will
> give you a stern warning.  Given that there is no sequence point between
> argument expressions, as per the paragraph you quote, the same must go for
> "c(x++,x++)".  So then it becomes dubious that there is suddenly a
> guarantee for "c(a(),b())"!

Right; my interpretation is that the "sequence point before function
call" rule applies recursively. So in c(a(...), b(...)), there are in
fact three sequence points, which precede the calls of a, b, and c.
Shouldn't that be sufficient to ensure that the evaluation of
libpq_gettext() is not interleaved with the evaluation of the other
arguments to the printf()?

-Neil

pgsql-patches by date:

Previous
From: jtv@xs4all.nl
Date:
Subject: Re: patch: garbage error strings in libpq
Next
From: Tom Lane
Date:
Subject: Re: Error handling fix in interfaces/libpq/fe-secure.c