This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

patch for exception problem in GNAT



Here is a verified patch that removes the exception from being raised (this is
the exception that caused trouble with a broken C compiler that generated
bad code for exception raising), as reported by Zack. It is the same as
Zack's patch, but does not remove the exception handler (since this handler
provides important functionality)

This patch is verified against the ACT test suite
--
*** sem_eval.adb	Sat Mar 16 12:46:00 2002
--- sem_eval.adb	Tue Mar 19 07:20:28 2002
***************
*** 923,942 ****
           declare
              Arr : constant Node_Id := Constant_Value (Entity (Prefix (Op)));
              Sub : constant Node_Id := First (Expressions (Op));
!             Ind : constant Node_Id := First_Index (Etype (Arr));
!             Lbd : constant Node_Id := Type_Low_Bound (Etype (Ind));
  
              Lin : Nat;
              --  Linear one's origin subscript value for array reference
  
              Elm : Node_Id;
              --  Value from constant array
  
           begin
              if Compile_Time_Known_Value (Sub)
                and then Nkind (Arr) = N_Aggregate
                and then Compile_Time_Known_Value (Lbd)
!               and then Is_Discrete_Type (Component_Type (Etype (Arr)))
              then
                 Lin := UI_To_Int (Expr_Value (Sub) - Expr_Value (Lbd)) + 1;
  
--- 923,950 ----
           declare
              Arr : constant Node_Id := Constant_Value (Entity (Prefix (Op)));
              Sub : constant Node_Id := First (Expressions (Op));
!             Aty : constant Node_Id := Etype (Arr);
  
              Lin : Nat;
              --  Linear one's origin subscript value for array reference
  
+             Lbd : Node_Id;
+             --  Lower bound of the first array index
+ 
              Elm : Node_Id;
              --  Value from constant array
  
           begin
+             if Ekind (Aty) = E_String_Literal_Subtype then
+                Lbd := String_Literal_Low_Bound (Aty);
+             else
+                Lbd := Type_Low_Bound (Etype (First_Index (Aty)));
+             end if;
+ 
              if Compile_Time_Known_Value (Sub)
                and then Nkind (Arr) = N_Aggregate
                and then Compile_Time_Known_Value (Lbd)
!               and then Is_Discrete_Type (Component_Type (Aty))
              then
                 Lin := UI_To_Int (Expr_Value (Sub) - Expr_Value (Lbd)) + 1;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]