public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/111813] New: Inconsistent limit in Ada.Calendar.Formatting
@ 2023-10-14 19:01 simon at pushface dot org
  2023-11-09 14:01 ` [Bug ada/111813] " cvs-commit at gcc dot gnu.org
  2024-01-09 10:53 ` ebotcazou at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: simon at pushface dot org @ 2023-10-14 19:01 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug ada/111813] Inconsistent limit in Ada.Calendar.Formatting
  2023-10-14 19:01 [Bug ada/111813] New: Inconsistent limit in Ada.Calendar.Formatting simon at pushface dot org
@ 2023-11-09 14:01 ` cvs-commit at gcc dot gnu.org
  2024-01-09 10:53 ` ebotcazou at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-09 14:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Marc Poulhi?s <dkm@gcc.gnu.org>:

https://gcc.gnu.org/g:a80daa2e52ab8fd8a83eec1379b4a5d4187a1162

commit r14-5282-ga80daa2e52ab8fd8a83eec1379b4a5d4187a1162
Author: Simon Wright <simon@pushface.org>
Date:   Mon Oct 16 14:32:43 2023 +0100

    Fix PR ada/111813 (Inconsistent limit in Ada.Calendar.Formatting)

    The description of the second Value function (returning Duration) (ARM
9.6.1(87)
    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.0 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.

    This patch removes the restriction, so that the Elapsed_Time parameter must
only
    be less than 100.0 hours.

    2023-10-15 Simon Wright <simon@pushface.org>

            PR ada/111813
    gcc/ada/
            * libgnat/a-calfor.adb (Value (2)): Allow values of
            parameter Elapsed_Time greater than or equal to 24 hours, by doing
            the hour calculations in Natural rather than Hour_Number (0 ..
            23). Calculate the result directly rather than by using Seconds_Of
            (whose Hour parameter is of type Hour_Number).
            If an exception occurs of type Constraint_Error, re-raise it
            rather than raising a new CE.

    gcc/testsuite/
            * gnat.dg/calendar_format_value.adb: New test.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug ada/111813] Inconsistent limit in Ada.Calendar.Formatting
  2023-10-14 19:01 [Bug ada/111813] New: Inconsistent limit in Ada.Calendar.Formatting simon at pushface dot org
  2023-11-09 14:01 ` [Bug ada/111813] " cvs-commit at gcc dot gnu.org
@ 2024-01-09 10:53 ` ebotcazou at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2024-01-09 10:53 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |ebotcazou at gcc dot gnu.org
   Target Milestone|---                         |14.0

--- Comment #2 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Fixed on the mainline.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-09 10:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-14 19:01 [Bug ada/111813] New: Inconsistent limit in Ada.Calendar.Formatting simon at pushface dot org
2023-11-09 14:01 ` [Bug ada/111813] " cvs-commit at gcc dot gnu.org
2024-01-09 10:53 ` ebotcazou at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).