[cfp-interest 3406] Re: Action item from 2025/02 WG14 meeting

Jim Thomas jaswthomas at sbcglobal.net
Wed Mar 5 09:12:58 PST 2025


Please ignore my previous message.

Clause 4 #2 says "If a "shall" or "shall not" requirement that appears outside of a constraint or runtime-constraint is violated, the behavior is undefined.” So violating the “shall” in the second sentence in 6.6.1 #5 (which is not a constraint) is UB.

Maybe the action item should be to determine if N3447 change 3.2 addition (50’) is worded correctly.

6.6.1 #5 says: 

An expression that evaluates to a constant is required in several contexts. If a floating expression is evaluated in the translation environment, the arithmetic range and precision shall be at least as great as if the expression were being evaluated in the execution environment.


N3447 change 3.2 includes

Add one new entry

(50′) The value of a floating expression as determined in the translation environment in the context of the evaluation of a constant expression is outside the arithmetic range or has less precision than if it were evaluated in the execution environment (6.6).

At best the wording is wrong. The value is “outside the arithmetic range” of what? 

Referring to the precision of a value (vs a representation or an evaluation) can be confusing. 

I don’t think it works to state the UB in terms of the value. For example, the value of x*y - x*y might not be 0 is if evaluated at translation time using fma, which 6.6.1 #5 allows.

How about

(50’) A floating expression is evaluated in the translation environment with less arithmetic range or precision than if the expression were being evaluated in the execution environment.

- Jim Thomas
 
> On Mar 4, 2025, at 4:11 PM, Jim Thomas <jaswthomas at sbcglobal.net> wrote:
> 
> My understanding: 6.6 #5 disallows translation-time evaluation using less range or precision that would be used to evaluate the expression at execution time. Such translation-time evaluation is prohibited, not UB.
> 
> - Jim Thomas
> 
>> On Mar 4, 2025, at 11:01 AM, RAJAN BHAKTA <rbhakta at us.ibm.com> wrote:
>> 
>> One action item for our group came of the WG14 meeting as well:
>>  
>> Look a N3447 change 3.2 addition (50') to see if it is valid to have as UB.
>>  
>> Regards,
>> 
>> Rajan Bhakta
>> 
>>  
>> _______________________________________________
>> cfp-interest mailing list
>> cfp-interest at oakapple.net <mailto:cfp-interest at oakapple.net>
>> http://mailman.oakapple.net/mailman/listinfo/cfp-interest
> 
> _______________________________________________
> cfp-interest mailing list
> cfp-interest at oakapple.net
> http://mailman.oakapple.net/mailman/listinfo/cfp-interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20250305/83c39191/attachment.htm>


More information about the cfp-interest mailing list