This is the mail archive of the gcc-patches@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]

Re: [PATCH][RFC] Fix alias-set generation for array types


> I'll repost an adjusted patch, like Eric suggested.

Thanks.  It looks like there are no tests exercising TYPE_NONALIASED_COMPONENT 
and DECL_NONADDRESSABLE_P so I've installed the attached ones.  They pass at 
r136250 and fail if the flags aren't dealt with in record_component_aliases.

Tested on i586-suse-linux, applied on the mainline.


2008-06-03  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/aliasing1.ad[sb]: New test.
	* gnat.dg/aliasing2.ad[sb]: Likewise.


-- 
Eric Botcazou
-- { dg-do compile }
-- { dg-options "-O2 -gnatp -fdump-tree-final_cleanup" }

-- The raise statement must be optimized away by
-- virtue of DECL_NONADDRESSABLE_P set on R.I.

package body Aliasing1 is

  function F (P : Ptr) return Integer is
  begin
    R.I := 0;
    P.all := 1;
    if R.I /= 0 then
      raise Program_Error;
    end if;
    return 0;
  end;

end Aliasing1;

-- { dg-final { scan-tree-dump-not "__gnat_rcheck" "final_cleanup" } }
-- { dg-final { cleanup-tree-dump "final_cleanup" } }
package Aliasing1 is

  type Rec is record
    I : Integer;
  end record;

  type Ptr is access all Integer;

  R : Rec;

  function F (P : Ptr) return Integer;

end Aliasing1;
-- { dg-do compile }
-- { dg-options "-O2 -gnatp -fdump-tree-final_cleanup" }

-- The raise statement must be optimized away by
-- virtue of TYPE_NONALIASED_COMPONENT set on A.

package body Aliasing2 is

  function F (P : Ptr) return Integer is
  begin
    A (1) := 0;
    P.all := 1;
    if A(1) /= 0 then
      raise Program_Error;
    end if;
    return 0;
  end;

end Aliasing2;

-- { dg-final { scan-tree-dump-not "__gnat_rcheck" "final_cleanup" } }
-- { dg-final { cleanup-tree-dump "final_cleanup" } }
package Aliasing2 is

  type Arr is Array (1..4) of Integer;
  type Ptr is access all Integer;

  A : Arr;

  function F (P : Ptr) return Integer;

end Aliasing2;

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