Re: Suspicion of a compiler bug in clang: using ternary operator in ereport()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Christian Kruse <christian(at)2ndQuadrant(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Suspicion of a compiler bug in clang: using ternary operator in ereport()
Date: 2014-01-28 21:19:11
Message-ID: 4904.1390943951@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Christian Kruse <christian(at)2ndQuadrant(dot)com> writes:
> According to http://llvm.org/bugs/show_bug.cgi?id=18644#c5 this is not
> a compiler bug but a difference between gcc and clang. Clang seems to
> use a left-to-right order of evaluation while gcc uses a right-to-left
> order of evaluation. So if errmsg changes errno this would lead to
> errno == ENOMEM evaluated to false.

Oh! Yeah, that is our own bug then.

> Should we work on this issue?

Absolutely. Probably best to save errno into a local just before the
ereport.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jason Petersen 2014-01-28 21:20:38 Re: Suspicion of a compiler bug in clang: using ternary operator in ereport()
Previous Message Christian Kruse 2014-01-28 21:12:01 Re: Suspicion of a compiler bug in clang: using ternary operator in ereport()