https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81805

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Alexander Monakov from comment #3)
> The comparison should have read '(long long)i < 0', no idea how the cast is
> lost.

It seems to be lost here, in c-omp.c:
...
   553                /* 2.5.1.  The comparison in the condition is computed in
   554                   the type of DECL, otherwise the behavior is undefined.
   555
   556                   For example:
   557                   long n; int i;
   558                   i < n;
   559
   560                   according to ISO will be evaluated as:
   561                   (long)i < n;
   562
   563                   We want to force:
   564                   i < (int)n;  */
   565                if (TREE_CODE (op0) == NOP_EXPR
   566                    && decl == TREE_OPERAND (op0, 0))
   567                  {
   568                    TREE_OPERAND (cond, 0) = TREE_OPERAND (op0, 0);
   569                    TREE_OPERAND (cond, 1)
   570                      = fold_build1_loc (elocus, NOP_EXPR, TREE_TYPE
(decl),
   571                                     TREE_OPERAND (cond, 1));
   572                  }
...

...
568                       TREE_OPERAND (cond, 0) = TREE_OPERAND (op0, 0);
(gdb) call debug_generic_expr (cond)
(signed long) i < 0
(gdb) n
569                       TREE_OPERAND (cond, 1)
(gdb) call debug_generic_expr (cond)
i < 0
...

Reply via email to