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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-12-14
            Summary|Lambda functions are not    |pragma optimization is not
                   |inlined under certain       |applying to Lambdas
                   |optimization pragmas        |
           Keywords|                            |wrong-code
             Blocks|                            |54367
          Component|target                      |c++
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
If I manually apply the attributes rather than use the pragma, I get the
correct results.

that is the following works:
int global_var;

[[gnu::optimize("finite-math-only"),gnu::target("sse3")]]
int solve() {
    auto nested = 
     []
     [[gnu::optimize("finite-math-only"),gnu::target("sse")]]
     () {
        return global_var;
    };
    return nested();
}


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54367
[Bug 54367] [meta-bug] lambda expressions

Reply via email to