A NOTE has been added to this issue. 
====================================================================== 
http://austingroupbugs.net/view.php?id=1108 
====================================================================== 
Reported By:                nsz
Assigned To:                
====================================================================== 
Project:                    1003.1(2016)/Issue7+TC2
Issue ID:                   1108
Category:                   Base Definitions and Headers
Type:                       Error
Severity:                   Editorial
Priority:                   normal
Status:                     Resolved
Name:                       Szabolcs Nagy 
Organization:               musl libc 
User Reference:              
Section:                    limits.h 
Page Number:                 
Line Number:                 
Interp Status:              --- 
Final Accepted Text:        http://austingroupbugs.net/view.php?id=1108#c4041 
Resolution:                 Reopened
Fixed in Version:           
====================================================================== 
Date Submitted:             2016-12-09 17:00 UTC
Last Modified:              2018-08-30 15:27 UTC
====================================================================== 
Summary:                    LONG_MIN must be <= -2147483648
======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
parent of           0001197 Omission from 1108: LONG_MIN must be &l...
====================================================================== 

---------------------------------------------------------------------- 
 (0004094) eblake (manager) - 2018-08-30 15:27
 http://austingroupbugs.net/view.php?id=1108#c4094 
---------------------------------------------------------------------- 
On P280 L9437 replace<blockquote><CX>Maximum Acceptable Value: −2 147 483
647</CX></blockquote>with<blockquote><CX>Maximum Acceptable Value: −2 147
483 648</CX></blockquote>
At Line 9443 replace<blockquote>Maximum Acceptable Value: −9 223 372 036
854 775 807</blockquote>with<blockquote><CX>Maximum Acceptable Value: −9
223 372 036 854 775 808</CX></blockquote>
At L9452 replace<blockquote>Maximum Acceptable Value: −2 147 483
647</blockquote>with<blockquote><CX>Maximum Acceptable Value: −2 147 483
648</CX></blockquote>
At L9467 replace<blockquote>Maximum Acceptable Value: −32
767</blockquote>with<blockquote><CX>Maximum Acceptable Value: −32
768</CX></blockquote>
After P282 L9539 (<limits.h>) add a new paragraph:<blockquote>The maximum
values for SCHAR_MIN, SHRT_MIN, LONG_MIN and LLONG_MIN differ from the C
Standard because POSIX.1 requires two's complement representation for the
corresponding integer types. The maximum value for INT_MIN differs both for
that reason and because POSIX.1 requires that <b>int</b> has a width of at
least 32 bits. See also the RATIONALE section for <stdint.h>.</blockquote>
On P282 L9543 (<limits.h>) add <stdint.h> to the SEE ALSO section.

On P348 L11817 (<stdint.h>) change:<blockquote>An N-bit signed type has
values in the range -2<sup>N-1</sup> or 1-2<sup>N-1</sup> to
2<sup>N-1</sup>-1, while an N-bit unsigned type has values in the range 0
to 2<sup>N</sup>-1</blockquote>with<blockquote>An N-bit signed type in
two's complement representation has values in the range -2<sup>N-1</sup> to
2<sup>N-1</sup>-1, while an N-bit unsigned type has values in the range 0
to 2<sup>N</sup>-1.
<CX>While the C standard also permits signed integers in sign-magnitude or
one's complement form, this standard requires an implementation to use
two's complement representation for the standard integer types.</CX>
</blockquote>
After P349 L11866 add a new paragraph with CX shading:<blockquote>If the
representation of any of the standard types <b>short</b>, <b>int</b>,
<b>long</b> or <b>long long</b> is not the same as one of the above
required types, an <b>int</b><i>N</i><b>_t</b> type with that
representation shall be defined along with its <b>uint</b><i>N</i><b>_t</b>
counterpart.</blockquote>
On P351-352 L11944-11965 (<stdint.h>) change all occurrences
of:<blockquote>-1)</blockquote>to:<blockquote>)</blockquote>and add CX
shading to the affected text in parentheses.

On P352 L11979 (<stdint.h>), change:<blockquote>-65
535</blockquote>to:<blockquote><CX>-65 536</CX></blockquote>
On P354 L12040 (<stdint.h>), replace
<blockquote>(The POSIX standard explicitly requires 8-bit char and
two's-complement arithmetic.)</blockquote>with<blockquote>Since the POSIX.1
standard explicitly requires 8-bit char with two's complement arithmetic,
it is easier for application writers if the same two's complement
guarantees are extended to all of the other standard integer types. 
Furthermore, in programming environments with a 32-bit <b>long</b>, some
POSIX.1 interfaces, such as <i>mrand48</i>(), cannot be implemented if
<b>long</b> does not use a two's complement representation.</blockquote>
On P567 L19838 (abs), replace<blockquote>In two's-complement
representation, the absolute value of the negative integer with largest
magnitude {INT_MIN} might not be
representable.</blockquote>with<blockquote>Since POSIX.1 requires a two's
complement representation of <b>int</b>, the absolute value of the negative
integer with the largest magnitude {INT_MIN} is not representable, thus
abs(INT_MIN) is undefined.</blockquote>
On P1135 L38361 (imaxabs), replace<blockquote>The absolute value of the
most negative number cannot be represented in two's
complement.</blockquote>with<blockquote>Since POSIX.1 requires a two's
complement representation of <b>intmax_t</b>, the absolute value of the
negative integer with the largest magnitude {INTMAX_MIN} is not
representable, thus imaxabs(INTMAX_MIN) is undefined.</blockquote>
On P1232 L41195 (labs APPLICATION USAGE),
replace<blockquote>None.</blockquote>with<blockquote>Since POSIX.1 requires
a two's complement representation of <b>long</b> and <b>long long</b>, the
absolute value of the negative integers with the largest magnitude
{LONG_MIN} and {LLONG_MIN} are not representable, thus labs(LONG_MIN) and
llabs(LLONG_MIN) are undefined.</blockquote>
On P3115 L104217 (printf),
replace<blockquote>twos-complement</blockquote>with<blockquote>two's
complement</blockquote> 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2016-12-09 17:00 nsz            New Issue                                    
2016-12-09 17:00 nsz            Name                      => Szabolcs Nagy   
2016-12-09 17:00 nsz            Organization              => musl libc       
2016-12-09 17:00 nsz            Section                   => limits.h        
2016-12-09 18:40 EdSchouten     Note Added: 0003512                          
2016-12-09 22:25 nsz            Note Added: 0003513                          
2018-06-07 16:10 geoffclare     Note Added: 0004041                          
2018-06-07 16:11 geoffclare     Interp Status             => ---             
2018-06-07 16:11 geoffclare     Final Accepted Text       =>
http://austingroupbugs.net/view.php?id=1108#c4041    
2018-06-07 16:11 geoffclare     Status                   New => Resolved     
2018-06-07 16:11 geoffclare     Resolution               Open => Accepted As
Marked
2018-06-07 16:11 geoffclare     Tag Attached: issue8                         
2018-07-11 21:10 cmsmith        Note Added: 0004050                          
2018-07-12 08:13 geoffclare     Note Added: 0004051                          
2018-07-12 11:43 shware_systems Note Added: 0004052                          
2018-07-30 19:02 eblake         Note Added: 0004064                          
2018-07-30 20:29 eblake         Relationship added       parent of 0001197   
2018-08-23 16:32 eblake         Resolution               Accepted As Marked =>
Reopened
2018-08-24 08:29 geoffclare     Note Added: 0004089                          
2018-08-24 08:30 geoffclare     Note Edited: 0004089                         
2018-08-24 12:54 kre            Note Added: 0004090                          
2018-08-30 15:27 eblake         Note Added: 0004094                          
======================================================================


Reply via email to