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

            Bug ID: 119701
           Summary: Ada.Calendar.Formatting.Day_Of_Week returns wrong
                    value after Ada.Calendar.Time is incremented via
                    Ada.Calendar.Arithmetic."+".
           Product: gcc
           Version: 14.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wrg at acm dot org
                CC: dkm at gcc dot gnu.org
  Target Milestone: ---

System information:
   OS version: macOS 12.7 (Monterey)
   Mac model:  Mac Pro, MacPro3,1
   CPU:        Intel Xeon E5462 @ 2.80GHz
   RAM:        32GB
   GPU:        AMD Radeon RX 580 8 GB

Ada program exhibiting problem:
   with Ada.Calendar;                 -- (RM 9.6)
   with Ada.Calendar.Arithmetic;      -- (RM 9.6.1)
   with Ada.Calendar.Formatting;      -- (RM 9.6.1)
   with Ada.Text_IO; use Ada.Text_IO; -- (RM A.10.1)
   procedure Show_Error is
      package AC  renames Ada.Calendar;
      package ACA renames Ada.Calendar.Arithmetic;
      package ACF renames Ada.Calendar.Formatting;
      T1 : constant AC.Time :=
              AC.Time_Of (Year => 2025, Month => 11, Day => 2);
      T2 : constant AC.Time :=
              ACA."+" (Left => T1, Right => 1);
   begin
      Put_Line ("T1 = " & ACF.Image (T1) &
                ", Ada.Calendar.Formatting.Day_Of_Week (T1) = " &
                ACF.Day_Of_Week (T1)'Image);
      Put_Line ("T2 = " & ACF.Image (T2) &
                ", Ada.Calendar.Formatting.Day_Of_Week (T2) = " &
                ACF.Day_Of_Week (T2)'Image);
   end Show_Error;

Program, when run, produces this output:
   T1 = 2025-11-02 04:00:00, Ada.Calendar.Formatting.Day_Of_Week (T1) = SUNDAY
   T2 = 2025-11-03 04:00:00, Ada.Calendar.Formatting.Day_Of_Week (T2) = SUNDAY

Reply via email to