This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libgomp/81805] Another libgomp.c/for-5.c failure on nvptx -- illegal memory access
- From: "vries at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 11 Aug 2017 08:29:51 +0000
- Subject: [Bug libgomp/81805] Another libgomp.c/for-5.c failure on nvptx -- illegal memory access
- Auto-submitted: auto-generated
- References: <bug-81805-4@http.gcc.gnu.org/bugzilla/>
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
...