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] |
In certain cases, the compiler converts the operands of an arithmetic expression that is an argument of a conversion to a wider type, to avoid generation of an overflow check. This can result in the conversion being wrongly flagged as redundant. By rewriting the operator node, so that the original node will be retained, the test for redundant conversions properly recognizes that the conversion in the source was not redundant. The following test must compile quietly with -gnatwae: package Nonredundant_Conversion is type Unsigned_64 is mod 2 ** 64; Nat : Natural; Uns : Unsigned_64 := Unsigned_64 (Nat + 1); end Nonredundant_Conversion; Tested on x86_64-pc-linux-gnu, committed on trunk 2010-09-09 Gary Dismukes <dismukes@adacore.com> * checks.adb (Apply_Arithmetic_Overflow_Check): When converting the operands of an operator to the type of an enclosing conversion, rewrite the operator so the conversion can't be flagged as redundant. Remove useless assignments to Typ and Rtyp.
Attachment:
difs
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |