===================================================================
@@ -7404,6 +7404,16 @@
elsif Top_Level
and then not (Bignum_Operands or Long_Long_Integer_Operands)
+
+ -- One further refinement. If we are at the top level, but our parent
+ -- is a type conversion, then go into bignum or long long integer node
+ -- since the result will be converted to that type directly without
+ -- going through the result type, and we may avoid an overflow. This
+ -- is the case for example of Long_Long_Integer (A ** 4), where A is
+ -- of type Integer, and the result A ** 4 fits in Long_Long_Integer
+ -- but does not fit in Integer.
+
+ and then Nkind (Parent (N)) /= N_Type_Conversion
then
-- Here we will keep the original types, but we do need an overflow
-- check, so we will set Do_Overflow_Check to True (actually it is
@@ -7561,12 +7571,6 @@
if Nkind (N) = N_Op_Expon and then Etype (Right_Opnd (N)) = LLIB then
Convert_To_And_Rewrite (Standard_Natural, Right_Opnd (N));
-
- -- Now Long_Long_Integer_Operands may have to be reset if that was
- -- the only long long integer operand, i.e. we now have long long
- -- integer operands only if the left operand is long long integer.
-
- Long_Long_Integer_Operands := Etype (Left_Opnd (N)) = LLIB;
end if;
-- Here we will do the operation in Long_Long_Integer. We do this even
===================================================================
@@ -9624,6 +9624,13 @@
then
null;
+ -- Never warn on conversion to Long_Long_Integer'Base since
+ -- that is most likely an artifact of the extended overflow
+ -- checking and comes from complex expanded code.
+
+ elsif Orig_T = Base_Type (Standard_Long_Long_Integer) then
+ null;
+
-- Here we give the redundant conversion warning. If it is an
-- entity, give the name of the entity in the message. If not,
-- just mention the expression.
===================================================================
@@ -334,6 +334,12 @@
if Opt.Suppress_Options.Overflow_Checks_General /= Not_Set then
null;
+ -- By default suppress overflow checks in -gnatg mode
+
+ elsif GNAT_Mode then
+ Suppress_Options.Overflow_Checks_General := Suppressed;
+ Suppress_Options.Overflow_Checks_Assertions := Suppressed;
+
-- If we have backend divide and overflow checks, then by default
-- overflow checks are minimized, which is a reasonable setting.