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 trunk. This patch fixes a glitch in the infinite recursion warning. This is supposed to be suppressed after an unconditional raise statement to accomodate this common style of function stubs. But in some casee freeze nodes were getting in the way of this test. For the following set of sources, compiling h.adb should not generate a warning: package body G is function F return A_Type is begin raise Program_Error; return F; end F; end; generic package G is type A_Type is tagged null record; function F return A_Type; end; package body H is end; with G; generic package H is pragma Elaborate_Body; package GI is new G; end; On IVMS the type Address is a visible integer type, in order to support subtypes of various sizes. As a result, spurious ambiguities can arise on operations involving address arithmetic. These ambiguities are resolved by removing interpretations whose type is (derived from) Address. In the case of conversions, there is no context type to disambiguate the operand, and the removal of address interpretations is done unconditionally. However a node may be labelled overloaded in the course of analysis, and end up with a single interpretation. In that case, the Address interpretation is the correct one, and must not be removed. Finally, we want to output a warning when an expression of the form "-A mod B" is encountered, because the programmer might have intended to write (-A) mod B, and the compiler must actually interpret such an expression as -(A mod B). When parentheses are present around the (A mod B) part of the expression, no warning should be emitted. This change implements that case. This program must be accepted without any warning: procedure Warning is A : constant Integer := 5; B : constant Integer := -2; Result : Integer; begin Result := -(A mod B); end Warning; 2005-11-14 Hristian Kirtchev <kirtchev@adacore.com> Ed Schonberg <schonberg@adacore.com> Robert Dewar <dewar@adacore.com> Thomas Quinot <quinot@adacore.com> * sem_res.adb (Resolve_Call): Provide a better error message whenever a procedure call is used as a select statement trigger and is not an entry renaming or a primitive of a limited interface. (Valid_Conversion): If the operand has a single interpretation do not remove address operations. (Check_Infinite_Recursion): Skip freeze nodes when looking for a raise statement to inhibit warning. (Resolve_Unary_Op): Do not produce a warning when processing an expression of the form -(A mod B) Use Universal_Real instead of Long_Long_Float when we need a high precision float type for the generated code (prevents gratuitous Vax_Float stuff when pragma Float_Representation (Vax_Float) used) (Resolve_Concatenation_Arg): Improve error message when argument is an ambiguous call to a function that returns an array. (Make_Call_Into_Operator, Operand_Type_In_Scope): Do not check that there is an implicit operator in the given scope if we are within an instance: legality check has been performed on the generic. (Resolve_Unary_Op): Apply warnings checks on argument of Abs operator after resolving operand, to avoid false warnings on overloaded calls.
Attachment:
difs.58
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |