[Bug target/77686] New: [6/7 Regression] wrong code on arm-linux-gnueabi and arm-linux-gnueabihf

doko at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Sep 22 09:06:00 GMT 2016


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

            Bug ID: 77686
           Summary: [6/7 Regression]  wrong code on arm-linux-gnueabi and
                    arm-linux-gnueabihf
           Product: gcc
           Version: 6.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: doko at gcc dot gnu.org
  Target Milestone: ---

[forwarded from https://bugs.debian.org/838438]

seen with gcc-6 20160915 and trunk 20160902 (rechecking with newer version),
works with g++-5 with -O2, with -O1/-O0 everywhere.

---------------------------8<--------------------------
(sid_armhf-dchroot)jackyf@harris:~/smalltests/small-std-function-arm$ cat
hm.cpp
#include <iostream>
#include <functional>

struct C
{
        void doCb()
        {
                size_t dummy_a = 1;

                std::cout << "Outside: " << this << std::endl;
                std::function<void ()> f;
                f = [this, &dummy_a]()
                {};
                f = [this]()
                {
                        std::cout << "Inside: " << this << std::endl;
                };
                f();
        }
};

int main()
{
        C c;
        c.doCb();
}

$ g++ -O2 -Wall -Wextra hm.cpp && ./a.out
Outside: 0xffa74b30
Inside: 0xf7356195
$ g++ -O1 -Wall -Wextra hm.cpp && ./a.out
Outside: 0xff7f0300
Inside: 0xff7f0300

gcc configured with -with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard
--with-mode=thumb


More information about the Gcc-bugs mailing list