Commit 5e67547d by Eric Botcazou Committed by Eric Botcazou

double-int.c (div_and_round_double): Use the proper predicate to detect a negative quotient.

	* double-int.c (div_and_round_double) <ROUND_DIV_EXPR>: Use the proper
	predicate to detect a negative quotient.

From-SVN: r210981
parent 5c1bc275
2014-05-27 Eric Botcazou <ebotcazou@adacore.com> 2014-05-27 Eric Botcazou <ebotcazou@adacore.com>
* double-int.c (div_and_round_double) <ROUND_DIV_EXPR>: Use the proper
predicate to detect a negative quotient.
2014-05-27 Eric Botcazou <ebotcazou@adacore.com>
* fold-const.c (fold_comparison): Clean up and extend X +- C1 CMP C2 * fold-const.c (fold_comparison): Clean up and extend X +- C1 CMP C2
to X CMP C2 -+ C1 transformation to EQ_EXPR/NE_EXPR. to X CMP C2 -+ C1 transformation to EQ_EXPR/NE_EXPR.
Add X - Y CMP 0 to X CMP Y transformation. Add X - Y CMP 0 to X CMP Y transformation.
......
...@@ -588,7 +588,7 @@ div_and_round_double (unsigned code, int uns, ...@@ -588,7 +588,7 @@ div_and_round_double (unsigned code, int uns,
== (unsigned HOST_WIDE_INT) htwice) == (unsigned HOST_WIDE_INT) htwice)
&& (labs_den <= ltwice))) && (labs_den <= ltwice)))
{ {
if (*hquo < 0) if (quo_neg)
/* quo = quo - 1; */ /* quo = quo - 1; */
add_double (*lquo, *hquo, add_double (*lquo, *hquo,
(HOST_WIDE_INT) -1, (HOST_WIDE_INT) -1, lquo, hquo); (HOST_WIDE_INT) -1, (HOST_WIDE_INT) -1, lquo, hquo);
......
2014-05-27 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/overflow_fixed.adb: New test.
2014-05-27 Marek Polacek <polacek@redhat.com> 2014-05-27 Marek Polacek <polacek@redhat.com>
PR c/56724 PR c/56724
......
-- { dg-do run }
-- { dg-options "-gnato -O" }
procedure Overflow_Fixed is
type Unsigned_8_Bit is mod 2**8;
procedure Fixed_To_Eight (Value : Duration) is
Item : Unsigned_8_Bit;
begin
Item := Unsigned_8_Bit(Value);
raise Program_Error;
exception
when Constraint_Error => null; -- expected case
end;
begin
Fixed_To_Eight (-0.5);
end;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment