public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/49043] New: Returns from lambda functions incorrectly detected as "exits" from OpenMP loops in surrounding code
@ 2011-05-18 13:48 bisqwit at iki dot fi
  2011-05-19  8:30 ` [Bug c++/49043] [OpenMP & C++0x]: Compiler error when lambda-function within OpenMP loop bisqwit at iki dot fi
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: bisqwit at iki dot fi @ 2011-05-18 13:48 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49043

           Summary: Returns from lambda functions incorrectly detected as
                    "exits" from OpenMP loops in surrounding code
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: bisqwit@iki.fi


GCC incorrectly considers return statements within lambda functions as "exits"
from an OpenMP structured block.

For the code below, this error message is generated:

tmp3.cc: In lambda function:
tmp3.cc:7:40: error: invalid exit from OpenMP structured block

#include <iostream>
int main()
{
    #pragma omp parallel for
    for(int a=0; a<10; ++a)
    {
        auto func = [=] () { return a; };
        std::cout << func();
    }
}

Compiled with: -fopenmp -std=gnu++0x
Tested versions: 4.5.3 , 4.6.1

The purpose of this error is to catch exits from an OpenMP construct (return,
break, goto). No such thing happens when a lamdba function is called, which is
not different from calling an inlined function, therefore the error message is
misplaced.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-07-25  9:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-18 13:48 [Bug c++/49043] New: Returns from lambda functions incorrectly detected as "exits" from OpenMP loops in surrounding code bisqwit at iki dot fi
2011-05-19  8:30 ` [Bug c++/49043] [OpenMP & C++0x]: Compiler error when lambda-function within OpenMP loop bisqwit at iki dot fi
2011-05-19  9:03 ` bisqwit at iki dot fi
2011-05-19  9:16 ` jakub at gcc dot gnu.org
2011-05-19 13:30 ` jakub at gcc dot gnu.org
2011-05-19 14:10 ` jakub at gcc dot gnu.org
2011-05-19 14:29 ` jakub at gcc dot gnu.org
2011-07-25  9:54 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).