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

            Bug ID: 87912
           Summary: ICE with comma operator in C OpenACC async clause
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code, openacc
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tschwinge at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

void f()
    {
    #pragma acc parallel async (1, 2)
      ;
    }

C:

    #1  0x0000000000a35cba in gimplify_expr
(expr_p=expr_p@entry=0x7ffff67bd078, pre_p=pre_p@entry=0x7fffffffbde0,
post_p=0x7fffffffb8e0, post_p@entry=0x0, gimple_test_f=0x9ebda0
<is_gimple_val(tree)>, fallback=fallback@entry=1) at [...]/gcc/gimplify.c:12357
    #2  0x0000000000a2598b in gimplify_scan_omp_clauses
(list_p=list_p@entry=0x7ffff68e0c78, pre_p=pre_p@entry=0x7fffffffbde0,
region_type=region_type@entry=ORT_ACC_PARALLEL, code=<optimized out>) at
[...]/gcc/gimplify.c:8496
    #3  0x0000000000a392f6 in gimplify_omp_workshare
(expr_p=expr_p@entry=0x7ffff6907b90, pre_p=pre_p@entry=0x7fffffffbde0) at
[...]/gcc/gimplify.c:10859
    #4  0x0000000000a34648 in gimplify_expr (expr_p=0x7ffff6907b90,
pre_p=pre_p@entry=0x7fffffffbde0, post_p=0x7fffffffbc80, post_p@entry=0x0,
gimple_test_f=gimple_test_f@entry=0xa1c730 <is_gimple_stmt(tree)>,
fallback=fallback@entry=0) at [...]/gcc/gimplify.c:12113
    #5  0x0000000000a37f47 in gimplify_stmt
(stmt_p=stmt_p@entry=0x7ffff6907b90, seq_p=seq_p@entry=0x7fffffffbde0) at
[...]/gcc/gimplify.c:6614
    #6  0x0000000000a3aa26 in gimplify_bind_expr
(expr_p=expr_p@entry=0x7ffff68e75c0, pre_p=pre_p@entry=0x7fffffffbfe8) at
[...]/gcc/gimplify.c:1331
    #7  0x0000000000a3518e in gimplify_expr (expr_p=0x7ffff68e75c0,
pre_p=pre_p@entry=0x7fffffffbfe8, post_p=0x7fffffffbea0, post_p@entry=0x0,
gimple_test_f=gimple_test_f@entry=0xa1c730 <is_gimple_stmt(tree)>,
fallback=fallback@entry=0) at [...]/gcc/gimplify.c:11805
    #8  0x0000000000a37f47 in gimplify_stmt
(stmt_p=stmt_p@entry=0x7ffff68e75c0, seq_p=seq_p@entry=0x7fffffffbfe8) at
[...]/gcc/gimplify.c:6614
    #9  0x0000000000a3b748 in gimplify_body
(fndecl=fndecl@entry=0x7ffff68e7500, do_parms=do_parms@entry=true) at
[...]/gcc/gimplify.c:12805
    #10 0x0000000000a3bc95 in gimplify_function_tree (fndecl=0x7ffff68e7500) at
[...]/gcc/gimplify.c:12949
    #11 0x0000000000855fe8 in cgraph_node::analyze
(this=this@entry=0x7ffff67ab2d0) at [...]/gcc/cgraphunit.c:667
    #12 0x00000000008594b0 in analyze_functions
(first_time=first_time@entry=true) at [...]/gcc/cgraphunit.c:1126
    #13 0x000000000085a2f3 in symbol_table::finalize_compilation_unit
(this=0x7ffff67ac100) at [...]/gcc/cgraphunit.c:2833
    #14 0x0000000000d3430d in compile_file () at [...]/gcc/toplev.c:480
    #15 0x00000000006952d5 in do_compile () at [...]/gcc/toplev.c:2172
    #16 toplev::main (this=this@entry=0x7fffffffc250, argc=argc@entry=33,
argv=argv@entry=0x7fffffffc358) at [...]/gcc/toplev.c:2307
    #17 0x0000000000698bf7 in main (argc=33, argv=0x7fffffffc358) at
[...]/gcc/main.c:39

That's most likely gcc/c/c-parser.c:c_parser_oacc_clause_async not doing the
right thing; compare to how other similar clauses are handled.

C++:

    source-gcc/gcc/testsuite/c-c++-common/goacc/asyncwait-1_.c: In function
'void f()':
    source-gcc/gcc/testsuite/c-c++-common/goacc/asyncwait-1_.c:3:32: warning:
left operand of comma operator has no effect [-Wunused-value]
        3 | #pragma acc parallel async (1, 2)
          |                                ^

(As discussed in PR87911.)

Reply via email to