Bug 65062 - [4.9 Regression] Miscompilation: invalid C++ mangled name for global variable
Summary: [4.9 Regression] Miscompilation: invalid C++ mangled name for global variable
Status: RESOLVED DUPLICATE of bug 64898
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 5.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-14 02:44 UTC by Thiago Macieira
Modified: 2015-02-14 02:54 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thiago Macieira 2015-02-14 02:44:35 UTC
Code:

template <class>
void tf()
{
  extern void (*qt_memfill32)();
  qt_memfill32();
}

void f() {
  tf<int>();
}

When compiled with GCC 5.0, the object file has a reference to "_Z12qt_memfill32", which doesn't seem to me to be a valid C++ mangled name. At the very least, it's an ABI compatibility break with previous versions of GCC, other compilers and with itself.

This symbol is defined in another .o as "qt_memfill32", even when compiled with GCC 5.0.

Tests:

gcc-5.0 -O2 -S -o - test.cpp:
        jmp     *_Z12qt_memfill32(%rip)

gcc-4.9 -O2 -S -o - test.cpp:
        movq    qt_memfill32(%rip), %rax
        jmp     *%rax

clang-3.6 -O2 -S -o - test.cpp:
        jmpq    *qt_memfill32(%rip)  # TAILCALL

icpc -O2 -S -o - test.cpp:
        movq      qt_memfill32(%rip), %rax
        jmp       *%rax
Comment 1 Andrew Pinski 2015-02-14 02:48:58 UTC
it was just fixed yesterday, see bug 64898.  Please check the latest GCC before filing a bug especially during stage 4.

*** This bug has been marked as a duplicate of bug 64898 ***
Comment 2 Thiago Macieira 2015-02-14 02:54:34 UTC
(In reply to Andrew Pinski from comment #1)
> it was just fixed yesterday, see bug 64898.  Please check the latest GCC
> before filing a bug especially during stage 4.
> 
> *** This bug has been marked as a duplicate of bug 64898 ***

Sorry, I did rebuild two days ago when this started showing up. I must have missed the fix by a few hours, more or less (again).