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) <

Re: Unrolling for constexpr

2020-04-27 Thread Jonathan Wakely via Gcc
On Mon, 27 Apr 2020 at 04:54, Laleh Aghababaie via Gcc wrote: > > Hi all, N.B. this is the wrong mailing list for such a question, you should have used the gcc-help list instead. > I have a question about the constexpr variable specifications and how the > compiler handles them. The constexpr s

Re: bit field alignment

2020-04-27 Thread Andreas Schwab
On Apr 26 2020, Doug McIlroy via Gcc wrote: > What was the rationale for the gcc ABI convention that int > bit fields force the containing struct to be int-aligned? See PCC_BITFIELD_TYPE_MATTERS in the GCC internals documentation. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key finge

Re: where i should insert the finalize function for c++?

2020-04-27 Thread Martin Jambor
Hi, On Sun, Apr 26 2020, 易会战 via Gcc wrote: > I am working a instrumentation tool based on gcc. I insert some > intrumentation code into each function, including destructor > functions. A finalize function will free memory resources after all > work done. But I cannot find proper loacation calling

Re: bit field alignment

2020-04-27 Thread Florian Weimer via Gcc
* Doug McIlroy via Gcc: > What was the rationale for the gcc ABI convention that int > bit fields force the containing struct to be int-aligned? > > For example, the size of struct{int x:2;} is 4 in Linux > gcc, completely wasting 3 out of every 4 bytes of memory. I'm pretty sure that this follow