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

            Bug ID: 86442
           Summary: Wrong error: global register variable follows a
                    function definition when using LTO
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: hubicka at gcc dot gnu.org, marxin at gcc dot gnu.org
  Target Milestone: ---

Following wrong error is printed with LTO:

$ cat global.cpp
register int a __asm__("r12");

class b {
public:
  b();
};

b c;

int main() { a = 3; }

$ g++ global.cpp -O2  -flto
global.cpp: In function ‘main’:
global.cpp:1:14: error: global register variable follows a function definition
 register int a __asm__("r12");
              ^
lto-wrapper: fatal error: g++ returned 1 exit status
compilation terminated.
/usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: error:
lto-wrapper failed
collect2: error: ld returned 1 exit status

Reply via email to