Re: segment fault

2020-04-28 Thread Jonathan Wakely via Gcc
.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).furthermore, I found that the value of > sizeof(std::string

Re: segment fault

2020-04-27 Thread Jonathan Wakely via Gcc
On Tue, 28 Apr 2020 at 02:26, luo alvin via Gcc wrote: > > Dear gnu: >Here is code: Please do not report bugs to this mailing list. Bug reports belong in our Bugzilla database, see https://gcc.gnu.org/bugs/ But this is not a bug anyway, your code has undefined behaviour. You cannot use m

segment fault

2020-04-27 Thread luo alvin via Gcc
Dear gnu: Here is code: #include #include #include class segment_fault { std::string str; int a; float *b = nullptr; }; int main() { std::vector segments; segment_fault sf; memset(&sf,0,sizeof(sf)); std::cout << "segment's size is: "<< sizeof(segment_fault) <