Skip to content

#pragma GCC unroll is not emitted immediately before its loop #174

Closed

Description

@mborland

GCC rejects the generated C when #pragma GCC unroll is not emitted immediately before its loop.

Reproducer for the failure:

// Case 1
void h();

void f(char *first, char *last) {
  h();
#pragma GCC unroll 4
  while (first != last)
    ++first;
}

// Case 2 (the libstdc++ 15 form)
struct It { char *p; };
bool operator!=(It a, It b);

void f(It first, It last) {
#pragma GCC unroll 4
  while (first != last)
    ++first.p;
}

The generated C for case 1 is:

void _Z1fPcS_( char *__2_14_first,  char *__2_27_last) {
#pragma GCC unroll 4
_Z1hv();
while (__2_14_first != __2_27_last) {
++__2_14_first; }
}

And then the error is:

Test_name.c:25:1: error: for, while or do statement expected before '_Z1hv'
Test_name.c:36:1: error: for, while or do statement expected before 'auto'

This impacts Boost.Graph, Locale, Log, Process, Program_options, and test

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions