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

            Bug ID: 111813
           Summary: Inconsistent limit in Ada.Calendar.Formatting
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: simon at pushface dot org
                CC: dkm at gcc dot gnu.org
  Target Milestone: ---

Created attachment 56107
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56107&action=edit
Demonstrator

The Value function's description (ARM 9.6.1(87)[1] doesn't place any limitation 
on the Elapsed_Time parameter's value, beyond "Constraint_Error is raised if
the
string is not formatted as described for Image, or the function cannot
interpret 
the given string as a Duration value".

It would seem reasonable that Value and Image should be consistent, in that any 
string produced by Image should be accepted by Value. Since Image must produce
a 
two-digit representation of the Hours, there's an implication that its 
Elapsed_Time parameter should be less than 100 hours (the ARM merely says that 
in that case the result is implementation-defined).

The current implementation of Value raises Constraint_Error if the Elapsed_Time 
parameter is greater than or equal to 24 hours.

The attached demonstrator (calendar_format_value.adb) shows Image accepting an 
Elapsed_Time of 24h00m00s, converting it to "24:00:00"; given this string,
Value 
raises Constraint_Error.

This issue is present in GCC 10, 11, 12 and 13, but probably not worth 
backfitting.

[1] http://www.ada-auth.org/standards/rm12_w_tc1/html/RM-9-6-1.html#p87

Reply via email to