* Re: segment fault [not found] ` <HK0PR01MB20811B1F43D6E93889C70430D4AC0@HK0PR01MB2081.apcprd01.prod.exchangelabs.com> @ 2020-04-28 8:45 ` Jonathan Wakely 2020-04-28 8:47 ` 回复: " luo alvin 0 siblings, 1 reply; 2+ messages in thread From: Jonathan Wakely @ 2020-04-28 8:45 UTC (permalink / raw) To: luo alvin; +Cc: gcc-help On Tue, 28 Apr 2020 at 07:07, luo alvin <alvinlmf@hotmail.com> wrote: > > Thank you very much for replying me. I also think it not bug,because I test this code in the lower version(lower than 8.3.1-3) of gcc,all cause segment fault. The funny thing is that if you run this code higher than gcc version(8.3.1-4)(actually I only test code in the version 8.3.1-4),the result is fine(doesn’t lead to segment fault). Your program has undefined behaviour. That means anything can happen. >furthermore, I found that the value of sizeof(std::string) is different between gcc versions. Value in version 8.3.1-3 is 8 ,and 32 in version 8.3.1-4. That is not caused by the GCC version, it's caused by a different default for the _GLIBCXX_USE_CXX11_ABI macro. When the default is 0 sizeof(std::string) == sizeof(char*) but when the default is 1 sizeof(string) is larger. See https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html for more information about the macro. ^ permalink raw reply [flat|nested] 2+ messages in thread
* 回复: segment fault 2020-04-28 8:45 ` segment fault Jonathan Wakely @ 2020-04-28 8:47 ` luo alvin 0 siblings, 0 replies; 2+ messages in thread From: luo alvin @ 2020-04-28 8:47 UTC (permalink / raw) To: Jonathan Wakely; +Cc: gcc-help Thank you very much ,you help me a lot! 发送自 Windows 10 版邮件<https://go.microsoft.com/fwlink/?LinkId=550986>应用 ________________________________ 发件人: Jonathan Wakely <jwakely.gcc@gmail.com> 发送时间: Tuesday, April 28, 2020 4:45:10 PM 收件人: luo alvin <alvinlmf@hotmail.com> 抄送: gcc-help <gcc-help@gcc.gnu.org> 主题: Re: segment fault On Tue, 28 Apr 2020 at 07:07, luo alvin <alvinlmf@hotmail.com> wrote: > > Thank you very much for replying me. I also think it not bug,because I test this code in the lower version(lower than 8.3.1-3) of gcc,all cause segment fault. The funny thing is that if you run this code higher than gcc version(8.3.1-4)(actually I only test code in the version 8.3.1-4),the result is fine(doesn’t lead to segment fault). Your program has undefined behaviour. That means anything can happen. >furthermore, I found that the value of sizeof(std::string) is different between gcc versions. Value in version 8.3.1-3 is 8 ,and 32 in version 8.3.1-4. That is not caused by the GCC version, it's caused by a different default for the _GLIBCXX_USE_CXX11_ABI macro. When the default is 0 sizeof(std::string) == sizeof(char*) but when the default is 1 sizeof(string) is larger. See https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html for more information about the macro. ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-28 8:47 UTC | newest] Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <HK0PR01MB20814473ACEDD5F20C7200F1D4AC0@HK0PR01MB2081.apcprd01.prod.exchangelabs.com> [not found] ` <CAH6eHdRn9U8HnQzvbDChxRmVh956PpPUqvYjrM1yPCge44Zu1w@mail.gmail.com> [not found] ` <HK0PR01MB20811B1F43D6E93889C70430D4AC0@HK0PR01MB2081.apcprd01.prod.exchangelabs.com> 2020-04-28 8:45 ` segment fault Jonathan Wakely 2020-04-28 8:47 ` 回复: " luo alvin
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).