Re: [avr]: potential runtime bug in insn andsi3?

2008-12-16 Thread Denis Chertykov
2008/12/16 Georg-Johann Lay : > Hi, > > ./gcc/config/avr/avr.md > > defines andsi3 as follows: [...] > > For alternative 1 "d,0,i" the effect on cc_status is described as set_n. > However, if the high byte of [2] is 0xff, then the PSW (i.e. SREG.N) > does not contain the MSB of the result. > > I di

RE: How can I determine a register is referred through MEM at split2 stage?

2008-12-16 Thread Guo, Xuepeng
Hi Ian, Thanks for your comments. It's not exactly the entire basic block. It should be from the current RTL to the end of the current basic block. As you know GCC will optimize "addl %ebx, %eax" to "leal (%ebx, %eax), %eax" to avoid the flag register dependency through a splitter in i386.md at

Re: How can I determine a register is referred through MEM at split2 stage?

2008-12-16 Thread Ian Lance Taylor
"Guo, Xuepeng" writes: > I am working on an optimization which happens at split2 stage. I > need to determine whether the destination operand of the current RTL > (which is a register operand) will be referred by other RTL through > MEM within a basic block. I see there is a function named > reg_

C++0X constexpr implementation status

2008-12-16 Thread Ed Smith-Rowland
Greetings, In my efforts to build C++-0X library components I've noticed that constexpr member variables are used in several places. I was unable to implement these as intended and reverted to const accessors. It seems like the intent is sort of a static const function except that it binds

Re: gcc-4.3.2 generated "vmhraddshs" instruction when I compiled with -mcpu=8540

2008-12-16 Thread Ha Luong
Hi Nathan, Thanks for your guide. When I debugged the exe file or make it ran on 8548 board, the vmhaddshs makes the exe file hang out. Could I compile the source for 8540 (e500v1 instructions) only? Thanks for your help, Ha Luong On Tue, Dec 16, 2008 at 9:45 PM, Nathan Froyd wrote: > On Tue, D

How can I determine a register is referred through MEM at split2 stage?

2008-12-16 Thread Guo, Xuepeng
Hello Everyone, I am working on an optimization which happens at split2 stage. I need to determine whether the destination operand of the current RTL (which is a register operand) will be referred by other RTL through MEM within a basic block. I see there is a function named reg_mentioned_p (co

Re: Purpose of GCC Stack Padding?

2008-12-16 Thread Tim Prince
Andrew Tomazos wrote: I've been studying the x86 compiled form of the following function: void function() { char buffer[X]; } where X = 0, 1, 2 .. 100 Naively, I would expect to see: pushl %ebp movl%esp, %ebp subl$X, %esp leave ret Instead

Purpose of GCC Stack Padding?

2008-12-16 Thread Andrew Tomazos
I've been studying the x86 compiled form of the following function: void function() { char buffer[X]; } where X = 0, 1, 2 .. 100 Naively, I would expect to see: pushl %ebp movl%esp, %ebp subl$X, %esp leave ret Instead, the stack appears to b

Re: Various memory sizes

2008-12-16 Thread Michael Meissner
On Mon, Dec 15, 2008 at 04:17:34PM -0500, gobaan_raveend...@amis.com wrote: > > Hello Everyone, > > I am working on an architecture with multiple types of memory and I am > wondering about memory allocation. For the purpose of this explaination, > we'll assume I am working with an embedded proces

[avr]: potential runtime bug in insn andsi3?

2008-12-16 Thread Georg-Johann Lay
Hi, ./gcc/config/avr/avr.md defines andsi3 as follows: (define_insn "andsi3" [(set (match_operand:SI 0 "register_operand" "=r,d") (and:SI (match_operand:SI 1 "register_operand" "%0,0") (match_operand:SI 2 "nonmemory_operand" "r,i")))] "" "*{ if (which_alternative

Re: no conversion from char[] to char* on function calls under circumstances [was: A bug?]

2008-12-16 Thread Andrew Pinski
On Tue, Dec 16, 2008 at 10:41 AM, Jan Engelhardt wrote: > Is not this a use of an rvalue array too?: >printf("%p\n", (struct { char x[20]; }){{"Hello"}}.x); No, compound literals are always lvalues in C99. Thanks, Andrew Pinski

Re: no conversion from char[] to char* on function calls under circumstances [was: A bug?]

2008-12-16 Thread Jan Engelhardt
On Tuesday 2008-12-16 18:43, Michel Van den Bergh wrote: > Andrew Haley wrote: >> Andrew Thomas Pinski wrote: >> >> > C++98 is not C99 :) there is no rvalue to lvalue conversion for rvalue >> > arrays in C++98. Also this code is still undefined C99 but will most >> > likely become valid C1x. >>

Re: no conversion from char[] to char* on function calls under circumstances [was: A bug?]

2008-12-16 Thread Andrew Pinski
On Tue, Dec 16, 2008 at 9:43 AM, Michel Van den Bergh wrote: > Andrew Haley wrote: >> >> Andrew Thomas Pinski wrote: >> >>> >>> C++98 is not C99 :) there is no rvalue to lvalue conversion for rvalue >>> arrays in C++98. Also this code is still undefined C99 but will most >>> likely become valid C1

Re: no conversion from char[] to char* on function calls under circumstances [was: A bug?]

2008-12-16 Thread Michel Van den Bergh
Andrew Haley wrote: Andrew Thomas Pinski wrote: C++98 is not C99 :) there is no rvalue to lvalue conversion for rvalue arrays in C++98. Also this code is still undefined C99 but will most likely become valid C1x. Ah, it's an rvalue array. Good point. Ok now I understand. I assume t

Re: no conversion from char[] to char* on function calls under circumstances [was: A bug?]

2008-12-16 Thread Dennis Clarke
> > On Tuesday 2008-12-16 17:05, Michel Van den Bergh wrote: > >> Hi, >> >> The following program segfaults when compiled with gcc >> but runs fine when compiled with g++ or icc (the intel C compiler) >> >> #include >> struct Hello { >> char world[20]; >> }; >> struct Hello s(){ >> st

Re: no conversion from char[] to char* on function calls under circumstances [was: A bug?]

2008-12-16 Thread Andrew Haley
Andrew Thomas Pinski wrote: > C++98 is not C99 :) there is no rvalue to lvalue conversion for rvalue > arrays in C++98. Also this code is still undefined C99 but will most > likely become valid C1x. Ah, it's an rvalue array. Good point. > Sent from my iPhone Advertising on gcc list. Dear me...

Re: A bug?

2008-12-16 Thread Andrew Haley
Sebastian Redl wrote: > Michel Van den Bergh wrote: >> That's strange. When I try to compile this with gcc 4.3.2 on Ubuntu >> 8.10 (Intel core2 duo) >> I get >> >> stest.c: In function ‘main’: >> stest.c:13: warning: format ‘%s’ expects type ‘char *’, but argument 2 >> has type ‘char[20]’ >> >> The

Re: A bug

2008-12-16 Thread Michel Van den Bergh
The C standard says no such thing; only integer promotions are performed. (See 6.5.2.2 of the C99 final draft.) Ok one more question. Why does this not give a warning then (and runs fine)? #include struct Hello { char world[20]; }; struct Hello s(){ struct Hello r; r.wor

Re: A bug?

2008-12-16 Thread Jan Engelhardt
On Tuesday 2008-12-16 18:01, Sebastian Redl wrote: > Michel Van den Bergh wrote: >> That's strange. When I try to compile this with gcc 4.3.2 on Ubuntu 8.10 >> (Intel core2 duo) >> I get >> >> stest.c: In function ‘main’: >> stest.c:13: warning: format ‘%s’ expects type ‘char *’, but argument 2 ha

Re: no conversion from char[] to char* on function calls under circumstances [was: A bug?]

2008-12-16 Thread Andrew Thomas Pinski
C++98 is not C99 :) there is no rvalue to lvalue conversion for rvalue arrays in C++98. Also this code is still undefined C99 but will most likely become valid C1x. Sent from my iPhone On Dec 16, 2008, at 8:45 AM, Jan Engelhardt wrote: On Tuesday 2008-12-16 17:05, Michel Van den Bergh wr

Re: A bug?

2008-12-16 Thread Sebastian Redl
Michel Van den Bergh wrote: That's strange. When I try to compile this with gcc 4.3.2 on Ubuntu 8.10 (Intel core2 duo) I get stest.c: In function ‘main’: stest.c:13: warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘char[20]’ The resulting binary does not segfault but prin

Re: no conversion from char[] to char* on function calls under circumstances [was: A bug?]

2008-12-16 Thread Michel Van den Bergh
Ok thanks for the clear explanation! Not being able to threat char[] as a string is rather shocking to me though. Regards, Michel

Fwd: A bug?

2008-12-16 Thread Alexey Salmin
2008/12/16 Dennis Clarke : > >> Hi, >> >> The following program segfaults when compiled with gcc >> but runs fine when compiled with g++ or icc (the intel C compiler) >> >> #include >> struct Hello { >> char world[20]; >> }; >> struct Hello s(){ >> struct Hello r; >> r.worl

Re: A bug?

2008-12-16 Thread Michel Van den Bergh
That's strange. When I try to compile this with gcc 4.3.2 on Ubuntu 8.10 (Intel core2 duo) I get stest.c: In function ‘main’: stest.c:13: warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘char[20]’ The resulting binary does not segfault but prints garbage (probably uniniti

Re: no conversion from char[] to char* on function calls under circumstances [was: A bug?]

2008-12-16 Thread Jan Engelhardt
On Tuesday 2008-12-16 17:05, Michel Van den Bergh wrote: > Hi, > > The following program segfaults when compiled with gcc > but runs fine when compiled with g++ or icc (the intel C compiler) > > #include > struct Hello { > char world[20]; > }; > struct Hello s(){ > struct Hello r; >

Re: A bug?

2008-12-16 Thread Dennis Clarke
> Hi, > > The following program segfaults when compiled with gcc > but runs fine when compiled with g++ or icc (the intel C compiler) > > #include > struct Hello { > char world[20]; > }; > struct Hello s(){ > struct Hello r; > r.world[0]='H'; > r.world[1]='\0'; >

A bug?

2008-12-16 Thread Michel Van den Bergh
Hi, The following program segfaults when compiled with gcc but runs fine when compiled with g++ or icc (the intel C compiler) #include struct Hello { char world[20]; }; struct Hello s(){ struct Hello r; r.world[0]='H'; r.world[1]='\0'; return r; } int main(){

Re: gcc-4.3.2 native build error

2008-12-16 Thread Ian Lance Taylor
Chandra Prakash Garg writes: > checking for > i686-pc-linux-gnu-gcc... > /home/abhijitd/gcc/gcc-4.3.2/host-i686-pc-linux-gnu/gcc/xgcc > -B/home/abhijitd/gcc/gcc-4.3.2/host-i686-pc-linux-gnu/gcc/ > -B/home/abhijitd/gcc/gcc-4.3.2/i686-pc-linux-gnu/bin/ > -B/home/abhijitd/gcc/gcc-4.3.2/i686-pc-linu

Re: gcc-4.3.2 generated "vmhraddshs" instruction when I compiled with -mcpu=8540

2008-12-16 Thread Nathan Froyd
On Tue, Dec 16, 2008 at 12:28:10PM +0700, Ha Luong wrote: > I used gcc-4.3.2 to compile the c source(*) and it generated > "vmhraddshs" instruction when I compiled with -mcpu=8540. > 000103A4: 11EB0321 vmhraddshs vr15,vr11,vr0,vr12 You are running into the problem that the Altivec and SPE opcode

Re: reducing stack size by breaking SPARC ABI for OS-less environments

2008-12-16 Thread Eric Botcazou
> As I have no window overflow trap handler the space reserved on the > stack for saving in and local registers is just wasted memory. Is there > any way I can reclaim this space by forcing the compiler to not honour > the standard SPARC ABI? No, there isn't, unless you want to hack the compiler.