Re: problems with memory allocation and the alignment check

2021-02-23 Thread Michael J. Baars
On Mon, 2021-02-22 at 01:41 -0800, Andrew Pinski wrote: > On Mon, Feb 22, 2021 at 1:37 AM Michael J. Baars > wrote: > > On Mon, 2021-02-22 at 01:29 -0800, Andrew Pinski wrote: > > > On Mon, Feb 22, 2021 at 1:17 AM Michael J. Baars > > > wrote: > > > > Hi, > > > > > > > > I just wrote this little

RE: problems with memory allocation and the alignment check

2021-02-23 Thread David Laight via Gcc
> > > I just wrote this little program to demonstrate a possible flaw in both > > > malloc and calloc. > > > > > > If I allocate a the simplest memory region from main(), one out of three > > > optimization flags fail. > > > If I allocate the same region from a function, three out of three > > >

Re: problems with memory allocation and the alignment check

2021-02-22 Thread Michael J. Baars
On Mon, 2021-02-22 at 10:50 +0100, Gabriel Ravier via Gcc wrote: > On 2/22/21 10:37 AM, Michael J. Baars wrote: > > On Mon, 2021-02-22 at 01:29 -0800, Andrew Pinski wrote: > > > On Mon, Feb 22, 2021 at 1:17 AM Michael J. Baars > > > wrote: > > > > Hi, > > > > > > > > I just wrote this little prog

Re: problems with memory allocation and the alignment check

2021-02-22 Thread Michael J. Baars
On Mon, 2021-02-22 at 01:41 -0800, Andrew Pinski wrote: > On Mon, Feb 22, 2021 at 1:37 AM Michael J. Baars > wrote: > > On Mon, 2021-02-22 at 01:29 -0800, Andrew Pinski wrote: > > > On Mon, Feb 22, 2021 at 1:17 AM Michael J. Baars > > > wrote: > > > > Hi, > > > > > > > > I just wrote this little

Re: problems with memory allocation and the alignment check

2021-02-22 Thread Gabriel Ravier via Gcc
On 2/22/21 10:37 AM, Michael J. Baars wrote: On Mon, 2021-02-22 at 01:29 -0800, Andrew Pinski wrote: On Mon, Feb 22, 2021 at 1:17 AM Michael J. Baars wrote: Hi, I just wrote this little program to demonstrate a possible flaw in both malloc and calloc. If I allocate a the simplest memory reg

Re: problems with memory allocation and the alignment check

2021-02-22 Thread Andrew Pinski via Gcc
On Mon, Feb 22, 2021 at 1:37 AM Michael J. Baars wrote: > > On Mon, 2021-02-22 at 01:29 -0800, Andrew Pinski wrote: > > On Mon, Feb 22, 2021 at 1:17 AM Michael J. Baars > > wrote: > > > Hi, > > > > > > I just wrote this little program to demonstrate a possible flaw in both > > > malloc and callo

Re: problems with memory allocation and the alignment check

2021-02-22 Thread Michael J. Baars
On Mon, 2021-02-22 at 01:29 -0800, Andrew Pinski wrote: > On Mon, Feb 22, 2021 at 1:17 AM Michael J. Baars > wrote: > > Hi, > > > > I just wrote this little program to demonstrate a possible flaw in both > > malloc and calloc. > > > > If I allocate a the simplest memory region from main(), one

Re: problems with memory allocation and the alignment check

2021-02-22 Thread Andrew Pinski via Gcc
On Mon, Feb 22, 2021 at 1:17 AM Michael J. Baars wrote: > > Hi, > > I just wrote this little program to demonstrate a possible flaw in both > malloc and calloc. > > If I allocate a the simplest memory region from main(), one out of three > optimization flags fail. > If I allocate the same region

problems with memory allocation and the alignment check

2021-02-22 Thread Michael J. Baars
Hi, I just wrote this little program to demonstrate a possible flaw in both malloc and calloc. If I allocate a the simplest memory region from main(), one out of three optimization flags fail. If I allocate the same region from a function, three out of three optimization flags fail. Does some

Re: [match-and-simplify] out of memory allocation error

2014-11-11 Thread Prathamesh Kulkarni
make[2]: *** [s-match] Error 1 > make[1]: *** [all-gcc] Error 2 > make: *** [all] Error 2 > > Why does moving definition of simplify constructor outside the class cause > out of memory allocation ? oops i didn't initialize capture_max. sorry for the noise. > > Thanks, > Prathamesh

Re: [match-and-simplify] out of memory allocation error

2014-11-11 Thread Florian Weimer
On 11/11/2014 11:33 AM, Prathamesh Kulkarni wrote: Why does moving definition of simplify constructor outside the class cause out of memory allocation ? It's probably because you dropped the initialization of the capture_max member. -- Florian Weimer / Red Hat Product Security

[match-and-simplify] out of memory allocation error

2014-11-11 Thread Prathamesh Kulkarni
does moving definition of simplify constructor outside the class cause out of memory allocation ? Thanks, Prathamesh Index: genmatch.c === --- genmatch.c (revision 217303) +++ genmatch.c (working copy) @@ -549,11 +549,7 @@ simplify

Re: memory allocation

2013-09-17 Thread Ian Lance Taylor
On Mon, Sep 16, 2013 at 1:43 AM, zhaobin xv wrote: > > As I know in C : > a. Global and static variables locate at data segment > b. When a function is called, memory is allocated on the stack to hold > parameter values, local variables, and the address of the calling > function > c. the struct is

memory allocation

2013-09-16 Thread zhaobin xv
Hi As I know in C : a. Global and static variables locate at data segment b. When a function is called, memory is allocated on the stack to hold parameter values, local variables, and the address of the calling function c. the struct is aligned based on the greatest alignment requirement of it's me

Re: Question about memory allocation in ifcvt.c

2012-10-14 Thread thorsten
On Sun, Oct 14, 2012 at 1:40 AM, Andrew Pinski wrote: Maybe Ian can mention why he used alloca there instead of xmalloc. It was a long time ago, but I expect it was just because alloca is usually fine for memory that has to live for just a single function. As a single-threaded program, GCC do

Re: Question about memory allocation in ifcvt.c

2012-10-14 Thread Ian Lance Taylor
On Sun, Oct 14, 2012 at 1:40 AM, Andrew Pinski wrote: > > Maybe Ian can mention why he used alloca there instead of xmalloc. It was a long time ago, but I expect it was just because alloca is usually fine for memory that has to live for just a single function. As a single-threaded program, GCC do

Re: Question about memory allocation in ifcvt.c

2012-10-14 Thread Steven Bosscher
Andrew Pinski Wrote: >> I figured out that ifcvt.c uses alloca to reserve mem on the stack. this is >> the point where the segmentation fault occurs. > > It is also a regression from what I can tell too from 4.1.x. And one that's fixed for GCC 4.8. See http://gcc.gnu.org/ml/gcc-patches/2012-08/msg

Re: Question about memory allocation in ifcvt.c

2012-10-14 Thread Andrew Pinski
On Sun, Oct 14, 2012 at 1:05 AM, thorsten wrote: > Hello all, > > this might be a noob Question but perhaps someone is so kind as to shed some > light... > > using gcc-4.5.4 to build large files (as in wireshark or qemu) with > Optimizations enabled (in my case -O2 -pipe -march=core2 > -fomit-fram

Question about memory allocation in ifcvt.c

2012-10-14 Thread thorsten
Hello all, this might be a noob Question but perhaps someone is so kind as to shed some light... using gcc-4.5.4 to build large files (as in wireshark or qemu) with Optimizations enabled (in my case -O2 -pipe -march=core2 -fomit-frame-pointer) I get segmentation faults due to Stack limits,

Re: Memory allocation for local variables.

2006-12-13 Thread Steven Bosscher
On 12/13/06, Sandeep Kumar <[EMAIL PROTECTED]> wrote: Hi all, I tried compiling the above two programs : on x86, 32 bit machines. [EMAIL PROTECTED] ~]# gcc test.c Try with optimization enabled (try -O1 and/or -O2). Gr. Steven

Memory allocation for local variables.

2006-12-13 Thread Sandeep Kumar
Hi all, I tried compiling the above two programs : on x86, 32 bit machines. And when I used objdump on that I saw the following code. Can anyone help me know, Why in the objdump of our first program the esp is decremented by 18H bytes and in the second program the esp is decremented by 28H bytes.