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] |
Tested on i686-linux, committed on HEAD Gather_Component is called to collect the full list of components of a derived record, in order to analyze an aggregate of the type. The list must include only explicit components that must appear in the aggregate, and omit the tag and internal subtypes. In Ada2005, it must also exclude the interface tags that are present when the type of the object implements an interface. The following must compile quietly: package Aggr_Bug is type I is Interface; type O is tagged null record; type P is new O and I with null record; Value1 : P := (O with null record); type Q is new O and I with record Num : Integer; end record; Value2 : Q := (O with 15); Value3 : Q := (O with Num => 15); Value4 : Q := (Num => 15); end Aggr_Bug; The front-end performs some constant propagation in straight-line code, and Safe_To_Capture_Value determines whether an inferred value can safely be reused in subsequent expressions. In the absence of more complex data- flow analysis, the front-end does not store value information that is generated in code that might not be executed, such as a given branch of an if-statement. The case of the second operand of a short-circuit expression was simply missing. The following must compile and execute silently: -- procedure short is type rec is record value : integer := 10; end record; type T is access Rec; Ptr : T := new Rec; Maybe : boolean; begin if ptr.all.value = 10 then ptr := null; end if; maybe := ptr /= null and then ptr.all.value = 10; end; 2005-09-01 Ed Schonberg <schonberg@adacore.com> * sem_util.ads, sem_util.adb (Gather_Components): Omit interface tags from the list of required components. (Is_Controlling_Limited_Procedure): Determine whether an entity is a primitive procedure of a limited interface with a controlling first parameter. (Is_Renamed_Entry): Determine whether an entry is a procedure renaming of an entry. (Safe_To_Capture_Value): A value (such as non_null) is not safe to capture if it is generated in the second operand of a short-circuit operation. Do not capture values for variables with address clauses. (Is_Object_Reference): Treat a function call as an object reference only if its type is not Standard_Void_Type.
Attachment:
difs.42
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |