This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug lto/86442] Wrong error: global register variable follows a function definition when using LTO


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

--- Comment #1 from Jan Hubicka <hubicka at ucw dot cz> ---
> 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

Global register variables are not really working with LTO (because they should
be part of the function context since they may differ across units).

We could try to fix them for gcc 9.  I was thinking a bit about it, but it
would
need to attach the information somewhere into optimization node and make
inliner
to not inline across different globally allocated registers.

It is overall questionable how global registers should interact with the symbol
table.

Honza

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]