+2018-07-16 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR tree-optimization/86514
+ * tree-ssa-reassoc.c (init_range_entry) <CASE_CONVERT>: Return for a
+ conversion to a boolean type from a type with greater precision.
+
2018-07-16 Tom de Vries <tdevries@suse.de>
* var-tracking.c (vt_initialize): Print adjusted insn slim if
--- /dev/null
+-- { dg-do run }
+-- { dg-options "-O" }
+
+procedure Opt73 is
+
+ type Terminal_Set_Indexed_By_Non_Terminal is
+ array (Natural range <>, Natural range <>) of Boolean with Pack;
+
+ type Terminal_Set_Per_Non_Terminal
+ (Last_Terminal : Natural;
+ Last_Non_Terminal : Natural) is
+ record
+ Map : Terminal_Set_Indexed_By_Non_Terminal
+ (1 .. Last_Non_Terminal, 0 .. Last_Terminal);
+ end record;
+
+ Follow : Terminal_Set_Per_Non_Terminal (5, 4);
+ Expect : Terminal_Set_Per_Non_Terminal :=
+ (5, 4, (1 => (2 => True, others => False),
+ others => (others => False)));
+
+ procedure Get_Follow (Value : out Terminal_Set_Per_Non_Terminal) is
+ begin
+ Value.Map := (others => (others => False));
+ Value.Map (1, 2) := True;
+ Value.Map (2, 0) := Value.Map (2, 0) or Value.Map (1, 0);
+ end;
+
+begin
+ Get_Follow (Follow);
+ if Follow /= Expect then
+ raise Program_Error;
+ end if;
+end;
continue;
CASE_CONVERT:
if (is_bool)
- goto do_default;
- if (TYPE_PRECISION (TREE_TYPE (arg0)) == 1)
+ {
+ if ((TYPE_PRECISION (exp_type) == 1
+ || TREE_CODE (exp_type) == BOOLEAN_TYPE)
+ && TYPE_PRECISION (TREE_TYPE (arg0)) > 1)
+ return;
+ }
+ else if (TYPE_PRECISION (TREE_TYPE (arg0)) == 1)
{
if (TYPE_UNSIGNED (TREE_TYPE (arg0)))
is_bool = true;