@@ -18407,7 +18407,7 @@ the try-block has been rewritten).
1840718407} /* put_block_around_try_block */
1840818408
1840918409
18410- static void turn_statement_into_block_transferring_pragma(
18410+ void turn_statement_into_block_transferring_pragma(
1841118411 a_statement_ptr statement,
1841218412 an_insert_location_ptr insert_location,
1841318413 a_statement_ptr *orig_statement,
@@ -19763,9 +19763,12 @@ If the "for" statement has an associated "break" label, lower it also.
1976319763 break_label_stmt->next = NULL;
1976419764 } /* if */
1976519765 /* Put a block statement around the for-loop and attach the scope
19766- to that block. */
19766+ to that block. Any pragmas attached to the for-loop (e.g., a
19767+ "#pragma GCC unroll") stay with the for-loop. */
1976719768 block_stmt = for_stmt;
19768- turn_statement_into_block(for_stmt, &insert_location, &for_stmt);
19769+ turn_statement_into_block_transferring_pragma(for_stmt, &insert_location,
19770+ &for_stmt,
19771+ curr_context->scope);
1976919772 if (break_label_stmt != NULL) {
1977019773 /* Re-attach the break label after the "for" statement entry. */
1977119774 check_assertion(for_stmt->next == NULL);
@@ -19795,7 +19798,10 @@ If the "for" statement has an associated "break" label, lower it also.
1979519798 /* Put a block around the for loop if we didn't previously. */
1979619799 if (block_stmt == NULL) {
1979719800 block_stmt = for_stmt;
19798- turn_statement_into_block(for_stmt, &insert_location, &for_stmt);
19801+ turn_statement_into_block_transferring_pragma(for_stmt,
19802+ &insert_location,
19803+ &for_stmt,
19804+ curr_context->scope);
1979919805 } /* if */
1980019806 reinsert_for_loop_initialization(init_stmt, &insert_location);
1980119807 } /* if */
@@ -19895,11 +19901,14 @@ the following lowered C code is generated:
1989519901 push_context(&range_based_for_context, range_based_for_scope,
1989619902 (an_object_lifetime_ptr)NULL);
1989719903 /* Put a block statement around the range-based-for and attach the
19898- range_based_for scope to that block. Note that any pragmas attached to
19899- the range-based-for statement will now be associated with the block. */
19904+ range_based_for scope to that block. Any pragmas attached to the
19905+ range-based-for statement (e.g., a "#pragma GCC unroll") stay with the
19906+ statement, which becomes the lowered "for" loop. */
1990019907 outer_block = range_based_for_stmt;
19901- turn_statement_into_block(range_based_for_stmt, &outer_insert_location,
19902- &range_based_for_stmt);
19908+ turn_statement_into_block_transferring_pragma(range_based_for_stmt,
19909+ &outer_insert_location,
19910+ &range_based_for_stmt,
19911+ curr_context->scope);
1990319912 outer_block->variant.block.extra_info->assoc_scope = range_based_for_scope;
1990419913 range_based_for_scope->assoc_block = outer_block;
1990519914 if (range_based_for_scope->lifetime != NULL) {
0 commit comments