public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99952] New: Incompatible function call ABI between 7.5 and 9.2
@ 2021-04-07 7:41 gdutor at gmail dot com
2021-04-07 7:49 ` [Bug c++/99952] " gdutor at gmail dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: gdutor at gmail dot com @ 2021-04-07 7:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99952
Bug ID: 99952
Summary: Incompatible function call ABI between 7.5 and 9.2
Product: gcc
Version: 7.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: gdutor at gmail dot com
Target Milestone: ---
For such a snipet, g++-7.5.0 and g++-9.2.0 generate different ABI for function
`foo`:
```
#include <optional>
enum E {
kA,kB,kC,kD,kE,kF
};
struct S {
E e;
std::optional<unsigned int> o;
};
void foo(S s) {
fprintf(stderr, "%d\n", (int)s.e);
}
int main() {
S s;
foo(s);
return 0;
}
```
7.5.0:
```
Dump of assembler code for function foo(S):
0x0000000000400767 <+0>: push %rbp
0x0000000000400768 <+1>: mov %rsp,%rbp
0x000000000040076b <+4>: sub $0x10,%rsp
0x000000000040076f <+8>: mov %rdi,-0x8(%rbp)
0x0000000000400773 <+12>: mov -0x8(%rbp),%rax
0x0000000000400777 <+16>: mov (%rax),%eax
0x0000000000400779 <+18>: mov %eax,%edx
0x000000000040077b <+20>: mov 0x2008de(%rip),%rax # 0x601060
<stderr@@GLIBC_2.2.5>
0x0000000000400782 <+27>: mov $0x400a3c,%esi
0x0000000000400787 <+32>: mov %rax,%rdi
0x000000000040078a <+35>: mov $0x0,%eax
0x000000000040078f <+40>: callq 0x400650 <fprintf@plt>
0x0000000000400794 <+45>: nop
0x0000000000400795 <+46>: leaveq
0x0000000000400796 <+47>: retq
```
9.2.0:
```
Dump of assembler code for function foo(S):
0x0000000000401152 <+0>: push %rbp
0x0000000000401153 <+1>: mov %rsp,%rbp
0x0000000000401156 <+4>: sub $0x10,%rsp
0x000000000040115a <+8>: mov %rdi,%rdx
0x000000000040115d <+11>: mov %esi,%eax
0x000000000040115f <+13>: mov %rdx,-0x10(%rbp)
0x0000000000401163 <+17>: mov %eax,-0x8(%rbp)
0x0000000000401166 <+20>: mov -0x10(%rbp),%eax
0x0000000000401169 <+23>: mov %eax,%edx
0x000000000040116b <+25>: mov 0x2eee(%rip),%rax # 0x404060
<stderr@@GLIBC_2.2.5>
0x0000000000401172 <+32>: mov $0x402004,%esi
0x0000000000401177 <+37>: mov %rax,%rdi
0x000000000040117a <+40>: mov $0x0,%eax
0x000000000040117f <+45>: callq 0x401040 <fprintf@plt>
0x0000000000401184 <+50>: nop
0x0000000000401185 <+51>: leaveq
0x0000000000401186 <+52>: retq
```
Such an incompatibility issue causes a program crash when the program is
compiled by g++ 9.2.0, and linked against a library which is compiled by g++
7.5.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/99952] Incompatible function call ABI between 7.5 and 9.2
2021-04-07 7:41 [Bug c++/99952] New: Incompatible function call ABI between 7.5 and 9.2 gdutor at gmail dot com
@ 2021-04-07 7:49 ` gdutor at gmail dot com
2021-04-07 8:02 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: gdutor at gmail dot com @ 2021-04-07 7:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99952
--- Comment #1 from Fenglin Hou <gdutor at gmail dot com> ---
I wonder if this is a bug, or I missed some compile option.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/99952] Incompatible function call ABI between 7.5 and 9.2
2021-04-07 7:41 [Bug c++/99952] New: Incompatible function call ABI between 7.5 and 9.2 gdutor at gmail dot com
2021-04-07 7:49 ` [Bug c++/99952] " gdutor at gmail dot com
@ 2021-04-07 8:02 ` pinskia at gcc dot gnu.org
2021-04-07 8:03 ` pinskia at gcc dot gnu.org
2021-04-07 8:23 ` gdutor at gmail dot com
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-04-07 8:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99952
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |WONTFIX
Status|UNCONFIRMED |RESOLVED
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
C++17 support was not stablized until GCC 9.x.
from: https://gcc.gnu.org/gcc-9/changes.html
The C++17 implementation is no longer experimental.
So we can say this is won't fix.
The patch which caused the ABI break is here:
https://gcc.gnu.org/pipermail/libstdc++/2017-December/046672.html
Which was done after GCC 7 but before GCC 8.
The ABI was not stabilized until GCC 9.x so we knew the break was ok at that
point.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/99952] Incompatible function call ABI between 7.5 and 9.2
2021-04-07 7:41 [Bug c++/99952] New: Incompatible function call ABI between 7.5 and 9.2 gdutor at gmail dot com
2021-04-07 7:49 ` [Bug c++/99952] " gdutor at gmail dot com
2021-04-07 8:02 ` pinskia at gcc dot gnu.org
@ 2021-04-07 8:03 ` pinskia at gcc dot gnu.org
2021-04-07 8:23 ` gdutor at gmail dot com
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-04-07 8:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99952
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>From that patch:
"The change is an ABI break due to changing
optional<triviallycopyable> to a trivially copyable type. It's perhaps
better to get that ABI break in now rather than later."
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/99952] Incompatible function call ABI between 7.5 and 9.2
2021-04-07 7:41 [Bug c++/99952] New: Incompatible function call ABI between 7.5 and 9.2 gdutor at gmail dot com
` (2 preceding siblings ...)
2021-04-07 8:03 ` pinskia at gcc dot gnu.org
@ 2021-04-07 8:23 ` gdutor at gmail dot com
3 siblings, 0 replies; 5+ messages in thread
From: gdutor at gmail dot com @ 2021-04-07 8:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99952
--- Comment #4 from Fenglin Hou <gdutor at gmail dot com> ---
Thanks for the quick reply.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-04-07 8:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07 7:41 [Bug c++/99952] New: Incompatible function call ABI between 7.5 and 9.2 gdutor at gmail dot com
2021-04-07 7:49 ` [Bug c++/99952] " gdutor at gmail dot com
2021-04-07 8:02 ` pinskia at gcc dot gnu.org
2021-04-07 8:03 ` pinskia at gcc dot gnu.org
2021-04-07 8:23 ` gdutor at gmail dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).