From noorez.mailist.gcc@gmail.com Thu Mar 1 03:53:00 2007 From: noorez.mailist.gcc@gmail.com (Noorez Kassam) Date: Thu, 01 Mar 2007 03:53:00 -0000 Subject: Missing file in GCC build Message-ID: <52686be80702281953v4691ca22l8f174a3716b9d44d@mail.gmail.com> I am attempting to build the gcc system however, i received the following error on the 'make' stage of the build. Here is a snippet from the build progress.. /bin/sh: cannot open kinds.h: No such file make[2]: *** [kinds.inc] Error 2 make[2]: Leaving directory `/home/noorez/Desktop/objdir/i686-pc-linux-gnu/libgfortran' make[1]: *** [all-target-libgfortran] Error 2 make[1]: Leaving directory `/home/noorez/Desktop/objdir' make: *** [all] Error 2 I have all the perquisites for building gcc listed on the gcc site: http://gcc.gnu.org/install/prerequisites.html and I am quite sure that I unpacked all files that were necessary for the build. Is there anything that I missed? From tprince@myrealbox.com Thu Mar 1 05:14:00 2007 From: tprince@myrealbox.com (Tim Prince) Date: Thu, 01 Mar 2007 05:14:00 -0000 Subject: Missing file in GCC build In-Reply-To: <52686be80702281953v4691ca22l8f174a3716b9d44d@mail.gmail.com> References: <52686be80702281953v4691ca22l8f174a3716b9d44d@mail.gmail.com> Message-ID: <45E6612E.2030105@myrealbox.com> Noorez Kassam wrote: > I am attempting to build the gcc system however, i received the > following error on the 'make' stage of the build. Here is a snippet > from the build progress.. > > /bin/sh: cannot open kinds.h: No such file > make[2]: *** [kinds.inc] Error 2 > make[2]: Leaving directory > `/home/noorez/Desktop/objdir/i686-pc-linux-gnu/libgfortran' > make[1]: *** [all-target-libgfortran] Error 2 > If you search the archives of the gfortran mail list, you should see discussion of several ways in which generation of kinds.h for libgfortran has been seen to fail. Almost certainly, this is a consequence of a problem which should have been indicated earlier in your build. Correctly updating your gmp and mpfr installations is among the necessary steps. Among other things, the details depend on which version of gcc it is, which you didn't care to reveal, and I would as soon not hear about. From dreams_arpit@yahoo.co.in Thu Mar 1 07:38:00 2007 From: dreams_arpit@yahoo.co.in (arpit jain) Date: Thu, 01 Mar 2007 07:38:00 -0000 Subject: Building cross compiler Message-ID: <510582.99771.qm@web8409.mail.in.yahoo.com> Hiiiiiiiii Can anyone please help me regarding building gcc-3.x as a cross compiler for embedded targets?? I have build binutils package for cross linker and cross assembler. 1. Do i need to configure the gcc by giving -with-as and --with-ld cross assembler and cross linker or should I configure it with -with-gnu-ld and --with-gnu-as? Thanks Arpit __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/ From Walter.Kasberg@web.de Thu Mar 1 08:20:00 2007 From: Walter.Kasberg@web.de (Walter Kasberg) Date: Thu, 01 Mar 2007 08:20:00 -0000 Subject: How to pass function names as parameter? In-Reply-To: References: Message-ID: <200703010920.28540.Walter.Kasberg@web.de> On Wednesday 28 February 2007 19:48, John Love-Jensen wrote: > Hi Walter, > > This isn't doing what you think it is doing: > > rufen ( feins () ); > rufen ( fzwei () ); > > You probably wanted: > > rufen ( feins ); > rufen ( fzwei ); > > HTH, > --Eljay I tried it, but it too does not work. There is still the memory address error. Walter From Walter.Kasberg@web.de Thu Mar 1 08:28:00 2007 From: Walter.Kasberg@web.de (Walter Kasberg) Date: Thu, 01 Mar 2007 08:28:00 -0000 Subject: How to pass function names as parameter? In-Reply-To: References: Message-ID: <200703010928.36051.Walter.Kasberg@web.de> On Wednesday 28 February 2007 19:48, John Love-Jensen wrote: > Hi Walter, > > This isn't doing what you think it is doing: > > rufen ( feins () ); > rufen ( fzwei () ); > > You probably wanted: > > rufen ( feins ); > rufen ( fzwei ); > > HTH, > --Eljay sorry, discard my previous mail. I made a mistake: I changed the code but did not save the changes and compiled the old version. Thanks, you are right, now it works. Walter From ext@sidvind.com Thu Mar 1 09:18:00 2007 From: ext@sidvind.com (David Sveningsson) Date: Thu, 01 Mar 2007 09:18:00 -0000 Subject: Variadic macros and commas Message-ID: <45E69A48.3070903@sidvind.com> Hi, I have a function that takes any number of pointers and creates an array (an array class) and puts the pointers in it. This is the prototype: Array *ar(Object *first = NULL, ...); It keeps adding pointers until NULL is reached, thus the argument list must be ended with NULL. If 'first' is NULL an empty array is returned. However too often NULL is forgotten causing nasty bugs. So what I want to do is to create a macro that adds NULL after the varadic arguments. #define ar(...) real_ar( __VA_ARGS__, NULL ) The above works as long as we have arguments but using ar() expands to real_ar( , NULL ) which is a compiler error. Using ## with __VA_ARGS__ doesn't seem to work in this case. The manual doesn't say this but it seems like it only works when the comma is placed before __VA_ARGS. I got the same error at least. So, is there a way to do this? Or maybe I am doing it all wrong, maybe there is a better way. -- //*David Sveningsson [eXt]* Freelance coder | Game Development Student http://sidvind.com Thou shalt make thy program's purpose and structure clear to thy fellow man by using the One True Brace Style, even if thou likest it not, for thy creativity is better used in solving problems than in creating beautiful new impediments to understanding. From osv@javad.com Thu Mar 1 11:22:00 2007 From: osv@javad.com (Sergei Organov) Date: Thu, 01 Mar 2007 11:22:00 -0000 Subject: better load/store scheduling References: <96CDC40E4321F84FA0FB83A1EF2A422864B93F@Hermes.shaktisystems.com> Message-ID: "Ben Cheng" writes: > I am trying to tune the performance of hand-unrolled code. I was > wondering what cmd-line options should I specify in order to get h[i+1] > loaded before the store to g[i]: > > > Code: > > void foo(int * __restrict g, int * __restrict h) > { > int i; > for (i = 0; i < 4096; i+=2) { > g[i] = h[i] + 10; > g[i+1] = h[i+1] + 10; > } > } Use temporaries: void foo(int * __restrict g, int * __restrict h) { int i; for (i = 0; i < 4096; i+=2) { int a = h[i]; int b = h[i+1]; g[i] = a + 10; g[i+1] = b + 10; } } > > Command line: > > gcc-4.0.2 -O3 loop.c -fargument-noalias-global -fstrict-aliasing -S > loop.s > > Assembly code of the loop body: > > .L2: > leal 0(,%ebx,4), %eax > leal (%eax,%esi), %ecx > leal (%edi,%eax), %eax > movl -8(%ecx), %edx // = h[i] > addl $10, %edx // + 10 > movl %edx, -8(%eax) // g[i] = > movl -4(%ecx), %edx // = h[i+1] > addl $10, %edx // + 10 > movl %edx, -4(%eax) // g[i+1] = > addl $2, %ebx > cmpl $4098, %ebx > jne .L2 With gcc 4.0.4, it gives: .L2: leal 0(,%ebx,4), %edx addl $2, %ebx leal (%esi,%edx), %eax addl %edi, %edx movl -4(%eax), %ecx movl -8(%eax), %eax addl $10, %ecx addl $10, %eax cmpl $4098, %ebx movl %eax, -8(%edx) movl %ecx, -4(%edx) jne .L2 With gcc 4.1.2, it gives: .L2: movl -4(%ebx,%ecx,4), %eax movl -8(%ebx,%ecx,4), %edx addl $10, %eax addl $10, %edx movl %edx, -8(%esi,%ecx,4) movl %eax, -4(%esi,%ecx,4) addl $2, %ecx cmpl $4098, %ecx jne .L2 -- Sergei. From monica@natalnet.br Thu Mar 1 12:18:00 2007 From: monica@natalnet.br (=?iso-8859-1?Q?Monica_Magalh=E3es_Pereira?=) Date: Thu, 01 Mar 2007 12:18:00 -0000 Subject: Basic blocks and profiling information Message-ID: Hi, I would like to know if there is any command which I can see the basic blocks show in profiling information. I am using an older version of gcc, because I need to see the bb.out and analyze the profiling information about the basic blocks. But now, I need to see the basic blocks. Is there any command that I can generate these basic blocks? Thanks Monica From dreams_arpit@yahoo.co.in Thu Mar 1 12:40:00 2007 From: dreams_arpit@yahoo.co.in (arpit jain) Date: Thu, 01 Mar 2007 12:40:00 -0000 Subject: building gcc cross compiler Message-ID: <647496.70499.qm@web8402.mail.in.yahoo.com> Hiiiiiii I am trying to build gcc-3.x cross-compiler for Ada language.I have successfully build binutils package for the same target. Now I am trying to configure the gcc by giving the configure command as: /configure --prefix=/home/compiler/arpitj/cross/install/ --host=i686-pc-linux-gnu --enable-obsolete --enable-languages="c,ada" --target=i***-unknown-coff --with-/compiler/arpitj/binutils/binutil_build/install/bin/ --with-as=/home/compiler/arpitj/binutils/binutil_build/install/bin/ --with-ld=/home/compiler/arpitj/binutils/binutil_build/install/bin/ --with-ranlib=/home/compiler/arpitj/binutils/binutil_build/install/bin/ I am giving absolute path of cross-assembler,linker,archiver,ranlib. Can anyone please tell me whether it is correct? bcoz I m getting error like: installation problem, cannot exec `/home/compiler/arpitj/binutils/binutil_build/install/bin/': Permission denied Thanks Arpit __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/ From me@rupey.net Thu Mar 1 13:33:00 2007 From: me@rupey.net (Rupert Wood) Date: Thu, 01 Mar 2007 13:33:00 -0000 Subject: building gcc cross compiler In-Reply-To: <647496.70499.qm@web8402.mail.in.yahoo.com> References: <647496.70499.qm@web8402.mail.in.yahoo.com> Message-ID: <017e01c75c06$26768850$736398f0$@net> arpit jain wrote: > --with-as=/home/compiler/arpitj/binutils/binutil_build/install/bin/ : > I am giving absolute path of cross-assembler,linker,archiver,ranlib. > Can anyone please tell me whether it is correct? > bcoz I m getting error like: > > installation problem, cannot exec > `/home/compiler/arpitj/binutils/binutil_build/install/bin/': > Permission denied It wants the complete path of the executable, not the path containing the executable, i.e. --with-as=/home/compiler/arpitj/binutils/binutil_build/install/bin/as --with-ld=/home/compiler/arpitj/binutils/binutil_build/install/bin/ld etc. Rup. ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ From christian.convey@gmail.com Thu Mar 1 17:02:00 2007 From: christian.convey@gmail.com (Christian Convey) Date: Thu, 01 Mar 2007 17:02:00 -0000 Subject: Is there a free substitute for Flexilint? In-Reply-To: References: <6addebae0702281454l54509cf1k70834f4eeef215c@mail.gmail.com> Message-ID: <6addebae0703010901y7bc30e0dla90c85ea6c010371@mail.gmail.com> Thanks. So your basic point is use "-Wall", and filter as needed? If so, do you have any sense of how big the gap is between that approach and what FlexiLint does for me? (I realize this is a hard thing to quantify.) - Christian On 2/28/07, John (Eljay) Love-Jensen wrote: > Hi Christian, > > > Is there any free, or close-to-free, tool that you can recommend? > > I recommend GCC. > > q.v. http://gcc.gnu.org/ml/gcc-help/2007-01/msg00172.html (the part where I talk about lint and GCC). > > HTH, > --Eljay > From fdc@cp.dias.ie Thu Mar 1 17:08:00 2007 From: fdc@cp.dias.ie (Fabio De Colle) Date: Thu, 01 Mar 2007 17:08:00 -0000 Subject: g77 question. Message-ID: <45E70899.8060509@cp.dias.ie> Hi!, I compile this small code with g77 (gcc-3.4) --> no error. But when I run the code I have a "Segmentation fault". Please someone can tell me where is the error? Please note: commenting the call to the subroutine s2 --> no segmentation fault! Cheers Fabio program test parameter(n=3000000) call s1(n) stop end subroutine s1(n) integer m1(n) call s2 return end subroutine s2 return end From terry@chem.gu.se Thu Mar 1 17:13:00 2007 From: terry@chem.gu.se (Terry Frankcombe) Date: Thu, 01 Mar 2007 17:13:00 -0000 Subject: Compiling gcc-4.2 on 64 bit Ubuntu In-Reply-To: <1172602042.5222.21.camel@fkpc167> References: <1172602042.5222.21.camel@fkpc167> Message-ID: <1172769184.5165.2.camel@fkpc167> [Posted for completeness] After no useful help here or through the Ubuntu forums, I worked it out. Solution was simple: set CFLAGS to -m64 before configure. Strange, as the previously installed gcc produced 64 bit execs by default. On Tue, 2007-02-27 at 19:47 +0100, Terry Frankcombe wrote: > Hi folks > > I've run into trouble trying to compile gcc 4.2 (gcc-4.2-20070221) on an > amd64 machine running 64 bit Ubuntu. I configure with: > > ./configure --disable-multilibs --enable-languages=fortran > > then doing a make gets as far as compiling ../.././gcc/crtstuff.c in > gcc-4.2-20070221/host-x86_64-unknown-linux-gnu/gcc. /usr/include/gnu/stubs.h is included which then tries to include gnu/stubs-32.h, which doesn't exist, rather than gnu/stubs-64.h, which does. Thus apparently __WORDSIZE is defined as 32. > > Now Ubuntu has 64 bit libraries in /usr/lib and 32 bit libraries > in /usr/lib32 (with a simlink from /usr/lib64 to /usr/lib). > > Any ideas about how I can coerce configure to set things up correctly to > build a 64 bit compiler? > > Ciao > Terry > From me22.ca@gmail.com Thu Mar 1 17:14:00 2007 From: me22.ca@gmail.com (me22) Date: Thu, 01 Mar 2007 17:14:00 -0000 Subject: Is there a free substitute for Flexilint? In-Reply-To: <6addebae0703010901y7bc30e0dla90c85ea6c010371@mail.gmail.com> References: <6addebae0702281454l54509cf1k70834f4eeef215c@mail.gmail.com> <6addebae0703010901y7bc30e0dla90c85ea6c010371@mail.gmail.com> Message-ID: On 3/1/07, Christian Convey wrote: > Thanks. So your basic point is use "-Wall", and filter as needed? > -Wall doesn't get you everything. You'll likely want -Wextra and some specialty ones too. > If so, do you have any sense of how big the gap is between that > approach and what FlexiLint does for me? (I realize this is a hard > thing to quantify.) > I've usually been fairly impressed with GCC's warnings, but afaik it doesn't do much looking for stylistic things. Of course, the existance of -Weffc++ suggests that it might be there if you find the right argument, so you might be pleasantly surprised. YYMV, Scott McMurray From nu2007@gmail.com Thu Mar 1 18:05:00 2007 From: nu2007@gmail.com (n u) Date: Thu, 01 Mar 2007 18:05:00 -0000 Subject: Compilation Error on AIX 5.3 with g++ 3.3.2 In-Reply-To: References: Message-ID: Hi, i have a simple makefile which looks like this: CArchive: CFileRw.o CArchive.o CMain.o g++ -o CArchive CFileRw.o CArchive.o CMain.o 3rdparty_1.a CFileRw.o: CFileRw.cxx HCommon.h g++ -c CFileRw.cxx CArchive.o: CArchive.cxx HCommon.h g++ -c CArchive.cxx CMain.o: CMain.cxx HCommon.h g++ -c CMain.cxx clean: rm CArchive CFileRw.o CArchive.o CMain.o When i try complining this on AIX 5.3 with g++ 3.3.2. It gives the below mentioned error g++ -o CArchive CFileRw.o CArchive.o CMain.o 3rdparty_1.a ld: 0711-447 SEVERE ERROR: Shared object 3rdparty_1.a The .loader section has been truncated. The object is being ignored. collect2: ld returned 12 exit status make: 1254-004 The error code from the last command is 1. If somone can point out as to whats going wrong here, that would be nice. thanks, From eljay@adobe.com Thu Mar 1 18:10:00 2007 From: eljay@adobe.com (John (Eljay) Love-Jensen) Date: Thu, 01 Mar 2007 18:10:00 -0000 Subject: Is there a free substitute for Flexilint? References: <6addebae0703010901y7bc30e0dla90c85ea6c010371@mail.gmail.com> Message-ID: Hi Christian, > So your basic point is use "-Wall", and filter as needed? Yep. Hopefully the filter part won't be necessary. The warning flags I use: http://gcc.gnu.org/ml/gcc-help/2007-01/msg00187.html http://gcc.gnu.org/ml/gcc-help/2006-09/msg00118.html > If so, do you have any sense of how big the gap is between that approach and what FlexiLint does for me? (I realize this is a hard thing to quantify.) Sorry, I'm not sure how big the gap is. I haven't used Gimpel's software for a long while now (almost two decades ago). Sincerely, --Eljay From iant@google.com Thu Mar 1 18:10:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Thu, 01 Mar 2007 18:10:00 -0000 Subject: Variadic macros and commas In-Reply-To: <45E69A48.3070903@sidvind.com> References: <45E69A48.3070903@sidvind.com> Message-ID: David Sveningsson writes: > It keeps adding pointers until NULL is reached, thus the argument list > must be ended with NULL. If 'first' is NULL an empty array is returned. > However too often NULL is forgotten causing nasty bugs. You may find the sentinel function attribute to be useful here. It is a gcc extension which adds a warnings if the function is called without a trailing NULL. Ian From r.atwood@imperial.ac.uk Thu Mar 1 19:07:00 2007 From: r.atwood@imperial.ac.uk (Atwood, Robert C) Date: Thu, 01 Mar 2007 19:07:00 -0000 Subject: Comparison failure Comiling 4.2 svn on RedHat EL-3 In-Reply-To: Message-ID: <2CB39EAF0E0EFF498ADEDA636B8C999F04C3909A@icex1.ic.ac.uk> Suppose for some reason I wish not to install Red Hat 4 or some other system, so the first obvious solution is not available. I tried building 4.2 from svn on a Red Hat EL3 (Dell PowerEdge 2600 Intel P4 2.8) and obtained a comparison error between stage2 and stage3. Any help, or pointers to other info I missed finding? Thanks. Robert Here's some info about the version and system: [root@xe01 gcc]# svnversion . 122433M I made the following change inspired by googleing the previous mailing list entries, otherwise it would not get anywhere at all: [root@xe01 gcc]# svnversion . 122433M [root@xe01 gcc]# svn status M gcc/config/host-linux.c [root@xe01 gcc]# svn diff gcc/config/host-linux.c Index: gcc/config/host-linux.c =================================================================== --- gcc/config/host-linux.c (revision 122433) +++ gcc/config/host-linux.c (working copy) @@ -23,10 +23,12 @@ #include "coretypes.h" #include #include +#define SSIZE_MAX LONG_MAX /* HERE I changed the file */ #include "hosthooks.h" #include "hosthooks-def.h" For simplicity...'c' only... configured with: ../gcc/configure --prefix=/usr/local/encap/gcc-4.2.0.0 --program-suffix=v42 --enable-languages=c Gcc version: gcc --version gcc (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-56) Error received: Comparing stages 2 and 3 warning: ./cc1-checksum.o differs Bootstrap comparison failure! ./cfg.o differs ./cfgloopanal.o differs ./loop-iv.o differs ./value-prof.o differs ./predict.o differs ./profile.o differs ./ipa-inline.o differs make[2]: *** [compare] Error 1 make[2]: Leaving directory `/home/sources/gcc_source/gcc_42_svn/build' make[1]: *** [stage3-bubble] Error 2 make[1]: Leaving directory `/home/sources/gcc_source/gcc_42_svn/build' make: *** [all] Error 2 Processor /proc/cpuinfo: processor : 0 vendor_id : GenuineIntel cpu family : 15 model : 2 model name : Intel(R) Xeon(TM) CPU 2.80GHz stepping : 7 cpu MHz : 2791.281 cache size : 512 KB fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 2 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe cid bogomips : 5588.14 From ext@sidvind.com Thu Mar 1 19:36:00 2007 From: ext@sidvind.com (ext@sidvind.com) Date: Thu, 01 Mar 2007 19:36:00 -0000 Subject: Variadic macros and commas In-Reply-To: References: <45E69A48.3070903@sidvind.com> Message-ID: <2191.83.209.20.148.1172777799.squirrel@mail.sidvind.com> > David Sveningsson writes: > >> It keeps adding pointers until NULL is reached, thus the argument list >> must be ended with NULL. If 'first' is NULL an empty array is returned. >> However too often NULL is forgotten causing nasty bugs. > > You may find the sentinel function attribute to be useful here. It is > a gcc extension which adds a warnings if the function is called > without a trailing NULL. > > Ian > Yes, I tried the sentinel attribute but since it's valid to call the function without any arguments at all (the first argument default to NULL) the sentinel warns that not enough arguments has been passed. From r.atwood@imperial.ac.uk Thu Mar 1 20:00:00 2007 From: r.atwood@imperial.ac.uk (Atwood, Robert C) Date: Thu, 01 Mar 2007 20:00:00 -0000 Subject: Is there a free substitute for Flexilint? In-Reply-To: Message-ID: <2CB39EAF0E0EFF498ADEDA636B8C999F04C3909D@icex1.ic.ac.uk> At risk of being off topic... what about splint www.splint.org? I've not delved into all its features ... it's GPL distributable. I'm not sure how well it handles c++ versus c code though. From christian.convey@gmail.com Thu Mar 1 21:05:00 2007 From: christian.convey@gmail.com (Christian Convey) Date: Thu, 01 Mar 2007 21:05:00 -0000 Subject: Is there a free substitute for Flexilint? In-Reply-To: References: <6addebae0702281454l54509cf1k70834f4eeef215c@mail.gmail.com> Message-ID: <6addebae0703011304r5740a7e3g27e692220f0028f4@mail.gmail.com> Thanks. So your basic point is use "-Wall", and filter as needed? If so, do you have any sense of how big the gap is between that approach and what FlexiLint does for me? (I realize this is a hard thing to quantify.) - Christian On 2/28/07, John (Eljay) Love-Jensen wrote: > Hi Christian, > > > Is there any free, or close-to-free, tool that you can recommend? > > I recommend GCC. > > q.v. http://gcc.gnu.org/ml/gcc-help/2007-01/msg00172.html (the part where I talk about lint and GCC). > > HTH, > --Eljay > From bccheng@peakstreaminc.com Thu Mar 1 21:08:00 2007 From: bccheng@peakstreaminc.com (Ben Cheng) Date: Thu, 01 Mar 2007 21:08:00 -0000 Subject: better load/store scheduling Message-ID: <96CDC40E4321F84FA0FB83A1EF2A422864BA1C@Hermes.shaktisystems.com> Well, I guess the real question is how to make gcc schedule better code if loop unrolling is enabled? My original code is actually for (i = 0; i < 4096; i++) { g[i] = h[i] + 10; } After gcc unrolls the loop, the loop bodies from different iterations aren't overlapping with each other because the load from later iterations is not scheduled across earlier stores. I thought this might be due to phase ordering issues of optimization stages so I manually unroll the loop. But unfortunately I still cannot get gcc to schedule loads/stores more aggressively. Since I want gcc to unroll the loop for me, I cannot create temporaries for h[i]. Therefore I am still hoping for some magic command line options to make gcc produce better scheduling. Thanks, -Ben -----Original Message----- From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On Behalf Of Sergei Organov Sent: Thursday, March 01, 2007 3:22 AM To: gcc-help@gcc.gnu.org Subject: Re: better load/store scheduling "Ben Cheng" writes: > I am trying to tune the performance of hand-unrolled code. I was > wondering what cmd-line options should I specify in order to get h[i+1] > loaded before the store to g[i]: > > > Code: > > void foo(int * __restrict g, int * __restrict h) > { > int i; > for (i = 0; i < 4096; i+=2) { > g[i] = h[i] + 10; > g[i+1] = h[i+1] + 10; > } > } Use temporaries: void foo(int * __restrict g, int * __restrict h) { int i; for (i = 0; i < 4096; i+=2) { int a = h[i]; int b = h[i+1]; g[i] = a + 10; g[i+1] = b + 10; } } > > Command line: > > gcc-4.0.2 -O3 loop.c -fargument-noalias-global -fstrict-aliasing -S > loop.s > > Assembly code of the loop body: > > .L2: > leal 0(,%ebx,4), %eax > leal (%eax,%esi), %ecx > leal (%edi,%eax), %eax > movl -8(%ecx), %edx // = h[i] > addl $10, %edx // + 10 > movl %edx, -8(%eax) // g[i] = > movl -4(%ecx), %edx // = h[i+1] > addl $10, %edx // + 10 > movl %edx, -4(%eax) // g[i+1] = > addl $2, %ebx > cmpl $4098, %ebx > jne .L2 With gcc 4.0.4, it gives: .L2: leal 0(,%ebx,4), %edx addl $2, %ebx leal (%esi,%edx), %eax addl %edi, %edx movl -4(%eax), %ecx movl -8(%eax), %eax addl $10, %ecx addl $10, %eax cmpl $4098, %ebx movl %eax, -8(%edx) movl %ecx, -4(%edx) jne .L2 With gcc 4.1.2, it gives: .L2: movl -4(%ebx,%ecx,4), %eax movl -8(%ebx,%ecx,4), %edx addl $10, %eax addl $10, %edx movl %edx, -8(%esi,%ecx,4) movl %eax, -4(%esi,%ecx,4) addl $2, %ecx cmpl $4098, %ecx jne .L2 -- Sergei. From vmakarov@redhat.com Thu Mar 1 22:12:00 2007 From: vmakarov@redhat.com (Vladimir Makarov) Date: Thu, 01 Mar 2007 22:12:00 -0000 Subject: better load/store scheduling In-Reply-To: <96CDC40E4321F84FA0FB83A1EF2A422864BA1C@Hermes.shaktisystems.com> References: <96CDC40E4321F84FA0FB83A1EF2A422864BA1C@Hermes.shaktisystems.com> Message-ID: <45E74FCE.6010605@redhat.com> Ben Cheng wrote: >Well, I guess the real question is how to make gcc schedule better code >if loop unrolling is enabled? > >My original code is actually > > for (i = 0; i < 4096; i++) { > g[i] = h[i] + 10; > } > >After gcc unrolls the loop, the loop bodies from different iterations >aren't overlapping with each other because the load from later >iterations is not scheduled across earlier stores. I thought this might >be due to phase ordering issues of optimization stages so I manually >unroll the loop. But unfortunately I still cannot get gcc to schedule >loads/stores more aggressively. > >Since I want gcc to unroll the loop for me, I cannot create temporaries >for h[i]. Therefore I am still hoping for some magic command line >options to make gcc produce better scheduling. > > > There is no such magic option. The problem is not in the scheduler itself. It can be done when/if we have more accurate aliasing info on rtl level. Another problem is that even if we have more accurate alias analysis, it might be still impossible to move ld/st after RA worked. Insn scheduling before RA is switched off for x86, x86_64 because of a bug which finally occurs in reload when the reload can not find a hard register for an insn operand. To get rid off this bug, insn scheduler should be register pressure sensitive. Also It is better to use software pipelining for this loop. You can try -fmodulo-sched and see what happens. It might work. From finchlady888@hotmail.com Fri Mar 2 02:29:00 2007 From: finchlady888@hotmail.com (funchlady) Date: Fri, 02 Mar 2007 02:29:00 -0000 Subject: x86_64-pc-mingw32 Message-ID: <9262940.post@talk.nabble.com> I built a cross compiler, i.e., x86_64-pc-mingw32-gcc (release 4.1.2, I modified ASM when necessary) on a x86_64-linux, and then I applied x86_64-pc-mingw32-gcc to generate binaries of w32api (3.8) and mingw-runtime (3.11, I modified ASM when necessary). Reference is inconsistent. For example, the WINAPI EnterCriticalSection is labeled as EnterCriticalSection@4 in library of w32api, but is labeled as EnterCriticalSection@8 in runtime library. It seems w32api is in 32-bit, and runtime is in 64-bit. Linker x86_64-pc-mingw32-ld fails to find the references. Is there any way to resolve it? Thank you. So far, the corss compiler I built can generate object code and built library, but cannot build windows executable. Thank you again. -- View this message in context: http://www.nabble.com/x86_64-pc-mingw32-tf3331275.html#a9262940 Sent from the gcc - Help mailing list archive at Nabble.com. From dreams_arpit@yahoo.co.in Fri Mar 2 06:39:00 2007 From: dreams_arpit@yahoo.co.in (arpit jain) Date: Fri, 02 Mar 2007 06:39:00 -0000 Subject: cross compiler building Message-ID: <657948.3687.qm@web8405.mail.in.yahoo.com> Hiiiiiii, I tried building gcc-3.x cross compiler but i am getting some error.My procedure was: 1.Build and install binutils-2.10 for the same target in the same directory where I will install gcc. The above step was done successfully as I have got binaries for the cross assembler,linker,archiver etc. in the same directory. 2.When I build (configure) gcc using the same target and by giving absolute path of these cross assembler,linker etc,I got some error like: i***-unknown-coff-ar: Command not found. Can anyone please tell me wheteher my procedure is correct nd if so,then where is the problem?? Thanks Arpit __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/ From me@rupey.net Fri Mar 2 10:12:00 2007 From: me@rupey.net (Rupert Wood) Date: Fri, 02 Mar 2007 10:12:00 -0000 Subject: x86_64-pc-mingw32 In-Reply-To: <9262940.post@talk.nabble.com> References: <9262940.post@talk.nabble.com> Message-ID: <03ff01c75cb3$469a57d0$d3cf0770$@net> funchlady wrote: > I built a cross compiler, i.e., x86_64-pc-mingw32-gcc (release > 4.1.2, I modified ASM when necessary) on a x86_64-linux, and then I > applied x86_64-pc-mingw32-gcc to generate binaries of w32api (3.8) > and mingw-runtime (3.11, I modified ASM when necessary). If you're trying to port mingw to x86_64 you should probably talk to this guy http://gcc.gnu.org/ml/gcc/2007-02/msg00545.html if you haven't already. At first glance the problem is that export symbols in the .def files are wrong when you're compiling 64-bit - they're hard-coded with the argument length (as per stdcall) for 32-bit pointers. There's a further problem in that the w32api headers are missing some uses of DWORD_PTR so they won't compile correctly for 64-bit anyway or at least some of the structures will be wrong. I guess you'll need to fix all of this: you'll have to audit the headers against Microsoft's own platform SDK http://www.microsoft.com/msdownload/platformsdk/sdkupdate/ (old link but redirects to the newer, much longer one) for LONG_PTR, ULONG_PTR and DWORD_PTR - and possibly some more similar types, I can't remember - rebuild w32api and then check the symbols in the .a files against the .def files to see which ones you'll need to edit for 64-bit. Or you could try Microsoft's own 64-bit import libraries from the platform SDK download: it is a free download but might be awkward to extract if you don't have a Windows machine handy: I can't swear that Microsoft's .libs are compatible with mingw's linker, but I can't think of a good reason why not. Good luck! Rup. ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ From Walter.Kasberg@web.de Fri Mar 2 10:16:00 2007 From: Walter.Kasberg@web.de (Walter Kasberg) Date: Fri, 02 Mar 2007 10:16:00 -0000 Subject: g77 question. In-Reply-To: <45E70899.8060509@cp.dias.ie> References: <45E70899.8060509@cp.dias.ie> Message-ID: <200703021116.35880.Walter.Kasberg@web.de> On Thursday 01 March 2007 18:08, Fabio De Colle wrote: > Hi!, > > I compile this small code with g77 (gcc-3.4) --> no error. But when I > run the code I have a > "Segmentation fault". > Please someone can tell me where is the error? > Please note: commenting the call to the subroutine s2 --> no > segmentation fault! > Cheers > > Fabio > > > > program test > parameter(n=3000000) > call s1(n) > stop > end > > subroutine s1(n) > integer m1(n) > call s2 > return > end > > subroutine s2 > return > end I am not sure but suppose that could be due to possible segment limit in f77. If you ommit s2 perhaps it just fits into this limit. Perhaps you can try to put n into a common block. Maybe that could work, I tried your code with g95 (Mandrake g95-0.50-1.403_20060327.1mdv2007.0) and gcc-gfortran (Mandrake gcc-gfortran-4.1.1-3mdk). Both work. Walter From michael@unixiron.org Fri Mar 2 12:06:00 2007 From: michael@unixiron.org (Michael Kukat) Date: Fri, 02 Mar 2007 12:06:00 -0000 Subject: 8/16bit oddities on avr-gcc In-Reply-To: References: Message-ID: Hello, i'm programming a lot of AVR firmware since a while, first in pure assembler, as gcc 3.x didn't produce code i liked very much. But the 4.1.1 i'm currently using produces quite good code if you sometimes try around to get the best results (as in "i would write nearly the same in assembler"). But now, i found one strange thing where i currently can't find a workaround i really like. It's about a quite simple loop here: This is my perftest.c file: #include #include < inttypes.h> volatile uint8_t xx; void test() { uint8_t ctr; ctr = 0; do { xx = ctr; } while(++ctr < 64); } quite simple. If i compile this like the following: avr-gcc -mmcu=atmega644 -O3 -S -o - perftest.c i see that ctr is used in 16bit: ldi r24,lo8(0) ldi r25,hi8(0) .L2: sts xx,r24 adiw r24,1 cpi r24,64 cpc r25,__zero_reg__ brne .L2 /* epilogue: frame size=0 */ ret Now i tried around a bit and see the following situation: if i replace the "xx = ctr" by an __asm__("nop"), the counter is 8 bit, as it should be. If i use ctr = 64 before the loop and do while(--ctr);, the counter also is 8 bit (with xx = ctr in the loop). All experiments trying < (uint8_t) 64 and so didn't work, also != instead of < doesn't work, i can't find a "nice" way to force the counter being 8 bit when using the value within the loop. I need that loop in this way, that's why i don't use --ctr. But i found one operation, which does the same like (++ctr < 64) in my case, but doesn't create the counter in 16bit but in 8bit, as desired: (++ctr % 64). With this, the result is exactly what i want: ldi r24,lo8(0) .L2: sts xx,r24 subi r24,lo8(-(1)) cpi r24,lo8(64) brne .L2 /* epilogue: frame size=0 */ ret Is there any reason for this strange 16bit behaviour? To me, it looks like the assignemt xx = ctr seems to trigger some signed flags for the comparison, because ((++ctr & 0x7f) < 64) also produces the desired 8bit version. Might be okay in this loop, but isn't so fine if i need, say, 200 as the counter top value. What do you think about this? ...Michael From osv@javad.com Fri Mar 2 12:14:00 2007 From: osv@javad.com (Sergei Organov) Date: Fri, 02 Mar 2007 12:14:00 -0000 Subject: 8/16bit oddities on avr-gcc References: Message-ID: "Michael Kukat" writes: > Hello, > > i'm programming a lot of AVR firmware since a while, first in pure > assembler, as gcc 3.x didn't produce code i liked very much. But the > 4.1.1 i'm currently using produces quite good code if you sometimes > try around to get the best results (as in "i would write nearly the > same in assembler"). > > But now, i found one strange thing where i currently can't find a > workaround i really like. It's about a quite simple loop here: > > This is my perftest.c file: > #include > #include < inttypes.h> > > volatile uint8_t xx; > > void test() { > uint8_t ctr; > > ctr = 0; > do { > xx = ctr; > } while(++ctr < 64); Try "while((uint8_t)(++ctr) < 64)" -- Sergei. From michael@unixiron.org Fri Mar 2 12:28:00 2007 From: michael@unixiron.org (Michael Kukat) Date: Fri, 02 Mar 2007 12:28:00 -0000 Subject: Comparison In-Reply-To: References: Message-ID: Hi, 2007/3/2, John (Eljay) Love-Jensen : > Isn't the result of a comparison, such as (x < y), an int -- regardless of the types of x and y? Hm, may be. But i wonder why the variable ctr is then initialized as 16bit if just the comparison would be int. And i also assume, that while((uint8_t)(++ctr < 64)) should avoid 16bit in this case, which it doesn't. -mint8 creates lots of other problems, so i can't try this out (besides this i don't really want to use this option :) ...Michael From aph@redhat.com Fri Mar 2 12:56:00 2007 From: aph@redhat.com (Andrew Haley) Date: Fri, 02 Mar 2007 12:56:00 -0000 Subject: 8/16bit oddities on avr-gcc In-Reply-To: References: Message-ID: <17896.7917.832091.677150@zebedee.pink> Michael Kukat writes: > > i'm programming a lot of AVR firmware since a while, first in pure > assembler, as gcc 3.x didn't produce code i liked very much. But the > 4.1.1 i'm currently using produces quite good code if you sometimes > try around to get the best results (as in "i would write nearly the > same in assembler"). > > But now, i found one strange thing where i currently can't find a > workaround i really like. It's about a quite simple loop here: > > This is my perftest.c file: > #include > #include < inttypes.h> > > volatile uint8_t xx; > > void test() { > uint8_t ctr; > > ctr = 0; > do { > xx = ctr; > } while(++ctr < 64); > } > > quite simple. If i compile this like the following: > > avr-gcc -mmcu=atmega644 -O3 -S -o - perftest.c > > i see that ctr is used in 16bit: > > ldi r24,lo8(0) > ldi r25,hi8(0) > .L2: > sts xx,r24 > adiw r24,1 > cpi r24,64 > cpc r25,__zero_reg__ > brne .L2 > /* epilogue: frame size=0 */ > ret > > Now i tried around a bit and see the following situation: > > if i replace the "xx = ctr" by an __asm__("nop"), the counter is 8 > bit, as it should be. If i use ctr = 64 before the loop and do > while(--ctr);, the counter also is 8 bit (with xx = ctr in the loop). > All experiments trying < (uint8_t) 64 and so didn't work, also != > instead of < doesn't work, i can't find a "nice" way to force the > counter being 8 bit when using the value within the loop. I need that > loop in this way, that's why i don't use --ctr. > > But i found one operation, which does the same like (++ctr < 64) in my > case, but doesn't create the counter in 16bit but in 8bit, as desired: > (++ctr % 64). With this, the result is exactly what i want: > > ldi r24,lo8(0) > .L2: > sts xx,r24 > subi r24,lo8(-(1)) > cpi r24,lo8(64) > brne .L2 > /* epilogue: frame size=0 */ > ret > > Is there any reason for this strange 16bit behaviour? To me, it looks > like the assignemt xx = ctr seems to trigger some signed flags for the > comparison, because ((++ctr & 0x7f) < 64) also produces the desired > 8bit version. Might be okay in this loop, but isn't so fine if i need, > say, 200 as the counter top value. > > What do you think about this? This is strange, and might be a missed optimization bug. I can't see any explanation for the behaviour you see here. What does the output of -fdump-tree-optimized look like? Andrew. From michael@kukat.de Fri Mar 2 13:00:00 2007 From: michael@kukat.de (Michael Kukat) Date: Fri, 02 Mar 2007 13:00:00 -0000 Subject: 8/16bit oddities on avr-gcc In-Reply-To: <87zm6v956m.fsf@javad.com> References: <87zm6v956m.fsf@javad.com> Message-ID: Hi, 2007/3/2, osv@javad.com : > Sounds like some bug/misfeature then. I'd also try to move ++ out of the > comparison: also tried this already, with ctr++ in a separate line at the end of the loop - also compiles with 16bit ctr. ...Michael From michael@unixiron.org Fri Mar 2 13:03:00 2007 From: michael@unixiron.org (Michael Kukat) Date: Fri, 02 Mar 2007 13:03:00 -0000 Subject: 8/16bit oddities on avr-gcc In-Reply-To: <17896.7917.832091.677150@zebedee.pink> References: <17896.7917.832091.677150@zebedee.pink> Message-ID: Hi, 2007/3/2, Andrew Haley : > This is strange, and might be a missed optimization bug. I can't see > any explanation for the behaviour you see here. > > What does the output of -fdump-tree-optimized look like? I can't read out something useful from this... $ avr-gcc -mmcu=atmega16 -Wall -Werror -O3 -fdump-tree-optimized -S -o - perftest.c .file "perftest.c" .arch atmega16 __SREG__ = 0x3f __SP_H__ = 0x3e __SP_L__ = 0x3d __tmp_reg__ = 0 __zero_reg__ = 1 .global __do_copy_data .global __do_clear_bss .text .global test .type test, @function test: /* prologue: frame size=0 */ /* prologue end (size=0) */ ldi r24,lo8(0) ldi r25,hi8(0) .L2: sts xx,r24 adiw r24,1 cpi r24,64 cpc r25,__zero_reg__ brne .L2 /* epilogue: frame size=0 */ ret /* epilogue end (size=1) */ /* function test size 9 (8) */ .size test, .-test .comm xx,1,1 /* File "perftest.c": code 9 = 0x0009 ( 8), prologues 0, epilogues 1 */ But optimization was also my idea, because with -O0, it makes ctr 8bit: std Y+1,__zero_reg__ .L2: ldd r24,Y+1 sts xx,r24 ldd r24,Y+1 subi r24,lo8(-(1)) std Y+1,r24 ldd r24,Y+1 cpi r24,lo8(64) brlo .L2 okay, this code is due to heavy SRAM use not really good, but i tested all optimization levels, -Os, -O1 up to -O3, the "16bit problem" appears in all levels, just O0 seems to work in 8bit. I didn't find an option to disable from -O1 to get back to 8bit to track it down further yet. ...Michael From michael@kukat.de Fri Mar 2 13:12:00 2007 From: michael@kukat.de (Michael Kukat) Date: Fri, 02 Mar 2007 13:12:00 -0000 Subject: 8/16bit oddities on avr-gcc In-Reply-To: <87vehj94zg.fsf@javad.com> References: <87vehj94zg.fsf@javad.com> Message-ID: Hi, 2007/3/2, osv@javad.com : > I'd try to ask at avr-gcc mailing list: Yep, i'll ask there later, as currently i can't prove this problem is "generic", if i compile this on i386, it uses "one register". Fine. But as registers are 16 or 32 bits there, this isn't a suitable comparison, this can only be checked on compiler variants for CPUs with 8bit registers. ...Michael From michael@unixiron.org Fri Mar 2 13:17:00 2007 From: michael@unixiron.org (Michael Kukat) Date: Fri, 02 Mar 2007 13:17:00 -0000 Subject: 8/16bit oddities on avr-gcc In-Reply-To: <003101c75ccc$464884f0$d2d98ed0$@net> References: <17896.7917.832091.677150@zebedee.pink> <003101c75ccc$464884f0$d2d98ed0$@net> Message-ID: Hi, 2007/3/2, Rupert Wood : > I think he wants the perftest.c.099t.optimized file that'd be generated on disk. ah, okay, didn't use that option for now, so i didn't know that the necessary info is written to files :) Here it comes: ;; Function test (test) Analyzing Edge Insertions. test () { unsigned int ivtmp.28; uint8_t ivtmp.27; uint8_t pretmp.25; uint8_t ctr; : ivtmp.28 = 0; :; ctr = (uint8_t) ivtmp.28; xx = ctr; ivtmp.28 = ivtmp.28 + 1; if (ivtmp.28 != 64) goto ; else goto ; :; return; } Hm. It creates "unsigned int" for this comparison. Now trying without the assignment within the loop: ;; Function test (test) Analyzing Edge Insertions. test () { uint8_t ivtmp.27; uint8_t pretmp.25; uint8_t ctr; : ctr = 0; :; __asm__ __volatile__("nop"::); ctr = ctr + 1; if (ctr != 64) goto ; else goto ; :; return; } Here, ctr is taken for the comparison, not one of those ivtmp variables. ...Michael From michael@kukat.de Fri Mar 2 13:27:00 2007 From: michael@kukat.de (Michael Kukat) Date: Fri, 02 Mar 2007 13:27:00 -0000 Subject: 8/16bit oddities on avr-gcc In-Reply-To: References: <17896.7917.832091.677150@zebedee.pink> <003101c75ccc$464884f0$d2d98ed0$@net> Message-ID: Even more funny with the variant using ctr % 64: test () { unsigned int ivtmp.28; int pretmp.27; int pretmp.26; uint8_t pretmp.25; uint8_t ctr; int D.1293; int D.1292; : ctr = 0; :; __asm__ __volatile__("nop"::); xx = ctr; ctr = ctr + 1; if (ctr != 64) goto ; else goto ; :; return; } Lots of variables ivtmp.*, but the counter handling and modulo is done on the ctr, compared to the less-than, where counter handling and comparison is done on one of the ivtmp.* variables. ...Michael From aph@redhat.com Fri Mar 2 13:51:00 2007 From: aph@redhat.com (Andrew Haley) Date: Fri, 02 Mar 2007 13:51:00 -0000 Subject: 8/16bit oddities on avr-gcc In-Reply-To: References: <17896.7917.832091.677150@zebedee.pink> <003101c75ccc$464884f0$d2d98ed0$@net> Message-ID: <17896.11207.1808.259901@zebedee.pink> Michael Kukat writes: > Hi, > > 2007/3/2, Rupert Wood : > > I think he wants the perftest.c.099t.optimized file that'd be generated on disk. > > ah, okay, didn't use that option for now, so i didn't know that the > necessary info is written to files :) Here it comes: > > ;; Function test (test) > > Analyzing Edge Insertions. > test () > { > unsigned int ivtmp.28; > uint8_t ivtmp.27; > uint8_t pretmp.25; > uint8_t ctr; > > : > ivtmp.28 = 0; > > :; > ctr = (uint8_t) ivtmp.28; > xx = ctr; > ivtmp.28 = ivtmp.28 + 1; > if (ivtmp.28 != 64) goto ; else goto ; > > :; > return; > > } > > Hm. It creates "unsigned int" for this comparison. It does the same with my copy of gcc 4.1.2. For -O2 gcc 4.3 does: ;; Function test (test) Analyzing Edge Insertions. test () { uint8_t ctr; : xx = 0; xx = 1; ctr = 2; :; xx = ctr; ctr = ctr + 1; if (ctr != 64) goto ; else goto ; :; return; (And, before you ask, I have no idea what the xx = 0; xx = 1; lines are for!) gcc 4.2 might do better than 4.1. Andrew. From michael@kukat.de Fri Mar 2 15:14:00 2007 From: michael@kukat.de (Michael Kukat) Date: Fri, 02 Mar 2007 15:14:00 -0000 Subject: 8/16bit oddities on avr-gcc In-Reply-To: <17896.11207.1808.259901@zebedee.pink> References: <17896.7917.832091.677150@zebedee.pink> <003101c75ccc$464884f0$d2d98ed0$@net> <17896.11207.1808.259901@zebedee.pink> Message-ID: <45E83F3B.1010005@kukat.de> Hi, Andrew Haley schrieb: > (And, before you ask, I have no idea what the xx = 0; xx = 1; lines > are for!) I think that is this voodoo thing Eljay mentioned :) Okay, it starts ctr with 2, so it's logically to optimize the first 2 loop iterations away by doing it this way. Is there a new -funroll-loops-a-bit option? :) > gcc 4.2 might do better than 4.1. Hm okay, if i remember the improvement from 3.3 to 4.1, maybe i should give it a try over the weekend. Thanks so far, at least we know now, that this is a common issue, which only appears on 8bit CPUs. ...Michael From michael@kukat.de Fri Mar 2 16:40:00 2007 From: michael@kukat.de (Michael Kukat) Date: Fri, 02 Mar 2007 16:40:00 -0000 Subject: 8/16bit oddities on avr-gcc In-Reply-To: <17896.11207.1808.259901@zebedee.pink> References: <17896.7917.832091.677150@zebedee.pink> <003101c75ccc$464884f0$d2d98ed0$@net> <17896.11207.1808.259901@zebedee.pink> Message-ID: <45E8535A.1080605@kukat.de> Hi again, Andrew Haley schrieb: > For -O2 gcc 4.3 does: > > ;; Function test (test) > > Analyzing Edge Insertions. > test () > { > uint8_t ctr; > > : > xx = 0; > xx = 1; > ctr = 2; > > :; > xx = ctr; > ctr = ctr + 1; > if (ctr != 64) goto ; else goto ; > > :; > return; okay, i just tested 4.2-20070228 and voila - i can reproduce what you have seen in 4.3, here is the assembler equivalent of this: test: /* prologue: frame size=0 */ /* prologue end (size=0) */ sts var,__zero_reg__ ldi r24,lo8(1) sts var,r24 ldi r24,lo8(2) .L2: sts var,r24 subi r24,lo8(-(1)) cpi r24,lo8(64) brne .L2 /* epilogue: frame size=0 */ ret So the uint8_t versus unsigned int problem seems to be gone in 4.2. But only for this special case, as in the function where i have seen the "problem" yesterday, i see this "unsigned int" stuff again now and it again compiles to a 16 bit counter. I'll try to find out what triggers the problem this time. ...Michael From michael@kukat.de Fri Mar 2 17:04:00 2007 From: michael@kukat.de (Michael Kukat) Date: Fri, 02 Mar 2007 17:04:00 -0000 Subject: 8/16bit oddities on avr-gcc In-Reply-To: <17896.11207.1808.259901@zebedee.pink> References: <17896.7917.832091.677150@zebedee.pink> <003101c75ccc$464884f0$d2d98ed0$@net> <17896.11207.1808.259901@zebedee.pink> Message-ID: <45E8590C.1070400@kukat.de> Okay, next fun :) This is the (nearly) whole function: void cv_mux_update() { uint8_t regnum; int16_t value, *cv, *cvold; struct update { uint8_t num; int16_t val; } *update; spibuff[0] = CMD_SETREGS; update = (struct update *)&(spibuff[1]); cv = cv_mux_comm.cvdata; cvold = cv_mux_comm.cvdata_old; regnum = 0; if(cv_mux_comm.force_update) { do { value = *cv; *cvold = value; update->num = regnum; /* update->val = value;*/ update++; cvold++; cv++; } while(++regnum < NUM_CV); } else { } slave_send(3, spibuff, (uint8_t *)update - spibuff); cv_mux_comm.force_update = 0; } cvdata and cvdata_old in cv_mux_comm are int16_t[], spibuff is uint8_t[]. If i leave the commented line commented, regnum is left in 8 bit over the loop. No "unsigned int" variables are created, just an "int spibuff.1", which currently doesn't interest me too much. If i remove the comments, 2 variables which have absolutely nothing to do with regnum lead to the "unsigned int" variable introduces again to take the role of regnum. Same thing as the simpler example which has shown this problem with 4.1.1: unsigned int ivtmp.272; ... MEM[base: update] = (uint8_t) ivtmp.272; ... ivtmp.272 = ivtmp.272 + 1; if (ivtmp.272 != 64) goto ; else goto ; Don't want to rip out the struct, as this is for performance reasons. You don't want to see the code which results from an int16_t >> 8 :) I could write it in a different way, but then it gets a bit unreadable :) Okay, investigating further, just wanted to tell this... ...Michael From matt.fago@itt.com Fri Mar 2 21:20:00 2007 From: matt.fago@itt.com (Matt Fago) Date: Fri, 02 Mar 2007 21:20:00 -0000 Subject: Coverage broken in gcc 4.1.1? Message-ID: <1172870426.31831.33.camel@entropy.aes.de.ittind.com> I'm trying to use gcov with gcc 4.1.1 as installed in Fedora Core 6 x86_64. This works fine: gcc --coverage -o hello hello.c This does not: gcc --coverage -o hello.o -c hello.c gcc --coverage -o hello hello.o Both work as expected with Apple's gcc 4.0.4 (with explicit -fprofile-arcs -ftest-coverage) and FSF gcc 4.1.2 on powerpc or gcc trunk on x86_64. I thought I'd heard of this on gcc@gcc.gnu.org, but I've looked in Bugzilla and cannot find it. If this is known I'd appreciate a reference to a bug so I can ask Fedora to patch their version of gcc. Thanks, Matt ************************************ This e-mail and any files transmitted with it are proprietary and intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the sender. Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of ITT, Inc. The recipient should check this e-mail and any attachments for the presence of viruses. ITT accepts no liability for any damage caused by any virus transmitted by this e-mail. ************************************ From kaz@zeugmasystems.com Sat Mar 3 01:31:00 2007 From: kaz@zeugmasystems.com (Kaz Kylheku) Date: Sat, 03 Mar 2007 01:31:00 -0000 Subject: [OT] RE: Is there a free substitute for Flexilint? Message-ID: <66910A579C9312469A7DF9ADB54A8B7D65740E@exchange.ZeugmaSystems.local> gcc-help-owner@gcc.gnu.org wrote: > Gimpel Software has a tool that I've gotten tons of benefit from when > my employers have had a copy: FlexiLint. It's been marvelous at > statically checking C++ code and uncovered all kinds of evil bugs. > > But it's also out-of-reach expensive: $1000 for a single user. That's ``nothing'' for a software company. Even in an organization with, say, 30 developers, you could keep the code clean with just one license for this type of software. It's not the type of software that requires a maintenance contract or upgrades. You buy it once and then ``lint away'' for years. What's the cost of not doing the linting? Bugs caught late (i.e. by the customer) can quickly eat away more than a thousand bucks from your bottom line. > Is there any free, or close-to-free, tool that you can recommend? The GNU compiler has a lot of C++ specific warnings which are not turned on by default. It's not exactly lint, but you can squeeze more out of the compiler's diagnostic ability. Flexelint requires a lot of tweaking. When you let it loose on a codebase for the first time, it can produce a huge amount of noise. Not all of it is useful. You'd be crazy to follow up on every one of its recommendations by adjusting the code (rather than turning off the check which produced it). > (I suspect Valgrind has some overlap in terms of what bugs the two > tools detect, but it's not going to catch stuff like misuse of > "const", etc.) There would only be overlap if you ignore the diagnostics from the static checker and run the program anyway, under valgrind. :) You can also get more out of valgrind by learning about its API. Misuse of const /can/ actually be diagnosed. You see, you can inform Valgrind that some arbitrary region of memory is read only. Then if anything writes to it, there will be a diagnostic. Of course, GCC doesn't have any code generation option to do this valgrind-specific hack for const objects (but you could hack that feature in!) Even the C front end can do this, because the constructor/destructor hook mechanism is available to it. (The bounds-checking patches for GCC that were developed years ago took advantage of this in order to register and unregister block-scope objects in the splay tree of live objects). From sdirkse@gams.com Sat Mar 3 07:59:00 2007 From: sdirkse@gams.com (Steven Dirkse) Date: Sat, 03 Mar 2007 07:59:00 -0000 Subject: problem running gcc 4.3.0 on i386-pc-solaris2.10 Message-ID: <45E92AE8.8040902@gams.com> Hi, I am having a problem running the GCC 4.3 I just built and installed on a Solaris Intel machine. Somehow, the absolute path is left off of crtbegin.o and crtend.o. Any ideas on what I did wrong to cause this, or failed to do? Here's the broken run's output: -bash-3.00$ /usr/local/bin/gcc -o hello hello.c -v Using built-in specs. Target: i386-pc-solaris2.10 Configured with: ../configure --build=i386-pc-solaris2.10 --with-gnu-as --with-as=/usr/sfw/bin/gas --without-gnu-ld -with-ld=/usr/ccs/bin/ld --with-gmp=/usr/local --with-mpfr=/usr/local --enable-languages=c,c++,fortran --enable-shared Thread model: posix gcc version 4.3.0 20070301 (experimental) /usr/local/libexec/gcc/i386-pc-solaris2.10/4.3.0/cc1 -quiet -v hello.c -quiet -dumpbase hello.c -mtune=generic -auxbase hello -version -o /var/tmp//ccxcSoPX.s ignoring nonexistent directory "/usr/local/lib/gcc/i386-pc-solaris2.10/4.3.0/../../../../i386-pc-solaris2.10/include" #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/local/lib/gcc/i386-pc-solaris2.10/4.3.0/include /usr/local/lib/gcc/i386-pc-solaris2.10/4.3.0/include-fixed /usr/include End of search list. GNU C version 4.3.0 20070301 (experimental) (i386-pc-solaris2.10) compiled by GNU C version 4.3.0 20070301 (experimental). GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: 15fd974b8d70fc2c218783c6076c49f0 /usr/sfw/bin/gas --traditional-format -V -Qy -s -o /var/tmp//ccAwK3EN.o /var/tmp//ccxcSoPX.s GNU assembler version 2.15 (i386-pc-solaris2.10) using BFD version 2.15 /usr/local/libexec/gcc/i386-pc-solaris2.10/4.3.0/collect2 -V -Y P,/usr/ccs/lib:/usr/lib -Qy -o hello /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/values-Xa.o crtbegin.o -L/usr/local/lib/gcc/i386-pc-solaris2.10/4.3.0 -L/usr/local/lib/gcc/i386-pc-solaris2.10/4.3.0/../../.. /var/tmp//ccAwK3EN.o -lgcc -lgcc_eh -lc -lgcc -lgcc_eh crtend.o /usr/lib/crtn.o ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.482 ld: fatal: file crtbegin.o: open failed: No such file or directory ld: fatal: library -lgcc: not found ld: fatal: library -lgcc_eh: not found ld: fatal: library -lgcc: not found ld: fatal: library -lgcc_eh: not found ld: fatal: file crtend.o: open failed: No such file or directory ld: fatal: File processing errors. No output written to hello collect2: ld returned 1 exit status -bash-3.00$ Here's a working run's output, using the gcc 3.4 that was already installed: -bash-3.00$ gcc -o hello hello.c -v Reading specs from /usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/specs Configured with: /builds/sfw10-gate/usr/src/cmd/gcc/gcc-3.4.3/configure --prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as --with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++ --enable-shared Thread model: posix gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath) /usr/sfw/libexec/gcc/i386-pc-solaris2.10/3.4.3/cc1 -quiet -v hello.c -quiet -dumpbase hello.c -auxbase hello -version -o /var/tmp//ccw0ST6d.s ignoring nonexistent directory "/usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/../../../../i386-pc-solaris2.10/include" #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/sfw/include /usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/include /usr/include End of search list. GNU C version 3.4.3 (csl-sol210-3_4-branch+sol_rpath) (i386-pc-solaris2.10) compiled by GNU C version 3.4.3 (csl-sol210-3_4-branch+sol_rpath). GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 /usr/sfw/bin/gas --traditional-format -V -Qy -s -o /var/tmp//cccd8M1l.o /var/tmp//ccw0ST6d.s GNU assembler version 2.15 (i386-pc-solaris2.10) using BFD version 2.15 /usr/sfw/libexec/gcc/i386-pc-solaris2.10/3.4.3/collect2 -V -Y P,/usr/ccs/lib:/usr/lib -Qy -o hello /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/values-Xa.o /usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/crtbegin.o -L/usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3 -L/usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/../../.. /var/tmp//cccd8M1l.o -R/usr/sfw/lib -lgcc -lgcc_eh -lc -R/usr/sfw/lib -lgcc -lgcc_eh /usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/crtend.o /usr/lib/crtn.o ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.482 From maurizio_vitale@verizon.net Sat Mar 3 15:23:00 2007 From: maurizio_vitale@verizon.net (Maurizio Vitale) Date: Sat, 03 Mar 2007 15:23:00 -0000 Subject: overload set management for assignment operator, SFINAE and GCC Message-ID: Is the following code supposed to be valid C++ or is GCC right in rejecting it: template class A; template struct hidden_unless_int { }; template<> struct hidden_inless_int {typedef A& type; }; template struct visible_unless_int { typedef A& type; }; template<> struct visible_unless_int {}; template class A { public: typename hidden_unless_int::type operator = (T value) {} typename visible_unless_int::type operator = (T value) {} }; A ai; A af; There're a couple of things going on here. Clearly overloading on the returned type alone is not enough to disambiguate (but the specific case of operator= doesn't allow for the usual trick of an additional dummy parameter with a default value) . What we would have hoped here is that the SFINAE rule would have kicked in to filter the set of possible overloads. Is GCC right in failing on the instantiations {hidden,visible}_unless_int that do not contain the typedef for type? [another data point is that comeau C++ - edg based - agrees with GCC, which strongly suggests that the code above is wrong ] If the above is illegal code, is there any way to control the overloading set for operator= ? Thanks a lot. Maurizio Vitale From pavankumar@cse.iitb.ac.in Sat Mar 3 18:29:00 2007 From: pavankumar@cse.iitb.ac.in (P. Pavan Kumar) Date: Sat, 03 Mar 2007 18:29:00 -0000 Subject: DFA-scheduler Message-ID: <43215.10.129.41.35.1172946562.squirrel@www.cse.iitb.ac.in> Respected sir, DFA pipeline hazard recognizer is used to avoid structural hazards. While intra block(basic block scheduling) scheduling how data hazards are avoided . DFA will take care of only structural hazards, but what about data hazards. First cycle mutiple pass scheduling algorithm tries different schedules and choose the best one. intra block scheduling reorders the instructions within the basic block by constructing DAG and based on LIST scheduling algorithm . If First cycle mutiple pass algorithm chooses the best schedule then why gcc needs intra block scheduling ? Now gcc will do instruction scheduling beyond basic blocks i,e inter block scheduling (region scheduling) then why gcc needs intrablock scheduling? what is command line option for enabling only intra block(with in basic block) scheduling. and diabling all remaining intruction scheduling ( trace, modulo etc). Please help me sir. Thanks in advance Pavan, Home: http://www.cse.iitb.ac.in/~pavankumar From dima.sorkin@gmail.com Sat Mar 3 19:59:00 2007 From: dima.sorkin@gmail.com (Dima Sorkin) Date: Sat, 03 Mar 2007 19:59:00 -0000 Subject: gfortran installation problems Message-ID: Hi. Please CC Yves Nievergelt on reply. The "gfortran" command gives the following error: (program: "simple.f" does nothing: PROGRAM XYZ STOP END): Command line: $ /usr/local/bin/gfortran ~/Fprograms/simple.f Error message that I get: /usr/bin/ld: can't locate file for: -lSystemStubs collect2: ld returned 1 exit status I get the same error message from two different installations: an installation from gfortran-macosx.dmg by the command > sudo tar -xvzf gfortran-bin.tar.gz -C / and an installation from gfortranCompleteInstaller.mpkg (which puts another version (copy) of gfortran in another directory: /usr/local/gfortran/bin/gfortran but gives the same error message). Any advice will be greatly appreciated: I have now tried to install and run gfortran for several years. On every try, something goes wrong. I know some UNIX, but evidently not enough. Perhaps I'm too dumb to do this kind of thing. If you think so, just let me know, and I'll give up. In any event, thank you again for your time. Sincerely, Yves. Did you try gfortran ~/Fprograms/cbrtest.f ? Dima. On 2/20/07, Yves Nievergelt wrote: > To whom it may concern: > > After apparently successfully installing gfortran-macosx.dmg > and after restarting the computer, > attempts at compiling fortran code from the command line > > > gcc ~/Fprograms/cbrtest.f > > > cause the following error message: > > > gcc: /Users/faculty/Fprograms/cbrtest.f: Fortran compiler not installed > on this system -- Yves Nievergelt, Ph.D. Professor of Mathematics Department of Mathematics Eastern Washington University 216 Kingston Hall Cheney, Washington 99004-2418 USA email ynievergelt@ewu.edu voice (509) 359-4259 FAX (509) 359-4700 -- Yves Nievergelt, Ph.D. Professor of Mathematics Department of Mathematics Eastern Washington University 216 Kingston Hall Cheney, Washington 99004-2418 USA email ynievergelt@ewu.edu voice (509) 359-4259 FAX (509) 359-4700 From peterhull90@gmail.com Sat Mar 3 22:00:00 2007 From: peterhull90@gmail.com (Peter Hull) Date: Sat, 03 Mar 2007 22:00:00 -0000 Subject: m32c-elf cross compiler Message-ID: <8833de210703031400k4072fa58u480b0485c9ce0e9c@mail.gmail.com> I'm trying to build an m32c-elf toolchain, hosted on OSX. I've downloaded binutils-2.16.94, mpfr-2.2.1, gmp-4.2.1, gcc-4.1.2 and newlib-1.15.0 and unpacked them all into separate directories. Then I created a build subdirectory for each of binutils, newlib and gcc. I configured, built and installed binutils with no problems. However the gcc build fails when it gets to building libssp. The command is: /Users/peterhull/gnuproject/build-gcc/./gcc/xgcc -B/Users/peterhull/gnuproject/build-gcc/./gcc/ -B/Users/peterhull/m32c-elf/bin/ -B/Users/peterhull/m32c-elf/lib/ -isystem /Users/peterhull/m32c-elf/include -isystem /Users/peterhull/m32c-elf/sys-include -DHAVE_CONFIG_H -I. -I../../../gcc-4.1.2/libssp -I. -Wall -O2 -g -O2 -I../mpfr-2.2.1 -MT ssp.lo -MD -MP -MF .deps/ssp.Tpo -c ../../../gcc-4.1.2/libssp/ssp.c -o ssp.o The errors are: ../../../gcc-4.1.2/libssp/ssp.c: In function '__guard_setup': ../../../gcc-4.1.2/libssp/ssp.c:70: warning: implicit declaration of function 'open' ../../../gcc-4.1.2/libssp/ssp.c:70: error: 'O_RDONLY' undeclared (first use in this function) ../../../gcc-4.1.2/libssp/ssp.c:70: error: (Each undeclared identifier is reported only once ../../../gcc-4.1.2/libssp/ssp.c:70: error: for each function it appears in.) .... and many more 'undeclared' errors. As far as I can see this is because when configure runs for libssp, it doesn't find any of the standard headers, so (for example) HAVE_FCNTL_H is not #defined in config.h. I assume that the libssp.a that's being built is for m32c-elf, rather than for the host. If so, it should be the newlib headers on the search path, rather than the ones in /usr/include. Is this right? Am I following the right procedure for building gcc or am I missing something? Peter From bogusbill@mindless.com Sun Mar 4 02:49:00 2007 From: bogusbill@mindless.com (Bogus Bill) Date: Sun, 04 Mar 2007 02:49:00 -0000 Subject: gcc does nothing Message-ID: <9292367.post@talk.nabble.com> I just installed gcc under Cygwin. I tried to compile the requisite "Hello, world!" program, but gcc didn't give any messages, nor generate any output. Here are the specifics: Code: #include using namespace std; int main (void) { cout << "Hello, world!"; return 0; } Compiler command: gcc -o hello hello.cpp gcc version: 3.4.4 Thanks for your help. Bill P.S.: I've also tried g++ and c++ instead of gcc, to no avail. -- View this message in context: http://www.nabble.com/gcc-does-nothing-tf3341149.html#a9292367 Sent from the gcc - Help mailing list archive at Nabble.com. From brian@dessent.net Sun Mar 4 02:57:00 2007 From: brian@dessent.net (Brian Dessent) Date: Sun, 04 Mar 2007 02:57:00 -0000 Subject: gcc does nothing References: <9292367.post@talk.nabble.com> Message-ID: <45EA35A4.2B834B0A@dessent.net> Bogus Bill wrote: > I just installed gcc under Cygwin. I tried to compile the requisite "Hello, > world!" program, but gcc didn't give any messages, nor generate any output. > Here are the specifics: It would be better to post this to the Cygwin mailing list, and include the cygcheck output, without which we can only guess about your configuration. The most likely cause is you are missing a required package. You can check for missing DLLs with "cygcheck /usr/bin/gcc". But setup should have included all required packages when you selected gcc. But again, without cygcheck output, all we can do is guess. > P.S.: I've also tried g++ and c++ instead of gcc, to no avail. It is required to use the g++ driver when compiling C++ code. Not that that necessarily matters here. Brian From sigra@home.se Sun Mar 4 05:26:00 2007 From: sigra@home.se (Erik) Date: Sun, 04 Mar 2007 05:26:00 -0000 Subject: [OT] RE: Is there a free substitute for Flexilint? In-Reply-To: <66910A579C9312469A7DF9ADB54A8B7D65740E@exchange.ZeugmaSystems.local> References: <66910A579C9312469A7DF9ADB54A8B7D65740E@exchange.ZeugmaSystems.local> Message-ID: <45EA58BB.7040702@home.se> Kaz Kylheku skrev: > > Is there any free, or close-to-free, tool that you can recommend? > > The GNU compiler has a lot of C++ specific warnings which are not turned > on by default. It's not exactly lint, but you can squeeze more out of > the compiler's diagnostic ability This lack of checking tools has bothered me too. Therefore I was delighted when I read at [http://freshmeat.net/projects/gcc/] that "GCC provides many levels of source code error checking traditionally provided by other tools (such as lint)". But unfortunately this is not what GCC is trying to be. If I report a feature request for a checking feature, it is usually rejected within half an hour. For example there is a useful feature in the Ada frontend, that warns about variables that are not modified after initialization and could be declared constant (with "gnatmake -gnatwa"). This feature has helped me catch a few errors, for example when I intended to modify a variable and then forgot to write the statement to do it. Now some people probably say that I should be using Ada instead of C++ anyway. In principle they are right of course, but unfortunately I still often have to code in C++ (for existing projects). So I requested to have this useful feature for C++ as well. The request got closed as WONTFIX and someone replied "Isn't this a task for lint-like tool? GCC isn't such thing." I wonder why we can not make C++ development at least a LITTLE bit easier and safer by adding such features. It wouldn't be Ada, but it would certainly help during the time while we still have to use C++. [http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25845] Another feature request was to warn about using pointers without checking for 0 (which would result in segmentation fault). That request went the same way. [http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29208] Sure, C++ was not designed to control nuclear power plants or space shuttles, but does that mean we are not allowed to avoid bugs when we can easily do so? From sunzird@gmail.com Sun Mar 4 13:55:00 2007 From: sunzird@gmail.com (Sunzir Deepur) Date: Sun, 04 Mar 2007 13:55:00 -0000 Subject: VCG viewer Message-ID: hello all, where can I find a VCG viewer to install in fedora (i want to view the vcg files outputed from gcc) ? i found only deb packages, and sources that didn't compile in my fedora... if there were rpm or yum package it could be heaven ! thanks sunzir From ranjit_kumar_b4u@yahoo.co.uk Sun Mar 4 18:17:00 2007 From: ranjit_kumar_b4u@yahoo.co.uk (ranjith kumar) Date: Sun, 04 Mar 2007 18:17:00 -0000 Subject: gcc and SIMD Message-ID: <20070304181746.27891.qmail@web27401.mail.ukl.yahoo.com> Hi, 1) Seems that all defintions for MMX, SSE and SSE2 are deinred in mmtrin.h,xmmintrin.h and emmintrin.h header files respectively. Am I right? 2) In those header files all functions call _builtin_ia32_*. Where those functions(body) are defined? 3) I thought that associated with each SIMD instruction defined in Intel-ia-32-architectures manual(Basic architecture) there is one function defined in those header files. But for some instructions no functions were defined in those header files.(For example MOVDQA instruction) Also those header files contain some more functions for which no SIMD assembly instruction exist.Example in emmintrin.h static __inline __m128i _mm_load_si128 (__m128i const *__P) { return (__m128i) __builtin_ia32_loaddqa ((char const *)__P); } What could be the reason? Thanks in advance. ___________________________________________________________ To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com From ranjit_kumar_b4u@yahoo.co.uk Sun Mar 4 19:30:00 2007 From: ranjit_kumar_b4u@yahoo.co.uk (ranjith kumar) Date: Sun, 04 Mar 2007 19:30:00 -0000 Subject: regarding autovectorization and prefetching Message-ID: <20070304193054.50975.qmail@web27401.mail.ukl.yahoo.com> --- Tim Prince wrote: > ranjith kumar wrote: > > 1) gcc manuals says -fprefetch-loop-arrays option > > inserts prefetch instructions automatically. > > Where can I get an example .c program for which > gcc > > inserts prefetching instruction. > > > > 2) Similarly to the autovectorization. > > Thanks in advance. > > > > > You might specify what target you are interested in. > As x86-64 targets > do better with hardware prefetch than software > prefetch, for the simple > cases, I don't find the latter so interesting. > There are test cases for -ftree-vectorize in the > testsuite, both in the > language parts and the tree-lang testsuite. > gfortran-4.3 does a > consistently good job on vectorization of the simple > cases. gcc > vectorizes effectively several of the gfortran > library functions, > including matmul. > 1)Where can I get test cases. I have searched in google. but it sucked. 2)The above two optimizations are done for C programs also. Am I right? 3)From which version of gcc they are enabled? ___________________________________________________________ New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at the Yahoo! Mail Championships. Plus: play games and win prizes. http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk From ranjit_kumar_b4u@yahoo.co.uk Sun Mar 4 21:18:00 2007 From: ranjit_kumar_b4u@yahoo.co.uk (ranjith kumar) Date: Sun, 04 Mar 2007 21:18:00 -0000 Subject: how save data from XMM register to int array Message-ID: <20070304211829.67469.qmail@web27415.mail.ukl.yahoo.com> Hi, I tried it with _mm_stream_si128(&a[1],m128) function. But I got compilation error. I have read about MOVDQU instruction in intel manuals. What is the equilant function defined at c level( for gcc) in (what)header files? Thanks in advance. ___________________________________________________________ What kind of emailer are you? Find out today - get a free analysis of your email personality. Take the quiz at the Yahoo! Mail Championship. http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk From iant@google.com Mon Mar 5 01:24:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Mon, 05 Mar 2007 01:24:00 -0000 Subject: gcc and SIMD In-Reply-To: <20070304181746.27891.qmail@web27401.mail.ukl.yahoo.com> References: <20070304181746.27891.qmail@web27401.mail.ukl.yahoo.com> Message-ID: ranjith kumar writes: > 1) Seems that all defintions for MMX, SSE and SSE2 > are deinred in mmtrin.h,xmmintrin.h and emmintrin.h > header files respectively. Am I right? Yes. > 2) In those header files all functions call > _builtin_ia32_*. Where those functions(body) are > defined? They are intrinsic functions automatically defined by the compiler. > 3) I thought that associated with each SIMD > instruction defined in Intel-ia-32-architectures > manual(Basic architecture) there is one function > defined in those header files. > But for some instructions no functions were defined in > those header files.(For example MOVDQA instruction) > Also those header files contain some more functions > for which no SIMD assembly instruction exist.Example > in emmintrin.h > static __inline __m128i > _mm_load_si128 (__m128i const *__P) > { > return (__m128i) __builtin_ia32_loaddqa ((char > const *)__P); > } > What could be the reason? Those header files follow the implementation described by Intel. Ian From chnabsankar@yahoo.com Mon Mar 5 04:37:00 2007 From: chnabsankar@yahoo.com (sankar chebolu) Date: Mon, 05 Mar 2007 04:37:00 -0000 Subject: GCC Versioning Policy Message-ID: <34128.60174.qm@web30704.mail.mud.yahoo.com> Hi, Any document available which explains the GCC Versioning policy/scheme? Among GCC 4.0.4 & 4.1.2 which one is more stable? Thanks in Advance. Sankar ____________________________________________________________________________________ Need a quick answer? Get one in minutes from people who know. Ask your question on www.Answers.yahoo.com From tprince@myrealbox.com Mon Mar 5 05:32:00 2007 From: tprince@myrealbox.com (Tim Prince) Date: Mon, 05 Mar 2007 05:32:00 -0000 Subject: GCC Versioning Policy In-Reply-To: <34128.60174.qm@web30704.mail.mud.yahoo.com> References: <34128.60174.qm@web30704.mail.mud.yahoo.com> Message-ID: <45EBAB69.500@myrealbox.com> sankar chebolu wrote: > Hi, > Any document available which explains the GCC > Versioning policy/scheme? > > Among GCC 4.0.4 & 4.1.2 which one is more stable? > > Thanks in Advance. > Sankar > > I guess any answer could be justified by your personal outlook. As 4.1.2 is the current release, and has support for Fortran, my personal answer is evident. From dreams_arpit@yahoo.co.in Mon Mar 5 06:48:00 2007 From: dreams_arpit@yahoo.co.in (arpit jain) Date: Mon, 05 Mar 2007 06:48:00 -0000 Subject: Cross compiler build Message-ID: <883001.68220.qm@web8408.mail.in.yahoo.com> Hiiiiii, I have build gcc-3.x cross compiler (for ADA language) for some embedded target.But it is asking for some runtime library files when running the binary. I think it needs some target specific files.I have not build newlib package as I think it is runtime library for C language only. 1.Can someone please tell me what is the error and Do I need to build newlib package also(as I am building gcc for ASA language)? 2. Where can I get the sources for runtime libraries for embedded targets? Thanks & Regards, Arpit __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/ From john.fisher@nec.com.au Mon Mar 5 07:43:00 2007 From: john.fisher@nec.com.au (John Fisher) Date: Mon, 05 Mar 2007 07:43:00 -0000 Subject: -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations Message-ID: <000f01c75ef9$ce78f650$6bd04c93@mul7.nec.com.au> Is it necessary to specify all 4 of these warnings to get the maximum amount of warnings in C code? I would expect that -Wmissing-prototypes implies -Wmissing-declarations since I understand prototype to mean exactly "new-style function declaration". However I note that http://gcc.gnu.org/ml/gcc/2006-10/msg00609.html does not state that any of these 4 options imply another. What I'm trying to achieve is no old-style function declarations or definitions, all global function definitions must have a pre-existing new-style function declaration. From me@rupey.net Mon Mar 5 09:47:00 2007 From: me@rupey.net (Rupert Wood) Date: Mon, 05 Mar 2007 09:47:00 -0000 Subject: Cross compiler build In-Reply-To: <883001.68220.qm@web8408.mail.in.yahoo.com> References: <883001.68220.qm@web8408.mail.in.yahoo.com> Message-ID: <06aa01c75f0b$2b1601d0$81420570$@net> arpit jain wrote: > I have build gcc-3.x cross compiler (for ADA language) for some > embedded target.But it is asking for some runtime library files when > running the binary. > > I think it needs some target specific files.I have not build newlib > package as I think it is runtime library for C language only. The C runtime library is usually the interface to the OS kernel: in general all code will expect a C runtime library is available. I think you will need to build newlib or some other C library and I think the Ada runtime does contain some C code. As an aside you could look into RTEMS: it's an OS for embedded systems with good Ada support. http://www.rtems.com/ There are sketch build instructions for RTEMS and Ada here: http://www.rtems.com/wiki/index.php/RTEMSAda Rup. ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ From ranjit_kumar_b4u@yahoo.co.uk Mon Mar 5 10:31:00 2007 From: ranjit_kumar_b4u@yahoo.co.uk (ranjith kumar) Date: Mon, 05 Mar 2007 10:31:00 -0000 Subject: gcc and SIMD In-Reply-To: Message-ID: <20070305103142.92029.qmail@web27408.mail.ukl.yahoo.com> --- Ian Lance Taylor wrote: > ranjith kumar writes: > > > 1) Seems that all defintions for MMX, SSE and > SSE2 > > are deinred in mmtrin.h,xmmintrin.h and > emmintrin.h > > header files respectively. Am I right? > > Yes. > > > 2) In those header files all functions call > > _builtin_ia32_*. Where those functions(body) are > > defined? > > They are intrinsic functions automatically defined > by the compiler. Please tell me in what file they are defined. > > > 3) I thought that associated with each SIMD > > instruction defined in Intel-ia-32-architectures > > manual(Basic architecture) there is one function > > defined in those header files. > > But for some instructions no functions were > defined in > > those header files.(For example MOVDQA > instruction) > > Also those header files contain some more > functions > > for which no SIMD assembly instruction > exist.Example > > in emmintrin.h > > static __inline __m128i > > _mm_load_si128 (__m128i const *__P) > > { > > return (__m128i) __builtin_ia32_loaddqa ((char > > const *)__P); > > } > > What could be the reason? > > Those header files follow the implementation > described by Intel. In which file they are described? The thing is that I want to go into internals of it. Thanks in advance. > > Ian > ___________________________________________________________ All New Yahoo! Mail ?? Tired of unwanted email come-ons? Let our SpamGuard protect you. http://uk.docs.yahoo.com/nowyoucan.html From kapil.anurag@yahoo.co.in Mon Mar 5 11:02:00 2007 From: kapil.anurag@yahoo.co.in (kapil jain) Date: Mon, 05 Mar 2007 11:02:00 -0000 Subject: Cross Compiler to Native Compiler Message-ID: <212326.15803.qm@web7810.mail.in.yahoo.com> Hi, I am porting/developing GCC onto a new platform. This platform already have a cross tool chain. Can anybody give me a roadmap to port GCC in native environment from scratch? or Way to convert, Croos-Compiler to Native-Compiler? Thanks n Regards, Kapil __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/ From maurizio_vitale@verizon.net Mon Mar 5 14:00:00 2007 From: maurizio_vitale@verizon.net (Maurizio Vitale) Date: Mon, 05 Mar 2007 14:00:00 -0000 Subject: gcc and SIMD In-Reply-To: <20070305103142.92029.qmail@web27408.mail.ukl.yahoo.com> References: <20070305103142.92029.qmail@web27408.mail.ukl.yahoo.com> Message-ID: <3369CBB2-0874-4F64-8BCB-B4D7CFE7E605@verizon.net> you can answer your questions yourself with a few Unix commands. If you want to know where __builtin_X is defined, start with all files in which it is used: find . -type f | xargs egrep -l __builtin_X [run from the top gcc directory] if you suspect that something is architecture specific you can limit the search to your architecture of interest by replacing '.' with the correct directory. But for the __builtin_* functions, you may end up with nothing: defined by the compiler means that GCC knows how to replace those calls with RTL (or maybe these days w/ higher level representations). So there's no function called __builtin_X. It is still likely that the __builtin_X names are mentioned somewhere in the code or comments around where the replacement happens. On Mar 5, 2007, at 5:31 AM, ranjith kumar wrote: > > --- Ian Lance Taylor wrote: > >> ranjith kumar writes: >> >>> 1) Seems that all defintions for MMX, SSE and >> SSE2 >>> are deinred in mmtrin.h,xmmintrin.h and >> emmintrin.h >>> header files respectively. Am I right? >> >> Yes. >> >>> 2) In those header files all functions call >>> _builtin_ia32_*. Where those functions(body) are >>> defined? >> >> They are intrinsic functions automatically defined >> by the compiler. > Please tell me in what file they are defined. > >> >>> 3) I thought that associated with each SIMD >>> instruction defined in Intel-ia-32-architectures >>> manual(Basic architecture) there is one function >>> defined in those header files. >>> But for some instructions no functions were >> defined in >>> those header files.(For example MOVDQA >> instruction) >>> Also those header files contain some more >> functions >>> for which no SIMD assembly instruction >> exist.Example >>> in emmintrin.h >>> static __inline __m128i >>> _mm_load_si128 (__m128i const *__P) >>> { >>> return (__m128i) __builtin_ia32_loaddqa ((char >>> const *)__P); >>> } >>> What could be the reason? >> >> Those header files follow the implementation >> described by Intel. > In which file they are described? > The thing is that I want to go into internals of it. > Thanks in advance. >> >> Ian >> > > > > > ___________________________________________________________ > All New Yahoo! Mail ? Tired of unwanted email come-ons? Let our > SpamGuard protect you. http://uk.docs.yahoo.com/nowyoucan.html > > From Danny.Birdie@synopsys.com Mon Mar 5 15:11:00 2007 From: Danny.Birdie@synopsys.com (Danny Birdie) Date: Mon, 05 Mar 2007 15:11:00 -0000 Subject: how to target the Intel 8051? Message-ID: Hi, I have some C code targeted for the Intel 8051. How do I go about using GCC to target the 8051, so I can generate an assembly output, or an Intel Hex output. Please send me all the necessary instructions/links for this. Regards, Danny From michael@kukat.de Mon Mar 5 16:02:00 2007 From: michael@kukat.de (Michael Kukat) Date: Mon, 05 Mar 2007 16:02:00 -0000 Subject: how to target the Intel 8051? In-Reply-To: References: Message-ID: <45EC3EF1.1070305@kukat.de> Hi, Danny Birdie schrieb: > I have some C code targeted for the Intel 8051. How do I go about > using GCC to target the 8051, so I can generate an assembly output, or > an Intel Hex output. does gcc really know about 8051? I think i used SDCC the last time i compiled C for the 8051. If you can read german, you may want to look here: http://www.mikrocontroller.net/articles/MCS51 This also might help (english): http://www.pjrc.com/tech/8051/ As i don't see any signs for gcc knowing about 8051, i don't assume that a driver exists for it. ...Michael From aph@redhat.com Mon Mar 5 16:13:00 2007 From: aph@redhat.com (Andrew Haley) Date: Mon, 05 Mar 2007 16:13:00 -0000 Subject: how to target the Intel 8051? In-Reply-To: References: Message-ID: <17900.16817.54522.911476@zebedee.pink> Danny Birdie writes: > Hi, > I have some C code targeted for the Intel 8051. How do I go about > using GCC to target the 8051, so I can generate an assembly output, or > an Intel Hex output. > > Please send me all the necessary instructions/links for this. The 8051 wouldn't be a good target for gcc. It's severely register starved, and the result would be very poor code density. Andrew. From vmakarov@redhat.com Mon Mar 5 16:47:00 2007 From: vmakarov@redhat.com (Vladimir Makarov) Date: Mon, 05 Mar 2007 16:47:00 -0000 Subject: DFA-scheduler In-Reply-To: <43215.10.129.41.35.1172946562.squirrel@www.cse.iitb.ac.in> References: <43215.10.129.41.35.1172946562.squirrel@www.cse.iitb.ac.in> Message-ID: <45EC495E.40103@redhat.com> P. Pavan Kumar wrote: >Respected sir, > > DFA pipeline hazard recognizer is used to avoid structural hazards. >While intra block(basic block scheduling) scheduling how data hazards are >avoided . DFA will take care of only structural hazards, but what about >data hazards. > >First cycle mutiple pass scheduling algorithm tries different schedules >and choose the best one. >intra block scheduling reorders the instructions within the basic block by >constructing DAG and based on LIST scheduling algorithm . >If First cycle mutiple pass algorithm chooses the best schedule then why >gcc needs intra block scheduling ? > The first cycle mutiple pass algorithm tries to increase number of insns issued on the same cycle while guaranting that the insn with the highest priority (the most important part of which is critical path length) will be issued on the same cycle. It can result in issuing not highest priority insn first. This algorithm is useful for VLIW processors. For example, a VLIW processor (e.g. FRV) requires to put integer insns at the start of VLIW and fp ones at the end. If fp insn has the highest priority, the scheduler without the first cycle mutiple pass algorithm will issue it first putting nops at the start of VLIW and the integer insns in the next VLIW. It means additional cycle for executing the insns. The scheduler with the algorithm will issue the insns on the same cycle (putting them in one VLIW). The algorithm was useful to speed up Itanium benchmarks. You could read more about this in an article about DFA in proceedings of the first gcc summit (you can find them on gcc web site). >Now gcc will do instruction scheduling beyond basic blocks i,e inter block >scheduling (region scheduling) then why gcc needs intrablock scheduling? > > BB scheduling is used only after the RA for all targets except for Itanium (historically there were no practically interblock movements after the RA, and there are even few of them even before the RA). Itanium port uses an extended block scheduling. There is recent Maxim's Kuvyrkov's proposal to make ebb scheduling working for all other targets. >what is command line option for enabling only intra block(with in basic >block) scheduling. and diabling all remaining intruction scheduling ( >trace, modulo etc). > > > Please, read the documentation. As I remember modulo scheduling and trace scheduling is not on by default. Forcing BB scheduling before the RA can be achieved by prohibiting interblock movements (please see gcc documentation). From iant@google.com Mon Mar 5 17:37:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Mon, 05 Mar 2007 17:37:00 -0000 Subject: gcc and SIMD In-Reply-To: <20070305103142.92029.qmail@web27408.mail.ukl.yahoo.com> References: <20070305103142.92029.qmail@web27408.mail.ukl.yahoo.com> Message-ID: ranjith kumar writes: > > > 2) In those header files all functions call > > > _builtin_ia32_*. Where those functions(body) are > > > defined? > > > > They are intrinsic functions automatically defined > > by the compiler. > Please tell me in what file they are defined. config/i386/i386.c defines the builtin functions support for x86 and x86_64. They expand into insn patterns described mostly in i386.md, some in other .md files in that directory. Ian From maurizio_vitale@verizon.net Mon Mar 5 18:11:00 2007 From: maurizio_vitale@verizon.net (Maurizio Vitale) Date: Mon, 05 Mar 2007 18:11:00 -0000 Subject: gcc and SIMD In-Reply-To: <20070305103142.92029.qmail@web27408.mail.ukl.yahoo.com> References: <20070305103142.92029.qmail@web27408.mail.ukl.yahoo.com> Message-ID: <3369CBB2-0874-4F64-8BCB-B4D7CFE7E605@verizon.net> you can answer your questions yourself with a few Unix commands. If you want to know where __builtin_X is defined, start with all files in which it is used: find . -type f | xargs egrep -l __builtin_X [run from the top gcc directory] if you suspect that something is architecture specific you can limit the search to your architecture of interest by replacing '.' with the correct directory. But for the __builtin_* functions, you may end up with nothing: defined by the compiler means that GCC knows how to replace those calls with RTL (or maybe these days w/ higher level representations). So there's no function called __builtin_X. It is still likely that the __builtin_X names are mentioned somewhere in the code or comments around where the replacement happens. On Mar 5, 2007, at 5:31 AM, ranjith kumar wrote: > > --- Ian Lance Taylor wrote: > >> ranjith kumar writes: >> >>> 1) Seems that all defintions for MMX, SSE and >> SSE2 >>> are deinred in mmtrin.h,xmmintrin.h and >> emmintrin.h >>> header files respectively. Am I right? >> >> Yes. >> >>> 2) In those header files all functions call >>> _builtin_ia32_*. Where those functions(body) are >>> defined? >> >> They are intrinsic functions automatically defined >> by the compiler. > Please tell me in what file they are defined. > >> >>> 3) I thought that associated with each SIMD >>> instruction defined in Intel-ia-32-architectures >>> manual(Basic architecture) there is one function >>> defined in those header files. >>> But for some instructions no functions were >> defined in >>> those header files.(For example MOVDQA >> instruction) >>> Also those header files contain some more >> functions >>> for which no SIMD assembly instruction >> exist.Example >>> in emmintrin.h >>> static __inline __m128i >>> _mm_load_si128 (__m128i const *__P) >>> { >>> return (__m128i) __builtin_ia32_loaddqa ((char >>> const *)__P); >>> } >>> What could be the reason? >> >> Those header files follow the implementation >> described by Intel. > In which file they are described? > The thing is that I want to go into internals of it. > Thanks in advance. >> >> Ian >> > > > > > ___________________________________________________________ > All New Yahoo! Mail ? Tired of unwanted email come-ons? Let our > SpamGuard protect you. http://uk.docs.yahoo.com/nowyoucan.html > > From pcech@vision.ee.ethz.ch Mon Mar 5 19:15:00 2007 From: pcech@vision.ee.ethz.ch (Peter Cech) Date: Mon, 05 Mar 2007 19:15:00 -0000 Subject: GCC Versioning Policy In-Reply-To: <34128.60174.qm@web30704.mail.mud.yahoo.com> References: <34128.60174.qm@web30704.mail.mud.yahoo.com> Message-ID: <20070305181144.GH28834@ee.ethz.ch> On Sun, Mar 04, 2007 at 20:37:43 -0800, sankar chebolu wrote: > Hi, > Any document available which explains the GCC > Versioning policy/scheme? Did not stumble upon any so far, but I can offer what I gathered around. GCC is not using any odd/even (or stable/unstable) notion in the versioning. Each X.Y.z version is stable release. Each release series starts with number X.Y.0 and is maintained in a separate branch that is in regression fixes only mode. That means, no new features, only bugfixes will appear in X.Y.1 and later patch releases. If a bugfix is too intrusive, it is not applied to release series (the reason is that intrusive changes are likely to introduce new bugs), instead the bug is fixed in the current developer branch (that will become next release series in the future). The GCC website (http://gcc.gnu.org) has a status and history section where you can have a look at the changes, current status of the series and list of regressions (bugs that did not occur in a previous versions of GCC) against the series. Generally, X.Y.0 contain new features, so you are more likely to encounter a bug. Personally I'm waiting for X.Y.1 or X.Y.2 when switching to newer version of the compiler. If there are big changes (like between 3.4 and 4.0) or if you want to use brand new feature, it might be wise to wait a bit longer. > Among GCC 4.0.4 & 4.1.2 which one is more stable? Both should be in a reasonably good shape, but as the internal representation changed in the 4.0 series, I would go for 4.1.2 (as I mentioned above, there is a category of bugs that cannot be fully fixed on a release branch, but are likely fixed before the next X.Y release). Hope it helps. Peter From dqarras@yahoo.com Mon Mar 5 23:10:00 2007 From: dqarras@yahoo.com (Daniel Qarras) Date: Mon, 05 Mar 2007 23:10:00 -0000 Subject: Using new gcc/glibc on an older system Message-ID: <653710.55422.qm@web36802.mail.mud.yahoo.com> Hi! > this might be a FAQ but I didn't find anything yet, so: > > On an older system it is rather trivial to install latest > binutils/gcc/gdb and then use them during development: just configure > them with --prefix=/some/path and add /some/path/bin in front of your > PATH (with GCC I'm also using LD_LIBRARY_PATH pointing to .o > files/libgcc.so). All those seem to work. However, when glibc comes > into play, nothing seems to be trivial anymore. There are two things > I'd like to do: > > 1) compile programs against a new glibc and then run those binaries > that require the new libc. > > 2) run any given existing program against the new glibc seems hairy: It turned out that I was using a bad snapshot, latest CVS versions works in both cases when running old or new programs with the new ld-linux.so.2 --library-path ... Cheers! ____________________________________________________________________________________ Looking for earth-friendly autos? Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center. http://autos.yahoo.com/green_center/ From seanm@seanm.ca Tue Mar 6 02:37:00 2007 From: seanm@seanm.ca (Sean MacLennan) Date: Tue, 06 Mar 2007 02:37:00 -0000 Subject: G++ and constructors Message-ID: <45ECA343.5030306@seanm.ca> Hi, I have been warned that the following can happen under another compiler. I don't think it can happen with g++, and frankly I don't think it can happen, but I was wondering if anybody could give a definitive answer. We have a singleton and a method to get the singleton that creates it if necessary. Assume lock and unlock just work ;) static myclass *instance = NULL; static myclass *myclass::get_instance() { if(instance == NULL) { lock(); if(instance == NULL) instance = new myclass(); unlock(); } return instance; } What was argued was that the new can be split it two parts. It can allocate the memory, assign this memory to instance, *then* call the constructor. So you have a race condition in a multi-threaded system where instance is non-null, but has not yet been initialized. I always thought that the new would not return until *after* the constructor had been called. Therefore, no race condition. I don't need work-arounds, I just need to know if the code ever could be split. Cheers, Sean MacLennan From sagrav@racsa.co.cr Tue Mar 6 03:00:00 2007 From: sagrav@racsa.co.cr (Gordiano Brunati) Date: Tue, 06 Mar 2007 03:00:00 -0000 Subject: gcc-4.1.2 configuration failed Message-ID: <1173148628.7617.4.camel@makumba> hello: I'm trying to configure gcc in my objdir from a separate source directory as recommended. I've installed gmp via apt-get. from: ubuntu 6.06 gcc-4.1.2 i686-pc-linux-gnu critical part of my config.log: configure:2177: checking how to compare bootstrapped objects configure:2281: checking for correct version of gmp.h configure:2294: gcc -c -g -O2 conftest.c 1>&5 configure:2284:17: error: gmp.h: No such file or directory configure: In function 'main': configure:2288: error: 'choke' undeclared (first use in this function) configure:2288: error: (Each undeclared identifier is reported only once configure:2288: error: for each function it appears in.) configure:2288: error: syntax error before 'me' configure: failed program was: #line 2283 "configure" #include "confdefs.h" #include "gmp.h" int main() { #if __GNU_MP_VERSION < 3 choke me #endif ; return 0; } can anybody help me? Thanks in advance. Rafael www.astrocosas.com From brian@dessent.net Tue Mar 6 05:38:00 2007 From: brian@dessent.net (Brian Dessent) Date: Tue, 06 Mar 2007 05:38:00 -0000 Subject: gcc-4.1.2 configuration failed References: <1173148628.7617.4.camel@makumba> Message-ID: <45ECD955.CB0E0A9@dessent.net> Gordiano Brunati wrote: > configure:2284:17: error: gmp.h: No such file or directory It looks like you don't have the headers installed. They are usually in a separate package (with -dev or -devel in the name) because they are only needed by developers (i.e. linking against the library), not for regular users that are just running binaries that use the library. So you need to double check that you got the right package. Brian From iant@google.com Tue Mar 6 08:12:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Tue, 06 Mar 2007 08:12:00 -0000 Subject: -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations In-Reply-To: <000f01c75ef9$ce78f650$6bd04c93@mul7.nec.com.au> References: <000f01c75ef9$ce78f650$6bd04c93@mul7.nec.com.au> Message-ID: "John Fisher" writes: > Is it necessary to specify all 4 of these warnings to get the maximum amount > of warnings in C code? Probably not. > I would expect that -Wmissing-prototypes implies -Wmissing-declarations > since I understand > prototype to mean exactly "new-style function declaration". -Wmissing-prototypes warns about void f (); void f (int i) { } (i.e., there is no previous declaration with a prototype). -Wmissing-declarations normally warns about void f (int i) { } (i.e., there is no previous declaration at all) which is a subset of -Wmissing-prototypes. I can't think of any case where -Wmissing-declarations will give a warning but -Wmissing-prototypes will not. There is what appears to be such a case in the compiler source code, but I don't see any way to trigger it with a valid program. Ian From kaminaga@sm.sony.co.jp Tue Mar 6 12:44:00 2007 From: kaminaga@sm.sony.co.jp (Hiroki Kaminaga) Date: Tue, 06 Mar 2007 12:44:00 -0000 Subject: wrong-code in -ftree-ter on arm? Message-ID: <20070306.170610.35008765.kaminaga@sm.sony.co.jp> Hi, The attached codes, snipped from linux kernel source code produce wrong code above -O1. $ arm-linux-gcc -O2 -c div64.S $ arm-linux-gcc -O2 -save-temps dodiv.c div64.o -o dodiv actual result: $ ./dodiv tbuf: <4>[ 52.305419] expected result: tbuf: <4>[ 0.305419] when compiled with -fno-tree-ter, the result was OK. I'm using gcc-4.1.2. The problem comes from bad argument passing to sprintf(), looking from dodiv.s: ... mov r2, r5 <<<<<< (1) mov ip, ip, lsr #6 mov r3, r5 <<<<<< (2) ldr r1, .L10+8 mov r0, r4 str ip, [sp, #0] bl sprintf Where (1) is loglev_char argument and (2) is (unsigned long)t argument in sprintf() in dodiv.c. Apparently, the loglev_char is also assigned to the first %5lu part of sprintf, which is the cause. I'm not sure if this is a gcc bug, since in div64.S obtained from linux kernel, comments that it is non standard for optimal code. Any hint/advice please? Thanks in Advance. (Hiroki Kaminaga) t -- -------------- next part -------------- #include #include #define __xl "r0" #define __xh "r1" #define __asmeq(x, y) ".ifnc " x "," y " ; .err ; .endif\n\t" #define do_div(n,base) \ ({ \ register unsigned int __base asm("r4") = base; \ register unsigned long long __n asm("r0") = n; \ register unsigned long long __res asm("r2"); \ register unsigned int __rem asm(__xh); \ asm( __asmeq("%0", __xh) \ __asmeq("%1", "r2") \ __asmeq("%2", "r0") \ __asmeq("%3", "r4") \ "bl __do_div64" \ : "=r" (__rem), "=r" (__res) \ : "r" (__n), "r" (__base) \ : "ip", "lr", "cc"); \ n = __res; \ __rem; \ }) #define default_message_loglevel 4 unsigned long long printk_clock(void){ return (unsigned long long) 0x12345678; } int main(void) { int loglev_char; char *p; char tbuf[50], *tp; unsigned tlen; unsigned long long t; unsigned long nanosec_rem; p = alloca(1024); if (p[0] == '<' ) { loglev_char = p[1]; } else { loglev_char = default_message_loglevel + '0'; } t = printk_clock(); nanosec_rem = do_div(t, 1000000000); tlen = sprintf(tbuf, "<%c>[%5lu.%06lu] ", loglev_char, (unsigned long)t, nanosec_rem/1000); printf("tbuf: %s\n", tbuf); return 0; } -------------- next part -------------- /* * linux/arch/arm/lib/div64.S * * Optimized computation of 64-bit dividend / 32-bit divisor * * Author: Nicolas Pitre * Created: Oct 5, 2003 * Copyright: Monta Vista Software, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ //#include #define ALIGN .align 4,0x90 #define ENTRY(name) \ .globl name ; \ ALIGN ; \ name: #ifdef __ARMEB__ #define xh r0 #define xl r1 #define yh r2 #define yl r3 #else #define xl r0 #define xh r1 #define yl r2 #define yh r3 #endif /* * __do_div64: perform a division with 64-bit dividend and 32-bit divisor. * * Note: Calling convention is totally non standard for optimal code. * This is meant to be used by do_div() from include/asm/div64.h only. * * Input parameters: * xh-xl = dividend (clobbered) * r4 = divisor (preserved) * * Output values: * yh-yl = result * xh = remainder * * Clobbered regs: xl, ip */ ENTRY(__do_div64) @ Test for easy paths first. subs ip, r4, #1 bls 9f @ divisor is 0 or 1 tst ip, r4 beq 8f @ divisor is power of 2 @ See if we need to handle upper 32-bit result. cmp xh, r4 mov yh, #0 blo 3f @ Align divisor with upper part of dividend. @ The aligned divisor is stored in yl preserving the original. @ The bit position is stored in ip. #if __LINUX_ARM_ARCH__ >= 5 clz yl, r4 clz ip, xh sub yl, yl, ip mov ip, #1 mov ip, ip, lsl yl mov yl, r4, lsl yl #else mov yl, r4 mov ip, #1 1: cmp yl, #0x80000000 cmpcc yl, xh movcc yl, yl, lsl #1 movcc ip, ip, lsl #1 bcc 1b #endif @ The division loop for needed upper bit positions. @ Break out early if dividend reaches 0. 2: cmp xh, yl orrcs yh, yh, ip subcss xh, xh, yl movnes ip, ip, lsr #1 mov yl, yl, lsr #1 bne 2b @ See if we need to handle lower 32-bit result. 3: cmp xh, #0 mov yl, #0 cmpeq xl, r4 movlo xh, xl movlo pc, lr @ The division loop for lower bit positions. @ Here we shift remainer bits leftwards rather than moving the @ divisor for comparisons, considering the carry-out bit as well. mov ip, #0x80000000 4: movs xl, xl, lsl #1 adcs xh, xh, xh beq 6f cmpcc xh, r4 5: orrcs yl, yl, ip subcs xh, xh, r4 movs ip, ip, lsr #1 bne 4b mov pc, lr @ The top part of remainder became zero. If carry is set @ (the 33th bit) this is a false positive so resume the loop. @ Otherwise, if lower part is also null then we are done. 6: bcs 5b cmp xl, #0 moveq pc, lr @ We still have remainer bits in the low part. Bring them up. #if __LINUX_ARM_ARCH__ >= 5 clz xh, xl @ we know xh is zero here so... add xh, xh, #1 mov xl, xl, lsl xh mov ip, ip, lsr xh #else 7: movs xl, xl, lsl #1 mov ip, ip, lsr #1 bcc 7b #endif @ Current remainder is now 1. It is worthless to compare with @ divisor at this point since divisor can not be smaller than 3 here. @ If possible, branch for another shift in the division loop. @ If no bit position left then we are done. movs ip, ip, lsr #1 mov xh, #1 bne 4b mov pc, lr 8: @ Division by a power of 2: determine what that divisor order is @ then simply shift values around #if __LINUX_ARM_ARCH__ >= 5 clz ip, r4 rsb ip, ip, #31 #else mov yl, r4 cmp r4, #(1 << 16) mov ip, #0 movhs yl, yl, lsr #16 movhs ip, #16 cmp yl, #(1 << 8) movhs yl, yl, lsr #8 addhs ip, ip, #8 cmp yl, #(1 << 4) movhs yl, yl, lsr #4 addhs ip, ip, #4 cmp yl, #(1 << 2) addhi ip, ip, #3 addls ip, ip, yl, lsr #1 #endif mov yh, xh, lsr ip mov yl, xl, lsr ip rsb ip, ip, #32 orr yl, yl, xh, lsl ip mov xh, xl, lsl ip mov xh, xh, lsr ip mov pc, lr @ eq -> division by 1: obvious enough... 9: moveq yl, xl moveq yh, xh moveq xh, #0 moveq pc, lr @ Division by 0: str lr, [sp, #-4]! bl __div0 @ as wrong as it could be... mov yl, #0 mov yh, #0 mov xh, #0 ldr pc, [sp], #4 From eljay@adobe.com Tue Mar 6 12:46:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Tue, 06 Mar 2007 12:46:00 -0000 Subject: G++ and constructors In-Reply-To: <45ECA343.5030306@seanm.ca> Message-ID: Hi Sean, > I don't need work-arounds, I just need to know if the code ever could be > split. Yes. The code can be split (assuming that "lock()" and "unlock()" are not performing some thread "critical protection" locking for you). Although you didn't ask for work-arounds, here's a work-around that works for GCC, but may not work in C++ in general*. GCC uses threading protection for static objects. So this variant of your routine, in GCC, should be thread safe: ---------------------------------------------------------------------- myclass* myclass::init_instance() // private: static { return new myclass(); } myclass* myclass::get_instance() // public: static { static myclass* instance = InitInstance(); return instance; } ---------------------------------------------------------------------- HTH, --Eljay * since ISO 14882 C++ punted on the whole threading issue**. ** ... and on a standard C++ ABI, on modules, on... well, lots of stuff for various reasons***. *** some good reasons, some bad reasons -- depending on one's point of view. From eljay@adobe.com Tue Mar 6 14:58:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Tue, 06 Mar 2007 14:58:00 -0000 Subject: G++ and constructors In-Reply-To: Message-ID: Note: I put in the init_instance() presuming you wanted to do some extra work in there -- such as whatever lock() and unlock() are doing. If you don't need to do any extra work, then you can collapse it to the simpler: ---------------------------------------------------------------------- myclass* myclass::get_instance() // public: static { static myclass* instance = new myclass; return instance; } ---------------------------------------------------------------------- Sorry if I previous more complicated example caused confusion. --Eljay From dreams_arpit@yahoo.co.in Tue Mar 6 15:54:00 2007 From: dreams_arpit@yahoo.co.in (arpit jain) Date: Tue, 06 Mar 2007 15:54:00 -0000 Subject: Cross compiler build.... Message-ID: <999329.54724.qm@web8403.mail.in.yahoo.com> Hiiiii, I am trying to build gcc-3.x cross compiler for Ada language for some embbedded target platform. I have already build 1.binutils (i.e. cross assembler,cross linker) 2.newlib 1.14.0 I wanna to know: 1. Is it necessary to build newlib for Ada also bcoz i think its for c language only? 2. What are the steps to build newlib? Thanks & Regards Arpit __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/ From kickslop@yahoo.com Tue Mar 6 15:57:00 2007 From: kickslop@yahoo.com (Charles Blaine) Date: Tue, 06 Mar 2007 15:57:00 -0000 Subject: GCC 4.1.1 build failure in libjava - RHELv4 Message-ID: <876767.43937.qm@web61318.mail.yahoo.com> Building GCC 4.1.1 fails with both GCC 3.4.6 and 4.1.0 as provided by Red Hat (at the same spot) Building from source is a requirement for us. Any ideas? mkdir build cd build ../gcc-4.1.1/configure --prefix=/my/path --disable-shared make bootstrap ... make[7]: Entering directory `/utopia/tmp/build/i686-pc-linux-gnu/libjava/classpath/native/jni/midi-alsa' make[7]: *** No rule to make target `gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c', needed by `gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.lo'. Stop. ____________________________________________________________________________________ Finding fabulous fares is fun. Let Yahoo! FareChase search your favorite travel sites to find flight and hotel bargains. http://farechase.yahoo.com/promo-generic-14795097 From karuottu@mbnet.fi Tue Mar 6 16:01:00 2007 From: karuottu@mbnet.fi (Kai Ruottu) Date: Tue, 06 Mar 2007 16:01:00 -0000 Subject: Cross compiler build.... In-Reply-To: <999329.54724.qm@web8403.mail.in.yahoo.com> References: <999329.54724.qm@web8403.mail.in.yahoo.com> Message-ID: <45ED9030.5080104@mbnet.fi> arpit jain kirjoitti: > Hiiiii, > > I am trying to build gcc-3.x cross compiler for Ada > language for some embbedded target platform. > I have already build > 1.binutils (i.e. cross assembler,cross linker) > 2.newlib 1.14.0 > > I wanna to know: > 1. Is it necessary to build newlib for Ada also bcoz i > think its for c language only? > I would assume that what Rupert Wood wrote earlier is true, the Ada libraries will require functions from the C library! Checking this is easy, just write 'nm libgnat.a | less' for the host 'libgnat.a' and see what kind of symbols will appear as 'U' (unknown). The first 'C like function' I saw there was 'memcpy' and it was there in 84 places : Dell:/usr/local/lib/gcc-lib/i586-suse-linux9.2/3.4.6/adalib # nm libgnat.a | grep memcpy | wc -l 84 Just try to remember some common C functions and see whether they are required in 'libgnat.a' and such. So having the C library too is obligatory with GNU Ada. Also C++ and Fortran libraries use fuctions from the C library, they aren't "stand-alone" either. > 2. What are the steps to build newlib? > If you have already built newlib-1.14.0 then you already know.... Generally the steps are the usual 'configure', 'build' and 'install'. From aph@redhat.com Tue Mar 6 16:04:00 2007 From: aph@redhat.com (Andrew Haley) Date: Tue, 06 Mar 2007 16:04:00 -0000 Subject: GCC 4.1.1 build failure in libjava - RHELv4 In-Reply-To: <876767.43937.qm@web61318.mail.yahoo.com> References: <876767.43937.qm@web61318.mail.yahoo.com> Message-ID: <17901.36945.879694.20490@zebedee.pink> Charles Blaine writes: > Building GCC 4.1.1 fails with both GCC 3.4.6 and 4.1.0 as provided by Red Hat > (at the same spot) > > Building from source is a requirement for us. Any ideas? > > > mkdir build > > cd build > > ../gcc-4.1.1/configure --prefix=/my/path --disable-shared > > make bootstrap > ... > make[7]: Entering directory > `/utopia/tmp/build/i686-pc-linux-gnu/libjava/classpath/native/jni/midi-alsa' > make[7]: *** No rule to make target > `gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c', needed by > `gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.lo'. Stop. I can't remember seeing anything like this before. This file should be present as gcc/classpath/native/jni/midi-alsa/.svn/text-base/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c Is it present in your source tree? It is possible that using a relative path to configure is screwing things up. Try /utopia/tmp/configure --prefix=/my/path --disable-shared Andrew. From aph@redhat.com Tue Mar 6 16:13:00 2007 From: aph@redhat.com (Andrew Haley) Date: Tue, 06 Mar 2007 16:13:00 -0000 Subject: GCC 4.1.1 build failure in libjava - RHELv4 In-Reply-To: <17901.36945.879694.20490@zebedee.pink> References: <876767.43937.qm@web61318.mail.yahoo.com> <17901.36945.879694.20490@zebedee.pink> Message-ID: <17901.37102.335142.506171@zebedee.pink> Andrew Haley writes: > Charles Blaine writes: > > Building GCC 4.1.1 fails with both GCC 3.4.6 and 4.1.0 as provided by Red Hat > > (at the same spot) > > > > Building from source is a requirement for us. Any ideas? > > > > > > mkdir build > > > > cd build > > > > ../gcc-4.1.1/configure --prefix=/my/path --disable-shared > > > > make bootstrap > > ... > > make[7]: Entering directory > > `/utopia/tmp/build/i686-pc-linux-gnu/libjava/classpath/native/jni/midi-alsa' > > make[7]: *** No rule to make target > > `gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c', needed by > > `gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.lo'. Stop. > > I can't remember seeing anything like this before. This file should > be present as > gcc/classpath/native/jni/midi-alsa/.svn/text-base/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c Typo, sorry gcc/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c > > Is it present in your source tree? > > It is possible that using a relative path to configure is screwing > things up. Try > > /utopia/tmp/configure --prefix=/my/path --disable-shared > > Andrew. From avi@qumranet.com Tue Mar 6 16:20:00 2007 From: avi@qumranet.com (Avi Kivity) Date: Tue, 06 Mar 2007 16:20:00 -0000 Subject: Inline assembly constraints for a specific register Message-ID: <45ED926E.9090400@qumranet.com> How can I specify a constraint for a specific register, for example r8 on x86_64? I can specify any of rax, rbx, rcx, and rdx using a,b, c, and d. But what about the rest of the register file? -- error compiling committee.c: too many arguments to function From kickslop@yahoo.com Tue Mar 6 16:21:00 2007 From: kickslop@yahoo.com (Charles Blaine) Date: Tue, 06 Mar 2007 16:21:00 -0000 Subject: GCC 4.1.1 build failure in libjava - RHELv4 Message-ID: <626220.58377.qm@web61321.mail.yahoo.com> Nope -- file ends in '.' not '.c' build:utopia> ls ../gcc-4.1.1/libjava/classpath/native/jni/midi-alsa/ gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c Makefile.am gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice. Makefile.in gnu_javax_sound_midi_alsa_AlsaPortDevice.c build:utopia> I confirmed that the gcc-4.1.1.tar.gz I downloaded some time ago from gnu.org has the broken file suffix as well (in the tar.gz). ----- Original Message ---- From: Andrew Haley To: Charles Blaine ; gcc-help@gcc.gnu.org Sent: Tuesday, March 6, 2007 11:03:58 AM Subject: Re: GCC 4.1.1 build failure in libjava - RHELv4 Andrew Haley writes: > Charles Blaine writes: > > Building GCC 4.1.1 fails with both GCC 3.4.6 and 4.1.0 as provided by Red Hat > > (at the same spot) > > > > Building from source is a requirement for us. Any ideas? > > > > > > mkdir build > > > > cd build > > > > ../gcc-4.1.1/configure --prefix=/my/path --disable-shared > > > > make bootstrap > > ... > > make[7]: Entering directory > > `/utopia/tmp/build/i686-pc-linux-gnu/libjava/classpath/native/jni/midi-alsa' > > make[7]: *** No rule to make target > > `gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c', needed by > > `gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.lo'. Stop. > > I can't remember seeing anything like this before. This file should > be present as > gcc/classpath/native/jni/midi-alsa/.svn/text-base/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c Typo, sorry gcc/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c > > Is it present in your source tree? > > It is possible that using a relative path to configure is screwing > things up. Try > > /utopia/tmp/configure --prefix=/my/path --disable-shared > > Andrew. ____________________________________________________________________________________ Don't pick lemons. See all the new 2007 cars at Yahoo! Autos. http://autos.yahoo.com/new_cars.html From aph@redhat.com Tue Mar 6 16:31:00 2007 From: aph@redhat.com (Andrew Haley) Date: Tue, 06 Mar 2007 16:31:00 -0000 Subject: Inline assembly constraints for a specific register In-Reply-To: <45ED926E.9090400@qumranet.com> References: <45ED926E.9090400@qumranet.com> Message-ID: <17901.38148.968808.545168@zebedee.pink> Avi Kivity writes: > How can I specify a constraint for a specific register, for example r8 > on x86_64? > > I can specify any of rax, rbx, rcx, and rdx using a,b, c, and d. But > what about the rest of the register file? Like this: int poo (int N) { register int zz __asm__ ("r8") = N; __asm__ ("mov %0, %0" : "+r"(zz)); return zz; } Andrew. From wivanov@csodessa.com Tue Mar 6 16:45:00 2007 From: wivanov@csodessa.com (W. Ivanov) Date: Tue, 06 Mar 2007 16:45:00 -0000 Subject: BUG: wrong function call Message-ID: <45ED96B3.9020906@csodessa.com> -------------- next part -------------- An embedded message was scrubbed... From: "W. Ivanov" Subject: BUG: wrong function call Date: Tue, 06 Mar 2007 17:19:12 +0200 Size: 600 URL: From eljay@adobe.com Tue Mar 6 17:55:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Tue, 06 Mar 2007 17:55:00 -0000 Subject: BUG: wrong function call In-Reply-To: <45ED96B3.9020906@csodessa.com> Message-ID: Hi W. Ivanov, Please provide a short, compilable, stand-alone code example that demonstrates the problem you are experiencing. Also, what version of GCC are you using? What platform are you compiling and running on? Thanks, --Eljay From aph@redhat.com Tue Mar 6 18:17:00 2007 From: aph@redhat.com (Andrew Haley) Date: Tue, 06 Mar 2007 18:17:00 -0000 Subject: GCC 4.1.1 build failure in libjava - RHELv4 In-Reply-To: <626220.58377.qm@web61321.mail.yahoo.com> References: <626220.58377.qm@web61321.mail.yahoo.com> Message-ID: <17901.43794.175421.992233@zebedee.pink> Please don't top-post. Charles Blaine writes: > From: Andrew Haley > Andrew Haley writes: > > Charles Blaine writes: > > > Building GCC 4.1.1 fails with both GCC 3.4.6 and 4.1.0 as provided by Red Hat > > > (at the same spot) > > > > > > Building from source is a requirement for us. Any ideas? > > > > > > > > > mkdir build > > > > > > cd build > > > > > > ../gcc-4.1.1/configure --prefix=/my/path --disable-shared > > > > > > make bootstrap > > > ... > > > make[7]: Entering directory > > > `/utopia/tmp/build/i686-pc-linux-gnu/libjava/classpath/native/jni/midi-alsa' > > > make[7]: *** No rule to make target > > > `gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c', needed by > > > `gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.lo'. Stop. > > > > I can't remember seeing anything like this before. This file should > > be present as > > gcc/classpath/native/jni/midi-alsa/.svn/text-base/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c > > Typo, sorry > > gcc/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c > > > > > Is it present in your source tree? > Nope -- file ends in '.' not '.c' > > build:utopia> ls ../gcc-4.1.1/libjava/classpath/native/jni/midi-alsa/ > > gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c Makefile.am > > gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice. Makefile.in > > gnu_javax_sound_midi_alsa_AlsaPortDevice.c > > build:utopia> > > I confirmed that the gcc-4.1.1.tar.gz I downloaded some time ago > from gnu.org has the broken file suffix as well (in the tar.gz). It's ok at ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.1.1/gcc-4.1.1.tar.bz2: gcc-4.1.1/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaPortDevice.c gcc-4.1.1/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c gcc-4.1.1/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c gcc-4.1.1/libjava/classpath/native/jni/classpath/ Where did you get gcc-4.1.1.tar.gz ? :-) Andrew. From ranjit_kumar_b4u@yahoo.co.uk Tue Mar 6 19:35:00 2007 From: ranjit_kumar_b4u@yahoo.co.uk (ranjith kumar) Date: Tue, 06 Mar 2007 19:35:00 -0000 Subject: Folding built-in functions Message-ID: <20070306181652.9029.qmail@web27414.mail.ukl.yahoo.com> Gcc manuals says all builtin functions are folded in tree optimization passe(given below) that are run after gimplification http://gcc.gnu.org/onlinedocs/gccint/Tree_002dSSA-passes.html#Tree_002dSSA-passes >Folding built-in functions >This pass simplifies built-in functions, as applicable, >with constant arguments or with inferrable string >lengths. It is located in tree-ssa-ccp.c and is >described by pass_fold_builtins. 1)I find _builtin* functions in mmintrin.h, xmmintrin.h and emmintrin.h........ I think 'Folding built-in functions' is the pass that replaces _builtin functions when a program is compiled. Am I right? ___________________________________________________________ New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at the Yahoo! Mail Championships. Plus: play games and win prizes. http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk From kickslop@yahoo.com Wed Mar 7 01:11:00 2007 From: kickslop@yahoo.com (Charles Blaine) Date: Wed, 07 Mar 2007 01:11:00 -0000 Subject: GCC 4.1.1 build failure in libjava - RHELv4 Message-ID: <970893.62653.qm@web61318.mail.yahoo.com> Sorry for "top posting", Andrew :) In my 14 years on the internet I've never been scolded for it. I guess everyone has preferences (I personally hate when people reply in-line -- I know what the conversation is about already, don't make me dig through the whole message exchange to find your latest comments! :) As you can see below, using 'reply-all' via Yahoo Mail does not put '>' marks or any other quote nesting. Replying in-line would be very confusing in this case. Sorry, Yahoo Mail is what I use for all of my mailing list subscriptions in order to avoid spam at my "real/personal" account. Anyway... I do not know exactly where I got the gcc-4.1.1.tar.gz, but it was surely a GNU mirror or gnu.org itself. The timestamp on my copy is September 26, 2006. Oh well -- thanks for the help. Renaming the file solved the problem. ----- Original Message ---- From: Andrew Haley To: Charles Blaine Cc: gcc-help@gcc.gnu.org Sent: Tuesday, March 6, 2007 12:55:30 PM Subject: Re: GCC 4.1.1 build failure in libjava - RHELv4 Please don't top-post. Charles Blaine writes: > From: Andrew Haley > Andrew Haley writes: > > Charles Blaine writes: > > > Building GCC 4.1.1 fails with both GCC 3.4.6 and 4.1.0 as provided by Red Hat > > > (at the same spot) > > > > > > Building from source is a requirement for us. Any ideas? > > > > > > > > > mkdir build > > > > > > cd build > > > > > > ../gcc-4.1.1/configure --prefix=/my/path --disable-shared > > > > > > make bootstrap > > > ... > > > make[7]: Entering directory > > > `/utopia/tmp/build/i686-pc-linux-gnu/libjava/classpath/native/jni/midi-alsa' > > > make[7]: *** No rule to make target > > > `gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c', needed by > > > `gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.lo'. Stop. > > > > I can't remember seeing anything like this before. This file should > > be present as > > gcc/classpath/native/jni/midi-alsa/.svn/text-base/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c > > Typo, sorry > > gcc/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c > > > > > Is it present in your source tree? > Nope -- file ends in '.' not '.c' > > build:utopia> ls ../gcc-4.1.1/libjava/classpath/native/jni/midi-alsa/ > > gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c Makefile.am > > gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice. Makefile.in > > gnu_javax_sound_midi_alsa_AlsaPortDevice.c > > build:utopia> > > I confirmed that the gcc-4.1.1.tar.gz I downloaded some time ago > from gnu.org has the broken file suffix as well (in the tar.gz). It's ok at ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.1.1/gcc-4.1.1.tar.bz2: gcc-4.1.1/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaPortDevice.c gcc-4.1.1/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c gcc-4.1.1/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c gcc-4.1.1/libjava/classpath/native/jni/classpath/ Where did you get gcc-4.1.1.tar.gz ? :-) Andrew. ____________________________________________________________________________________ Bored stiff? Loosen up... Download and play hundreds of games for free on Yahoo! Games. http://games.yahoo.com/games/front From kaminaga@sm.sony.co.jp Wed Mar 7 16:23:00 2007 From: kaminaga@sm.sony.co.jp (Hiroki Kaminaga) Date: Wed, 07 Mar 2007 16:23:00 -0000 Subject: wrong-code in -ftree-ter on arm? In-Reply-To: <20070306.170610.35008765.kaminaga@sm.sony.co.jp> References: <20070306.170610.35008765.kaminaga@sm.sony.co.jp> Message-ID: <20070307.100454.131914938.kaminaga@sm.sony.co.jp> Hi, From: Hiroki Kaminaga > > The attached codes, snipped from linux kernel source code produce > wrong code above -O1. May I file this into bugzilla? Best Regards, -- From satyaakam@gmail.com Wed Mar 7 16:33:00 2007 From: satyaakam@gmail.com (satyaakam goswami) Date: Wed, 07 Mar 2007 16:33:00 -0000 Subject: libg2c.a missing in 4.1.1 Message-ID: <6491e1350703070822x63a7c795ge815c6219a8447b8@mail.gmail.com> Hi, Noticed libg2c.a is missing in /lib in 4.1.1 hierarchy , whats the equivalent of libg2c.a in gcc 4.1.1 , any pointers . Satya From daniel.lohmann@informatik.uni-erlangen.de Wed Mar 7 16:40:00 2007 From: daniel.lohmann@informatik.uni-erlangen.de (Daniel Lohmann) Date: Wed, 07 Mar 2007 16:40:00 -0000 Subject: G++ and constructors In-Reply-To: References: Message-ID: <45EEE953.3090409@informatik.uni-erlangen.de> John Love-Jensen schrieb: > [...] > Although you didn't ask for work-arounds, here's a work-around that works > for GCC, but may not work in C++ in general*. > > GCC uses threading protection for static objects. > > So this variant of your routine, in GCC, should be thread safe: > > ---------------------------------------------------------------------- > myclass* myclass::init_instance() // private: static > { > return new myclass(); > } > > myclass* myclass::get_instance() // public: static > { > static myclass* instance = InitInstance(); > return instance; > } > ---------------------------------------------------------------------- *GCC* does the threading protection? I really wonder how! How can GCC achieve this on every platform (especially embedded targets such as AVR, H8, ARM) without help from the runtime? (I haven't seen any dependencies to RTL functions in such case.) Is this implemented using interruption-transparent algorithms / atomic operations or does the above simply hold only for some specific platform? Daniel From brian@dessent.net Wed Mar 7 17:11:00 2007 From: brian@dessent.net (Brian Dessent) Date: Wed, 07 Mar 2007 17:11:00 -0000 Subject: libg2c.a missing in 4.1.1 References: <6491e1350703070822x63a7c795ge815c6219a8447b8@mail.gmail.com> Message-ID: <45EEEA84.2D9ECAF0@dessent.net> satyaakam goswami wrote: > Noticed libg2c.a is missing in /lib in 4.1.1 hierarchy , whats > the equivalent of libg2c.a in gcc 4.1.1 , any pointers . libg2c was part of g77, which was dropped in gcc 4.x. The replacement, gfortran, does not have any such library. The functions that used to be in that library are implemented as intrinsics, and so -lg2c should not be necessary (but see also -ff2c). Brian From satyaakam@gmail.com Wed Mar 7 21:27:00 2007 From: satyaakam@gmail.com (satyaakam goswami) Date: Wed, 07 Mar 2007 21:27:00 -0000 Subject: libg2c.a missing in 4.1.1 In-Reply-To: <45EEEA84.2D9ECAF0@dessent.net> References: <6491e1350703070822x63a7c795ge815c6219a8447b8@mail.gmail.com> <45EEEA84.2D9ECAF0@dessent.net> Message-ID: <6491e1350703070911q26b086ccsad3a36b23cbefcb3@mail.gmail.com> On 3/7/07, Brian Dessent wrote: > satyaakam goswami wrote: > > > Noticed libg2c.a is missing in /lib in 4.1.1 hierarchy , whats > > the equivalent of libg2c.a in gcc 4.1.1 , any pointers . > > libg2c was part of g77, which was dropped in gcc 4.x. The replacement, > gfortran, does not have any such library. The functions that used to be > in that library are implemented as intrinsics, and so -lg2c should not > be necessary (but see also -ff2c). do you mean we can use -lf2c instead of -lg2c Satya From michael.haubenwallner@salomon.at Wed Mar 7 22:47:00 2007 From: michael.haubenwallner@salomon.at (Michael Haubenwallner) Date: Wed, 07 Mar 2007 22:47:00 -0000 Subject: platform specific information for aix5.3 Message-ID: <1173303004.22557.25.camel@localhost> Hi, there's one more thing which IMO should be mentioned on the platform-specific site: On AIX 5.3 there is a bug where 'thread_creds_t' is a global variable instead of a typedef in /usr/include/sys/threads.h In case of C, the linker may give 'duplicate symbol' on this one. What can happen in case of C++, see http://www-128.ibm.com/developerworks/forums/dw_thread.jsp?forum=747&thread=119546&cat=72 The workaround is to define 'thread_creds_t' to nothing: -Dthread_creds_t= This only affects AIX 5.3, not AIX <= 5.2. According to IBM, the fix for this APAR IY90737 is incorporated into Service Pack 5300-05-04. Thanks, /haubi/ From dpgood@gmail.com Wed Mar 7 23:18:00 2007 From: dpgood@gmail.com (Dana Good) Date: Wed, 07 Mar 2007 23:18:00 -0000 Subject: Alarm callbacks on Windows with Gnu or MinGW? Message-ID: Please excuse me if this is the wrong location for this post - I looked long and hard before I posted, and would be happy to be redirected! I am using C++ in Eclipse with CDT and MinGW on a Windows machine. I'd prefer not to use VC++. I would like to implement a simple alarm callback, a la 'C', where I set a timer to go off and use a signal catcher to catch the interrupt/exception/signal/whatever. (as, on Unix/Linux, signal(SIG_ALRM, FPTR); alarm(nsec); where FPTR is a pointer to a function that will asynchronously handle the signal SIG_ALRM) I don't find support for SIG_ALRM in MinGW, though other signals are defined. My Googles have left me fairly convinced that I can't do this without including the VC++ libraries - is this true? Thanks, Dana Good From brian@dessent.net Wed Mar 7 23:37:00 2007 From: brian@dessent.net (Brian Dessent) Date: Wed, 07 Mar 2007 23:37:00 -0000 Subject: Alarm callbacks on Windows with Gnu or MinGW? References: Message-ID: <45EF483F.E35A0171@dessent.net> Dana Good wrote: > Please excuse me if this is the wrong location for this post - I > looked long and hard before I posted, and would be happy to be > redirected! You'd get better responses on the MinGW list. > I am using C++ in Eclipse with CDT and MinGW on a Windows machine. > I'd prefer not to use VC++. > > I would like to implement a simple alarm callback, a la 'C', where I > set a timer to go off and use a signal catcher to catch the > interrupt/exception/signal/whatever. For this you need to use the Win32 API. See for example CreateWaitableTimer(), SetWaitableTimer(), WaitForSingleObject(), CreateThread/_beginthreadex and so on. See MSDN for details, or the platform SDK. http://msdn2.microsoft.com/en-us/library/ms681924(VS.85).aspx http://msdn2.microsoft.com/en-us/library/ms686967(VS.85).aspx etc. > My Googles have left me fairly convinced that I can't do this without > including the VC++ libraries - is this true? These are the APIs provided by the operating system; they have nothing to do with Visual C++. The w32api package includes all the import libraries necessary to link against any of these Win32 API dlls. Brian From dpgood@gmail.com Thu Mar 8 00:59:00 2007 From: dpgood@gmail.com (Dana Good) Date: Thu, 08 Mar 2007 00:59:00 -0000 Subject: Alarm callbacks on Windows with Gnu or MinGW? In-Reply-To: <45EF483F.E35A0171@dessent.net> References: <45EF483F.E35A0171@dessent.net> Message-ID: Many thanks! On 3/7/07, Brian Dessent wrote: > Dana Good wrote: > > > Please excuse me if this is the wrong location for this post - I > > looked long and hard before I posted, and would be happy to be > > redirected! > > You'd get better responses on the MinGW list. > > > I am using C++ in Eclipse with CDT and MinGW on a Windows machine. > > I'd prefer not to use VC++. > > > > I would like to implement a simple alarm callback, a la 'C', where I > > set a timer to go off and use a signal catcher to catch the > > interrupt/exception/signal/whatever. > > For this you need to use the Win32 API. See for example > CreateWaitableTimer(), SetWaitableTimer(), WaitForSingleObject(), > CreateThread/_beginthreadex and so on. See MSDN for details, or the > platform SDK. > > http://msdn2.microsoft.com/en-us/library/ms681924(VS.85).aspx > http://msdn2.microsoft.com/en-us/library/ms686967(VS.85).aspx > etc. > > > My Googles have left me fairly convinced that I can't do this without > > including the VC++ libraries - is this true? > > These are the APIs provided by the operating system; they have nothing > to do with Visual C++. The w32api package includes all the import > libraries necessary to link against any of these Win32 API dlls. > > Brian > From baucom@msg.ucsf.edu Thu Mar 8 05:37:00 2007 From: baucom@msg.ucsf.edu (Albion Baucom) Date: Thu, 08 Mar 2007 05:37:00 -0000 Subject: Compiling gfortran Message-ID: Can anyone suggest how I can get gfortran to compile as part of gcc 4.1.2? I am trying to compile on a 64-bit Xeon based dual processor system running CentOS 4.4 running kernel version 2.6.9-42.0.2.ELsmp x86_64. My gcc configuration options are ./configure --prefix=/home2/baucom/Applications/gcc --enable- languages=c,c++,fortran --with-mpfr=/home2/baucom/Applications/mpfr -- with-gmp=/home2/baucom/Applications/gmp I am experiencing a problem with a certain "kinds.h" file. The error message is pasted below. I have done web searches on this and come across suggestions, none of which worked. Specifically I have made certain that gmp is specified at the command line when I configure, along with mpfr and set my LD_LIBRARY_PATH to point to the libraries, and even tried compiling gmp for 32-bit with the config option ABI=32. Any ideas? Thanks Albion make[2]: Entering directory `/mnt/home2/baucom/src/gcc-4.1.2/x86_64- unknown-linux-gnu/libgfortran' /bin/sh ../.././libgfortran/mk-kinds-h.sh '/home2/baucom/src/ gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc/gfortran -B/home2/baucom/ src/gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc/ -B/home2/baucom/ Applications/gcc/x86_64-unknown-linux-gnu/bin/ -B/home2/baucom/ Applications/gcc/x86_64-unknown-linux-gnu/lib/ -isystem /home2/baucom/ Applications/gcc/x86_64-unknown-linux-gnu/include -isystem /home2/ baucom/Applications/gcc/x86_64-unknown-linux-gnu/sys-include -I . - Wall -fno-repack-arrays -fno-underscoring ' > kinds.h || rm kinds.h ../.././libgfortran/mk-kinds-h.sh: Unknown type grep '^#' < kinds.h > kinds.inc /bin/sh: kinds.h: No such file or directory make[2]: *** [kinds.inc] Error 1 make[2]: Leaving directory `/mnt/home2/baucom/src/gcc-4.1.2/x86_64- unknown-linux-gnu/libgfortran' make[1]: *** [all-target-libgfortran] Error 2 make[1]: Leaving directory `/mnt/home2/baucom/src/gcc-4.1.2' make: *** [all] Error 2 From satyaakam@gmail.com Thu Mar 8 07:51:00 2007 From: satyaakam@gmail.com (satyaakam goswami) Date: Thu, 08 Mar 2007 07:51:00 -0000 Subject: errors while using -lgfortran instead of libg2c.a Message-ID: <6491e1350703072137v5ebda308sac1ed4f50de82699@mail.gmail.com> we getting undefined symbol:`d_sign', please suggest. /tsi71/pubref/liba/lnx86_gcc_ia32/liblapack.a /tsi71/pubref/liba/lnx86_gcc_ia32/libblas.a /tsi71/pubref/liba/lnx86_gcc_ia32/liblamatrix++.a -lm -lgfortran /tsi71/pubref/liba/lnx86_gcc_ia32/liblapack++.a(dtimmg.o): In function `dtimmg_': dtimmg.c:(.text+0xe47): undefined reference to `d_sign' dtimmg.c:(.text+0xf11): undefined reference to `d_sign' dtimmg.c:(.text+0x1004): undefined reference to `d_sign' dtimmg.c:(.text+0x10de): undefined reference to `d_sign' dtimmg.c:(.text+0x120d): undefined reference to `d_sign' Satya From vtorri@univ-evry.fr Thu Mar 8 09:57:00 2007 From: vtorri@univ-evry.fr (Vincent Torri) Date: Thu, 08 Mar 2007 09:57:00 -0000 Subject: order of directories passed with -L Message-ID: Hey, Suppose that I pass those arguments to gcc : -Lpath1 -llib1 -Lpath2 -llib2 -L path3 -llib3 In which directory(ies) will gcc search lib1, lib2 and lib3 ? (gcc man page didn't help me) thank you Vincent Torri From castillo@teisa.unican.es Thu Mar 8 10:07:00 2007 From: castillo@teisa.unican.es (Juan Castillo) Date: Thu, 08 Mar 2007 10:07:00 -0000 Subject: where can I get gcc optimizations information Message-ID: <200703081057.45511.castillo@teisa.unican.es> Hello everybody. I need some help with gcc optimizations and I don't know where I can get it. The objective of my work is to estimate how many machine instructions I can save in a program execution employing compiler optimizations. I am working with ARM architecture. Anyway, I have understood that main gcc optimizations are architecture-independent. In the gcc user's manual I have read that flags -O, -O1, -O2, -O3 and -Os activate different optimization flags (starting with "-f", I think), but not all of them are available individually. If I switch on all flags available individually for -O1 (-fdefer-pop, -fmerge-constants...) they have no effect in obtained machine code, but if I compile with -O1 option, there is a reduction of about 50% in machine instructions number with respect to basic compilation. With these results, I suppose that -O1 performs more actions that are not reported in any document I have found in The Internet. I have downloaded the gcc source-code but it is too difficult for me to understand it. My question is: where can I get full information about gcc optimizations and how they are performed? And another question: would be possible to get a benchmark or similar for compiler optimizations? That is, some set of programs that estimate the save that a compiler can achieve. I know it depends on the algotihms compiled, employed architecture and more (please, don't remember me that...). I just need an estimation. That would be great for my work. I hope your answer. Thank you very much. I really think you are developing a great job. From aph@redhat.com Thu Mar 8 11:00:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 08 Mar 2007 11:00:00 -0000 Subject: where can I get gcc optimizations information In-Reply-To: <200703081057.45511.castillo@teisa.unican.es> References: <200703081057.45511.castillo@teisa.unican.es> Message-ID: <17903.57444.43797.324340@zebedee.pink> Juan Castillo writes: > I need some help with gcc optimizations and I don't know where I > can get it. > > The objective of my work is to estimate how many machine > instructions I can save in a program execution employing compiler > optimizations. I am working with ARM architecture. Anyway, I have > understood that main gcc optimizations are > architecture-independent. > > In the gcc user's manual I have read that flags -O, -O1, -O2, -O3 > and -Os activate different optimization flags (starting with "-f", > I think), but not all of them are available individually. If I > switch on all flags available individually for -O1 (-fdefer-pop, > -fmerge-constants...) they have no effect in obtained machine code, > but if I compile with -O1 option, there is a reduction of about 50% > in machine instructions number with respect to basic compilation. > > With these results, I suppose that -O1 performs more actions that > are not reported in any document I have found in The Internet. I > have downloaded the gcc source-code but it is too difficult for me > to understand it. My question is: where can I get full information > about gcc optimizations and how they are performed? Full information is in the source. As Euclid (or someone else!) may once have said, "There is no royal road to mathematics". If you are really to understand, you'll have to get in there some time. However, some things will help you. -fverbose-asm produces a list of optimization passes. The dumps "-da" and "-fdump-tree-all" produce a lot of files, one per optimization pass, so you can see what each pass did. Once you know which pass does what, you can start to look at the code. > And another question: would be possible to get a benchmark or > similar for compiler optimizations? That is, some set of programs > that estimate the save that a compiler can achieve. I know it > depends on the algotihms compiled, employed architecture and more > (please, don't remember me that...). I just need an > estimation. That would be great for my work. SPEC is a standard, but it's unfree and therefore off-topic here. Andrew. From me@rupey.net Thu Mar 8 11:22:00 2007 From: me@rupey.net (Rupert Wood) Date: Thu, 08 Mar 2007 11:22:00 -0000 Subject: where can I get gcc optimizations information In-Reply-To: <200703081057.45511.castillo@teisa.unican.es> References: <200703081057.45511.castillo@teisa.unican.es> Message-ID: <023001c76170$f615e550$e241aff0$@net> Juan Castillo wrote: > And another question: would be possible to get a benchmark or similar for > compiler optimizations? That is, some set of programs that estimate the save > that a compiler can achieve. I know it depends on the algotihms compiled, > employed architecture and more (please, don't remember me that...). I just > need an estimation. That would be great for my work. You could try asking Scott Robert Ladd: he was developing a benchmark suite for his own acovea work (genetic search for optimal optimization settings): http://gcc.gnu.org/ml/gcc/2004-08/msg00664.html He did post an old version for download but I can't find the link now. Rup. ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ From jopen@gmx.net Thu Mar 8 12:16:00 2007 From: jopen@gmx.net (Sascha Alexander Jopen) Date: Thu, 08 Mar 2007 12:16:00 -0000 Subject: dump-translation-unit format Message-ID: <000101c76174$24c55040$6e4ff0c0$@net> Hi, I'm currently working on the output of gcc/g++ -fdump-translation-unit to do source code analysis. I found several references that the internal ast should include nodes for for, while and do constructs. But I can't find those nodes in the dumped files. Sometimes there are such FOR_STMT nodes when I compile large units, but when compiling a small test unit containing not much more than a for loop, this loop isn't included in the dump. Instead there is a GOTO_EXPR where I would expect the for loop. This holds for other loops and conditional expressions as well. All FOR_STMT nodes I encountered where not from my custom code, but from templates from system includes. Are there any optimizations done on the tree before dumping it, and how can I prevent this to get an unoptimized tree? Are there other possibilities to get those loop nodes? I need them to check whether function calls are done in loops or not. Without the bodies of loops I can get information about functions called from other functions using the chain links, but not whether they are called within loops. Another thing I don't understand is the following. This dumped function node contains two body definitions, one undefined and one with a proper node chain. Is this a dump error or has it special meaning? @1639 function_decl name: @2001 mngl: @2002 type: @2003 scpe: @812 srcp: char_traits.h:322 chan: @2004 note: member accs: pub args: @2005 body: undefined link: extern body: @2006 Maybe someone could help me or point me to other resources. Thanks in advance, Sascha Jopen From crazguy22@hotmail.com Thu Mar 8 12:30:00 2007 From: crazguy22@hotmail.com (Shane R) Date: Thu, 08 Mar 2007 12:30:00 -0000 Subject: Linux c++ opmization--- linux runs at half the speed of windows? Message-ID: Hi, I hope this is the appropriate forum. Please direct me to the correct one if it is not. I am trying to optimize a c++ application that I ported from a windows system to Linux. The app is a terminal based application that does some one time file io at the start then runs completely in memory. After the one time io the app runs successive timed epochs on the same data in Windows as Linux. The app is a program that runs some code for doing non-linear optmization (math stuff). The reason why I am posting is that I timed the time it takes for the application to complete an epoch. It take twice as long in Linux as windows?!?! My system is an Intel Centrino Duo with 2gigs of ram. The application is only using a fraction of available memory in windows and linux. The application is single-threaded in both. I am using Visual Studio 2003 in Windows and when I type gcc -v I get: Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-checking=release i486-linux-gnu Thread model: posix gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) I am currently using these g++ options: CFLAGS = -o3 -O3 -march=pentium4 -ffast-math -funroll-loops -Wall -Wno-return-type But I have tried every permutation of the above options to virtually no effect The average run time of an epoch in windows is about 3000 milliseconds while the average run time of an epoch in Linux is 6000! I don't know if it matters but I am doing calls to the rand() function in both my windows and linux apps. On another note does anyone have any experience with the Intel drop in replacement for GCC? Thanks in advance for any help, Shane _________________________________________________________________ Match.com - Click Here To Find Singles In Your Area Today! http://match.engb.msn.com/ From aph@redhat.com Thu Mar 8 15:01:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 08 Mar 2007 15:01:00 -0000 Subject: Linux c++ opmization--- linux runs at half the speed of windows? In-Reply-To: References: Message-ID: <17904.492.460648.266863@zebedee.pink> Shane R writes: > I hope this is the appropriate forum. Please direct me to the correct one if > it is not. > > I am trying to optimize a c++ application that I ported from a windows > system to Linux. OK. > The app is a terminal based application that does some one time file io at > the start then runs completely in memory. After the one time io the app runs > successive timed epochs on the same data in Windows as Linux. The app is a > program that runs some code for doing non-linear optmization (math stuff). > > The reason why I am posting is that I timed the time it takes for the > application to complete an epoch. It take twice as long in Linux as > windows?!?! That is fairly unusual. > My system is an Intel Centrino Duo with 2gigs of ram. The application is > only using a fraction of available memory in windows and linux. The > application is single-threaded in both. > > I am using Visual Studio 2003 in Windows and when I type gcc -v I get: > Target: i486-linux-gnu > Configured with: ../src/configure -v > --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr > --enable-shared --with-system-zlib --libexecdir=/usr/lib > --without-included-gettext --enable-threads=posix --enable-nls > --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu > --enable-libstdcxx-debug --enable-mpfr --enable-checking=release > i486-linux-gnu > Thread model: posix > gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) > > > > I am currently using these g++ options: > > CFLAGS = -o3 -O3 -march=pentium4 -ffast-math -funroll-loops -Wall > -Wno-return-type > > But I have tried every permutation of the above options to virtually no > effect > > The average run time of an epoch in windows is about 3000 milliseconds while > the average run time of an epoch in Linux is 6000! > > I don't know if it matters but I am doing calls to the rand() function in > both my windows and linux apps. It might matter, yes. I suspect that the right approach is to do some profiling. Make sure oprofile is installed, then sudo opcontrol --init sudo opcontrol --start sudo opcontrol --stop opreport -l Let us know how you get along. You might be surprised where the time goes. Andrew. From r.atwood@imperial.ac.uk Thu Mar 8 16:10:00 2007 From: r.atwood@imperial.ac.uk (Atwood, Robert C) Date: Thu, 08 Mar 2007 16:10:00 -0000 Subject: Linux c++ opmization--- linux runs at half the speed of windows? In-Reply-To: Message-ID: <2CB39EAF0E0EFF498ADEDA636B8C999F04C392B3@icex1.ic.ac.uk> > On another note does anyone have any experience with the > Intel drop in > replacement for GCC? > > Thanks in advance for any help, > > Shane Yes but not very good experience, perhaps mediocre. I had very annoying problems with a bug in the intel optimizer .. It seemed like my code was way faster, until I noticed that it was not giving the correct results, and observed that the optimizer was reducing precision when it should not. There was also some case where it kept optimizing a=b; b=c; into effectively a=b=c; not the same thing at all! THe recommended workaround was to reduce the optimization level , at which point it was no longer faster and I had lost my own time faffing about with it. Since then that bug was supposedly fixed in later release, but they lost my confidence and convinced me further that free software is the way to go, not only for political, but also practical reasons. From eschenb@cs.uni-frankfurt.de Thu Mar 8 17:10:00 2007 From: eschenb@cs.uni-frankfurt.de (Sven Eschenberg) Date: Thu, 08 Mar 2007 17:10:00 -0000 Subject: Linux c++ opmization--- linux runs at half the speed of windows? In-Reply-To: References: Message-ID: <45F035B0.1050809@cs.uni-frankfurt.de> Hi Shane, I am wondering if you are using large memory support in linux (since you got 2GB)? I am asking, because on my system I experienced the following strange behavior: Compiling a whole package, which is fairly big the compile time varies strongly between the setup of using large memory support and when not using it. As soon as I use large memory support the compile times grows by a factor between 2 and 3, I never did a profiling, what exactly causes the slow down, it just seems obvious that the large memory support causes a massive slowdown (certainly on memory access). I wonder if you are basically having the same problem. Maybe, after collecting some profiling data, you might come to the conclusion that memory access takes a lot of time, maybe you could check against a kernel without large memory support. I might be completely wrong, but it came across my mind, since you got 2 GB of RAM and might have large memory support enabled. Regards -Sven Shane R wrote: > Hi, > > I hope this is the appropriate forum. Please direct me to the correct > one if it is not. > > I am trying to optimize a c++ application that I ported from a windows > system to Linux. > The app is a terminal based application that does some one time file > io at the start then runs completely in memory. After the one time io > the app runs successive timed epochs on the same data in Windows as > Linux. The app is a program that runs some code for doing non-linear > optmization (math stuff). > > The reason why I am posting is that I timed the time it takes for the > application to complete an epoch. It take twice as long in Linux as > windows?!?! > > My system is an Intel Centrino Duo with 2gigs of ram. The application > is only using a fraction of available memory in windows and linux. The > application is single-threaded in both. > > I am using Visual Studio 2003 in Windows and when I type gcc -v I get: > Target: i486-linux-gnu > Configured with: ../src/configure -v > --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr > --enable-shared --with-system-zlib --libexecdir=/usr/lib > --without-included-gettext --enable-threads=posix --enable-nls > --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu > --enable-libstdcxx-debug --enable-mpfr --enable-checking=release > i486-linux-gnu > Thread model: posix > gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) From iant@google.com Thu Mar 8 17:12:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Thu, 08 Mar 2007 17:12:00 -0000 Subject: wrong-code in -ftree-ter on arm? In-Reply-To: <20070307.100454.131914938.kaminaga@sm.sony.co.jp> References: <20070306.170610.35008765.kaminaga@sm.sony.co.jp> <20070307.100454.131914938.kaminaga@sm.sony.co.jp> Message-ID: Hiroki Kaminaga writes: > From: Hiroki Kaminaga > > > > The attached codes, snipped from linux kernel source code produce > > wrong code above -O1. > > May I file this into bugzilla? Yes. At least, I don't see an obvious problem here. See http://gcc.gnu.org/bugs.html for everything we want to know. Thanks. Ian From iant@google.com Thu Mar 8 17:16:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Thu, 08 Mar 2007 17:16:00 -0000 Subject: G++ and constructors In-Reply-To: <45EEE953.3090409@informatik.uni-erlangen.de> References: <45EEE953.3090409@informatik.uni-erlangen.de> Message-ID: Daniel Lohmann writes: > John Love-Jensen schrieb: > > [...] Although you didn't ask for work-arounds, here's a work-around > > that works > > for GCC, but may not work in C++ in general*. > > GCC uses threading protection for static objects. > > So this variant of your routine, in GCC, should be thread safe: > > ---------------------------------------------------------------------- > > myclass* myclass::init_instance() // private: static > > { > > return new myclass(); > > } > > myclass* myclass::get_instance() // public: static > > { > > static myclass* instance = InitInstance(); > > return instance; > > } > > ---------------------------------------------------------------------- > > *GCC* does the threading protection? > > I really wonder how! > > How can GCC achieve this on every platform (especially embedded > targets such as AVR, H8, ARM) without help from the runtime? (I > haven't seen any dependencies to RTL functions in such case.) > > Is this implemented using interruption-transparent algorithms / atomic > operations or does the above simply hold only for some specific > platform? Processor specific details can be found in libstdc++-v3/config/cpu. That code is used by the guard code in libstdc++-v3/libsupc++. Ian From iant@google.com Thu Mar 8 17:26:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Thu, 08 Mar 2007 17:26:00 -0000 Subject: order of directories passed with -L In-Reply-To: References: Message-ID: Vincent Torri writes: > Suppose that I pass those arguments to gcc : > > -Lpath1 -llib1 -Lpath2 -llib2 -L path3 -llib3 > > In which directory(ies) will gcc search lib1, lib2 and lib3 ? > > (gcc man page didn't help me) The -L and -l options are simply passed to the linker. So, look at the linker documentation. The answer here is that all the -L options are gathered together. The linker will search for the -l options in all of the -L options, even the ones that follow the -l option. Ian From iant@google.com Thu Mar 8 19:14:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Thu, 08 Mar 2007 19:14:00 -0000 Subject: Folding built-in functions In-Reply-To: <20070306181652.9029.qmail@web27414.mail.ukl.yahoo.com> References: <20070306181652.9029.qmail@web27414.mail.ukl.yahoo.com> Message-ID: ranjith kumar writes: > Gcc manuals says all builtin functions are folded in > tree optimization passe(given below) that are run > after gimplification > http://gcc.gnu.org/onlinedocs/gccint/Tree_002dSSA-passes.html#Tree_002dSSA-passes > > >Folding built-in functions > > >This pass simplifies built-in functions, as > applicable, >with constant arguments or with > inferrable string >lengths. It is located in > tree-ssa-ccp.c and is >described by > pass_fold_builtins. > > 1)I find _builtin* functions in mmintrin.h, > xmmintrin.h and emmintrin.h........ > I think 'Folding built-in functions' is the pass that > replaces _builtin functions when a program is > compiled. Am I right? Sort of but not really. The __builtin* functions used by mmintrin.h and friends are not generally folded. They may be folded in some cases if they are called with constant arguments, as in the description of the pass. Those functions are usually expanded when translating GIMPLE into RTL. The code to do the expansion of these particular functions is ix86_expand_builtin. That function looks at the __builtin function code and generates the appropriate RTL. Ian From lemings@roguewave.com Thu Mar 8 20:10:00 2007 From: lemings@roguewave.com (Eric Lemings) Date: Thu, 08 Mar 2007 20:10:00 -0000 Subject: Strange Behavior Message-ID: Greetings, While writing a generic C++ algoririthm for base64 encoding, I came across some very strange behavior. If you take the following program (admittedly verbose for debugging purposes) and test it on some data, say the logo image from www.google.com, you may notice (depending on your platform) that the byte at offset 0230 (octal) is either read in with an incorrect value or is skipped entirely. template < class InputItor, class OutputItor > OutputItor encode (InputItor first, InputItor last, OutputItor out) { static const char s [] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789+/"; while (first != last) { unsigned char uc0 = *first++; int i0 = (uc0>>2) & 0x3f; char c0 = s [i0]; *out++ = c0; unsigned char uc1 = (first == last? 0: *first++); int i1 = ((uc0<<4) + (uc1>>4)) & 0x3f; char c1 = s [i1]; *out++ = c1; bool eof = (first == last); unsigned char uc2 = (eof? 0: *first++); int i2 = ((uc1<<2) + (uc2>>6)) & 0x3f; char c2 = (eof? '=': s [i2]); *out++ = c2; int i3 = uc2 & 0x3f; char c3 = (first == last? '=': s [i3]); *out++ = c3; } return out; } #include #include #include #include #include using namespace std; extern int main () { ifstream in ("logo.gif", ios_base::binary); istream_iterator< char > first (in); istream_iterator< char > last; string s; encode (first, last, back_inserter (s)); cout << s; return 0; } You can boil the while loop down to it's basic read operations and still see the same results. while (first != last) { unsigned char uc0 = *first++; unsigned char uc1 = (first == last? 0: *first++); unsigned char uc2 = (first == last? 0: *first++); } Just for sake of sanity, I wrote a quick version of the algorithm in C. Naturally, this program behaves as it should. #include #include extern int main (int argc, char* argv []) { FILE* in = fopen ("logo.gif", "rb"); if (in == NULL) { perror (argv[0]); exit (EXIT_FAILURE); } const char s [] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789+/"; while (!feof (in)) { unsigned char uc0 = fgetc (in); int i0 = (uc0>>2) & 0x3f; char c0 = s [i0]; putc (c0, stdout); unsigned char uc1 = (feof (in)? 0: fgetc (in)); int i1 = ((uc0<<4) + (uc1>>4)) & 0x3f; char c1 = s [i1]; putc (c1, stdout); int eof = feof (in); unsigned char uc2 = (eof? 0: fgetc (in)); int i2 = ((uc1<<2) + (uc2>>6)) & 0x3f; char c2 = (eof? '=': s [i2]); putc (c2, stdout); int i3 = uc2 & 0x3f; char c3 = (feof (in)? '=': s [i3]); putc (c3, stdout); } fclose (in); return 0; } If anyone can shed some light on the strange behavior in the C++ program, I would appreciate it very much. Thanks, Eric. From eljay@adobe.com Thu Mar 8 20:48:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Thu, 08 Mar 2007 20:48:00 -0000 Subject: Strange Behavior In-Reply-To: Message-ID: Hi Eric, The istream_iterator uses >> operator. You have the std::ios_base::skipws flag set in your ifstream named 'in' (since the ios_base::skipws is set by default, and you haven't cleared it). Add a line to your main() to clear the skipws flag: ifstream in ("logo.gif", ios_base::binary);: in.unsetf(ios_base::skipws); // <-- Add this line. The results still differ between your C++ and your C version. I'm not sure if the bug in your C++ or C version, though. HTH, --Eljay From mwgong@cs.utoronto.ca Thu Mar 8 21:39:00 2007 From: mwgong@cs.utoronto.ca (Michael Gong) Date: Thu, 08 Mar 2007 21:39:00 -0000 Subject: what does it mean: "line out of range" ? Message-ID: <034b01c761c3$1291a3c0$9e6511ac@mwgong> Hi, I have a file : foo.c, which is like: #line 20 "./.acc_dir/c-typeck.c" int main() { #line 39309 "./.acc_dir/c-typeck.c" <-- if change to 32767, no warning message below return 3; } >gcc -c foo.c -pedantic ./.acc_dir/c-typeck.c:22:7: warning: line number out of range. It seems that when the line number > 32767, which is the max of short int, the warning message is issued. So I assume gcc uses a short int to store the line number. Is it appropriate ? According to C99, # line digit-sequence new-line causes the implementation to behave as if the following sequence of source lines begins with a source line that has a line number as specified by the digit sequence (interpreted as a decimal integer). The digit sequence shall not specify zero, nor a number greater than 2147483647. there should not be such a limit of 32767. Can anyone clarify it ? Thanks. Mike From baucom@msg.ucsf.edu Thu Mar 8 21:49:00 2007 From: baucom@msg.ucsf.edu (Albion Baucom) Date: Thu, 08 Mar 2007 21:49:00 -0000 Subject: Compiling gfortran In-Reply-To: References: Message-ID: Well, it turns out that there was a path issue with GMP that makes GCC read one GMP header, and read another library to cause mk-kinds- h.sh to fail due to the following problems according to the MPFR website at this website http://www.mpfr.org/faq.html (3. I get undefined reference to __gmp_get_memory_functions). Redefining C_INCLUDE_PATH, LD_LIBRARY_PATH, and LIBRARY_PATH solved _that_ problem. Unfortunately I STILL can't compile gfortran. Why does this have to be so difficult on an Intel based computer? Very frustrating. On Mar 7, 2007, at 4:59 PM, Albion Baucom wrote: > Can anyone suggest how I can get gfortran to compile as part of gcc > 4.1.2? > > I am trying to compile on a 64-bit Xeon based dual processor system > running CentOS 4.4 running kernel version 2.6.9-42.0.2.ELsmp > x86_64. My gcc configuration options are > > ./configure --prefix=/home2/baucom/Applications/gcc --enable- > languages=c,c++,fortran --with-mpfr=/home2/baucom/Applications/mpfr > --with-gmp=/home2/baucom/Applications/gmp > > I am experiencing a problem with a certain "kinds.h" file. The > error message is pasted below. I have done web searches on this and > come across suggestions, none of which worked. Specifically I have > made certain that gmp is specified at the command line when I > configure, along with mpfr and set my LD_LIBRARY_PATH to point to > the libraries, and even tried compiling gmp for 32-bit with the > config option ABI=32. > > Any ideas? > > Thanks > > Albion > > make[2]: Entering directory `/mnt/home2/baucom/src/gcc-4.1.2/x86_64- > unknown-linux-gnu/libgfortran' > /bin/sh ../.././libgfortran/mk-kinds-h.sh '/home2/baucom/src/ > gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc/gfortran -B/home2/ > baucom/src/gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc/ -B/home2/ > baucom/Applications/gcc/x86_64-unknown-linux-gnu/bin/ -B/home2/ > baucom/Applications/gcc/x86_64-unknown-linux-gnu/lib/ -isystem / > home2/baucom/Applications/gcc/x86_64-unknown-linux-gnu/include - > isystem /home2/baucom/Applications/gcc/x86_64-unknown-linux-gnu/sys- > include -I . -Wall -fno-repack-arrays -fno-underscoring ' > kinds.h > || rm kinds.h > ../.././libgfortran/mk-kinds-h.sh: Unknown type > grep '^#' < kinds.h > kinds.inc > /bin/sh: kinds.h: No such file or directory > make[2]: *** [kinds.inc] Error 1 > make[2]: Leaving directory `/mnt/home2/baucom/src/gcc-4.1.2/x86_64- > unknown-linux-gnu/libgfortran' > make[1]: *** [all-target-libgfortran] Error 2 > make[1]: Leaving directory `/mnt/home2/baucom/src/gcc-4.1.2' > make: *** [all] Error 2 From baucom@msg.ucsf.edu Fri Mar 9 06:05:00 2007 From: baucom@msg.ucsf.edu (Albion Baucom) Date: Fri, 09 Mar 2007 06:05:00 -0000 Subject: More gfortran Compiling Problems Message-ID: <3A11FA03-4756-4621-A4E7-5DE4657667E7@msg.ucsf.edu> After solving my last problem with GMP and gfortran compilation, I am now encountering another issue shortly after the last. This issue has fewer web links and looks to be even more obscure. If you hadn't read my last post about my on-going drudgery of compiling here are the details: I am trying to compile gfortran on a 64-bit Xeon based dual processor system running CentOS 4.4 running kernel version 2.6.9-42.0.2.ELsmp x86_64. My gcc configuration options are ./configure --prefix=/home2/baucom/Applications/gcc --enable- languages=c,c++,fortran --with-mpfr=/home2/baucom/Applications/mpfr -- with-gmp=/home2/baucom/Applications/gmp Now I encounter errors with what appears to be type definitions which are listed below. Any suggestions? Albion /home2/baucom/src/gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc/xgcc -B/ home2/baucom/src/gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc/ -B/ home2/baucom/Applications/gcc/x86_64-unknown-linux-gnu/bin/ -B/home2/ baucom/Applications/gcc/x86_64-unknown-linux-gnu/lib/ -isystem /home2/ baucom/Applications/gcc/x86_64-unknown-linux-gnu/include -isystem / home2/baucom/Applications/gcc/x86_64-unknown-linux-gnu/sys-include - DHAVE_CONFIG_H -I. -I../.././libgfortran -I. -iquote../.././ libgfortran/io -I../.././libgfortran/../gcc -I../.././libgfortran/../ gcc/config -I../../host-x86_64-unknown-linux-gnu/gcc -D_GNU_SOURCE - std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style- definition -Wextra -Wwrite-strings -O2 -g -O2 -c ../.././libgfortran/ runtime/compile_options.c -fPIC -DPIC -o .libs/compile_options.o In file included from ../.././libgfortran/runtime/compile_options.c:32: ../.././libgfortran/libgfortran.h:205: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'gfc_charlen_type' ../.././libgfortran/libgfortran.h:273: error: expected specifier- qualifier-list before 'GFC_INTEGER_4' ../.././libgfortran/libgfortran.h:274: error: expected specifier- qualifier-list before 'GFC_INTEGER_8' ../.././libgfortran/libgfortran.h:278: error: expected specifier- qualifier-list before 'GFC_REAL_4' ../.././libgfortran/libgfortran.h:279: error: expected specifier- qualifier-list before 'GFC_REAL_8' ../.././libgfortran/libgfortran.h:286: error: expected specifier- qualifier-list before 'GFC_COMPLEX_4' ../.././libgfortran/libgfortran.h:287: error: expected specifier- qualifier-list before 'GFC_COMPLEX_8' ../.././libgfortran/libgfortran.h:294: error: expected specifier- qualifier-list before 'GFC_LOGICAL_4' ../.././libgfortran/libgfortran.h:295: error: expected specifier- qualifier-list before 'GFC_LOGICAL_8' ../.././libgfortran/libgfortran.h:476: error: expected ')' before 'char' ../.././libgfortran/libgfortran.h:477: error: 'gfc_itoa' undeclared here (not in a function) ../.././libgfortran/libgfortran.h:477: warning: type defaults to 'int' in declaration of 'gfc_itoa' ../.././libgfortran/libgfortran.h:479: error: expected ')' before 'char' ../.././libgfortran/libgfortran.h:480: error: 'xtoa' undeclared here (not in a function) ../.././libgfortran/libgfortran.h:480: warning: type defaults to 'int' in declaration of 'xtoa' ../.././libgfortran/libgfortran.h:570: warning: parameter names (without types) in function declaration .... From iant@google.com Fri Mar 9 06:56:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Fri, 09 Mar 2007 06:56:00 -0000 Subject: what does it mean: "line out of range" ? In-Reply-To: <034b01c761c3$1291a3c0$9e6511ac@mwgong> References: <034b01c761c3$1291a3c0$9e6511ac@mwgong> Message-ID: "Michael Gong" writes: > I have a file : foo.c, which is like: > > #line 20 "./.acc_dir/c-typeck.c" > int main() { > > #line 39309 "./.acc_dir/c-typeck.c" <-- if change to 32767, > no warning message below > return 3; > } > > > >gcc -c foo.c -pedantic > ./.acc_dir/c-typeck.c:22:7: warning: line number out of range. > > > It seems that when the line number > 32767, which is the max of short > int, the warning message is issued. So I assume gcc uses a short int > to store the line number. No. You will notice that you only get the warning with -pedantic. gcc is warning because C89 has a limit of 32767. > According to C99, > > # line digit-sequence new-line > > causes the implementation to behave as if the following sequence of > source lines begins with a source line that has a line number as > specified by the digit sequence (interpreted as a decimal > integer). The digit sequence shall not specify zero, nor a number > greater than 2147483647. Yes, C99 raised the limit. If you compile with -std=c99 or -std=gnu99, you will not get the warning. gcc defaults to gnu89 mode. Ian From manish_baphna@yahoo.com Fri Mar 9 10:14:00 2007 From: manish_baphna@yahoo.com (Manish Baphna) Date: Fri, 09 Mar 2007 10:14:00 -0000 Subject: MAC Machine : Compilation Issue Message-ID: <493939.63327.qm@web38915.mail.mud.yahoo.com> Hi , I am facing one strange problem ... I have two MAC machines A and B . Both have same versions of gcc/bin utils/ld gcc version 3.3.5 (Debian 1:3.3.5-13) GNU ld version 2.15 I have been trying to bulid some kernel for powerPC on these for e300/e500/e600 core. Now on 'A' everything builds on 'B' e300/e500 builds but e600 comes out with this error kernelPath/cpu/e600/e600.S:2119: Error: Unrecognized opcode: `dcba' While buliding kernel the only noticable difference is that there is this warning which comes while building (for each component) Warning: File `kernelPath/kernel_defs.h' has modification time 4.8e+02 s in the future and the other diffence is in the uname which for the local MAC machine is for A : Linux A 2.6.8-customsmp2 #1 SMP for B : Linux B 2.6.8-powerpc-smp I am surprised at this behavior. Gcc/binUtils versions are same , machines are natively MAC then why two different behaviors ? Any help would be greatly appreciated. Best Regards, Manish ____________________________________________________________________________________ Get your own web address. Have a HUGE year through Yahoo! Small Business. http://smallbusiness.yahoo.com/domains/?p=BESTDEAL From dreams_arpit@yahoo.co.in Fri Mar 9 11:15:00 2007 From: dreams_arpit@yahoo.co.in (arpit jain) Date: Fri, 09 Mar 2007 11:15:00 -0000 Subject: gnat-gcc for hp-ux Message-ID: <11416.23788.qm@web8411.mail.in.yahoo.com> Hiiii Can anyone tell me: 1. Which is the gcc (GNAT)version on HP-UX-10.2 that supports ADA language? 2. Where to find the rpm(binary) package for the same? Thanks Arpit __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/ From aph@redhat.com Fri Mar 9 12:43:00 2007 From: aph@redhat.com (Andrew Haley) Date: Fri, 09 Mar 2007 12:43:00 -0000 Subject: MAC Machine : Compilation Issue In-Reply-To: <493939.63327.qm@web38915.mail.mud.yahoo.com> References: <493939.63327.qm@web38915.mail.mud.yahoo.com> Message-ID: <17905.16832.15442.223565@zebedee.pink> Manish Baphna writes: > Hi , > > I am facing one strange problem ... > > I have two MAC machines A and B . Both have same > versions of gcc/bin utils/ld > > gcc version 3.3.5 (Debian 1:3.3.5-13) > GNU ld version 2.15 > > > I have been trying to bulid some kernel for powerPC on > these for e300/e500/e600 core. > > Now on 'A' everything builds > on 'B' e300/e500 builds but e600 comes out with this > error > > kernelPath/cpu/e600/e600.S:2119: Error: Unrecognized > opcode: `dcba' > > While buliding kernel the only noticable difference is > that there is this warning > which comes while building (for each component) > > Warning: File `kernelPath/kernel_defs.h' has > modification time 4.8e+02 s in the future > > and the other diffence is in the uname which for the > local MAC machine is > for A : Linux A 2.6.8-customsmp2 #1 SMP > for B : Linux B 2.6.8-powerpc-smp > > > I am surprised at this behavior. Gcc/binUtils versions > are same , machines are natively MAC then > why two different behaviors ? > > Any help would be greatly appreciated. This isn't really a gcc issue. kernelPath/cpu/e600/e600.S is an assembly language file, and the message is coming from the assembler. Better ask the questions on a kernel list, or a binutils list. Andrew. From Vladimir.Simonov@acronis.com Fri Mar 9 12:55:00 2007 From: Vladimir.Simonov@acronis.com (Vladimir Simonov) Date: Fri, 09 Mar 2007 12:55:00 -0000 Subject: gcc forgets to decrease esp after function call Message-ID: <45F15674.9000701@acronis.com> Hi all, Compiling some complex templated & inlined C++ code by gcc 4.1.1/4.1.2 I've met a problem with -O2 optimization. Objdump'ed text is below. In line 30 the code calls method which returns object via shadow pointer(in %esp). Calling function has "ret 4" at the end as it should be. But the problem code does not have "sub 0x4,%esp" to fix esp after the call. Obviously, codegenerator knows about calling function prototype(it creates shadow parameter). But by some reason it does not emit "sub 0x4,%esp" and uses esp in line 41 as if esp's value is not changed by called in line 30 function. If I "sub 0x4,%esp" in line 33 in gdb all is working fine. Any hints about workarround the problem will be very appritiated. Best regards Vladimir Simonov ----------------------------------------------- 00000000 : 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 57 push %edi 4: 56 push %esi 5: 53 push %ebx 6: 83 ec 3c sub $0x3c,%esp 9: 8b 45 08 mov 0x8(%ebp),%eax c: e8 fc ff ff ff call d d: R_386_PC32 __i686.get_pc_thunk.bx 11: 81 c3 02 00 00 00 add $0x2,%ebx 13: R_386_GOTPC _GLOBAL_OFFSET_TABLE_ #include "pragmas.h" FORCE_INLINE static typename PrototypeAnalyser::ReturnType Call(ObjectType* object, Func function, const ArgumentsType&) { return (object->*function)(); 17: 8b 10 mov (%eax),%edx 19: 8b 72 cc mov 0xffffffcc(%edx),%esi 1c: 8d 55 d4 lea 0xffffffd4(%ebp),%edx 1f: 89 55 d0 mov %edx,0xffffffd0(%ebp) 22: 01 f0 add %esi,%eax 24: 8b 10 mov (%eax),%edx 26: 89 44 24 04 mov %eax,0x4(%esp) 2a: 8b 45 d0 mov 0xffffffd0(%ebp),%eax 2d: 89 04 24 mov %eax,(%esp) 30: ff 52 08 call *0x8(%edx) LARGE AMOUNT OF INLINED TEMPLATED CODE } }; 33: 8b 4d 14 mov 0x14(%ebp),%ecx 36: 85 c9 test %ecx,%ecx 38: 74 7c je b6 <> } void* operator new(size_t itemSize) { char* mem = reinterpret_cast(FomatikAlloc(itemSize)); 3a: 8b 45 d8 mov 0xffffffd8(%ebp),%eax 3d: 8d 7c 00 18 lea 0x18(%eax,%eax,1),%edi 41: 89 3c 24 mov %edi,(%esp) 44: e8 fc ff ff ff call 45: R_386_PLT32 MyAlloc From aph@redhat.com Fri Mar 9 13:23:00 2007 From: aph@redhat.com (Andrew Haley) Date: Fri, 09 Mar 2007 13:23:00 -0000 Subject: gcc forgets to decrease esp after function call In-Reply-To: <45F15674.9000701@acronis.com> References: <45F15674.9000701@acronis.com> Message-ID: <17905.22833.766154.45450@zebedee.pink> Vladimir Simonov writes: > Compiling some complex templated & inlined C++ code by gcc > 4.1.1/4.1.2 I've met a problem with -O2 optimization. Objdump'ed > text is below. > > In line 30 the code calls method which returns object via shadow > pointer(in %esp). Calling function has "ret 4" at the end as it > should be. But the problem code does not have "sub 0x4,%esp" to > fix esp after the call. > > Obviously, codegenerator knows about calling function prototype(it > creates shadow parameter). But by some reason it does not emit > "sub 0x4,%esp" and uses esp in line 41 as if esp's value is not > changed by called in line 30 function. If I "sub 0x4,%esp" in line > 33 in gdb all is working fine. > > Any hints about workarround the problem will be very appritiated. I don't understand what you're complaining about. The stack pointer is not adjusted anywhere in the code you posted, except for the > 6: 83 ec 3c sub $0x3c,%esp at the beginning. The generated code uses offsets from the stack pointer, which doesn't change. Where is esp's value changed by the "called in line 30 function"? Please show it. Andrew. From Vladimir.Simonov@acronis.com Fri Mar 9 13:50:00 2007 From: Vladimir.Simonov@acronis.com (Vladimir Simonov) Date: Fri, 09 Mar 2007 13:50:00 -0000 Subject: gcc forgets to decrease esp after function call In-Reply-To: <17905.22833.766154.45450@zebedee.pink> References: <45F15674.9000701@acronis.com> <17905.22833.766154.45450@zebedee.pink> Message-ID: <45F15FDE.8010700@acronis.com> Hi, Here is gdb session dump. 0xb2e13570 is start of called function 0xb2e135a5 is the end. You can see "ret $0x4" at the end. But the caller doesn't fixups it. BTW. The called function also calls function returning object via shadow parameter. And we see correct "sub $0x4,%esp" in 0xb2e135a1. Best regards Vladimir Simonov ------------------ 0xb2e13570 <+0>: mov 0x8(%esp),%eax 0xb2e13574 <+4>: mov (%eax),%ecx 0xb2e13576 <+6>: add 0xffffffe4(%ecx),%eax 0xb2e13579 <+9>: mov %eax,0x8(%esp) 0xb2e1357d <+13>: jmp 0xb2e13580 <> 0xb2e1357f <+15>: nop 0xb2e13580 <+0>: push %ebp 0xb2e13581 <+1>: mov %esp,%ebp 0xb2e13583 <+3>: push %esi 0xb2e13584 <+4>: sub $0x14,%esp 0xb2e13587 <+7>: mov 0xc(%ebp),%eax 0xb2e1358a <+10>: mov 0x8(%ebp),%esi 0xb2e1358d <+13>: mov 0x4(%eax),%eax 0xb2e13590 <+16>: mov (%eax),%edx 0xb2e13592 <+18>: mov %eax,0x4(%esp) 0xb2e13596 <+22>: mov %esi,(%esp) 0xb2e13599 <+25>: call *0xc(%edx) 0xb2e1359c <+28>: mov %esi,%eax 0xb2e1359e <+30>: mov 0xfffffffc(%ebp),%esi 0xb2e135a1 <+33>: sub $0x4,%esp 0xb2e135a4 <+36>: leave 0xb2e135a5 <+37>: ret $0x4 Andrew Haley wrote: > Vladimir Simonov writes: > > > Compiling some complex templated & inlined C++ code by gcc > > 4.1.1/4.1.2 I've met a problem with -O2 optimization. Objdump'ed > > text is below. > > > > In line 30 the code calls method which returns object via shadow > > pointer(in %esp). Calling function has "ret 4" at the end as it > > should be. But the problem code does not have "sub 0x4,%esp" to > > fix esp after the call. > > > > Obviously, codegenerator knows about calling function prototype(it > > creates shadow parameter). But by some reason it does not emit > > "sub 0x4,%esp" and uses esp in line 41 as if esp's value is not > > changed by called in line 30 function. If I "sub 0x4,%esp" in line > > 33 in gdb all is working fine. > > > > Any hints about workarround the problem will be very appritiated. > > I don't understand what you're complaining about. The stack pointer > is not adjusted anywhere in the code you posted, except for the > > > 6: 83 ec 3c sub $0x3c,%esp > > at the beginning. The generated code uses offsets from the stack > pointer, which doesn't change. Where is esp's value changed by the > "called in line 30 function"? Please show it. > > Andrew. > From jopen@gmx.net Fri Mar 9 14:14:00 2007 From: jopen@gmx.net (Sascha Alexander Jopen) Date: Fri, 09 Mar 2007 14:14:00 -0000 Subject: dump-translation-unit format Message-ID: <000301c76251$e7081c90$b51855b0$@net> Hi, I'm currently working on the output of gcc/g++ -fdump-translation-unit to do source code analysis. I found several references that the internal ast should include nodes for for, while and do constructs. But I can't find those nodes in the dumped files. Sometimes there are such FOR_STMT nodes when I compile large units, but when compiling a small test unit containing not much more than a for loop, this loop isn't included in the dump. Instead there is a GOTO_EXPR where I would expect the for loop. This holds for other loops and conditional expressions as well. All FOR_STMT nodes I encountered where not from my custom code, but from templates from system includes. Are there any optimizations done on the tree before dumping it, and how can I prevent this to get an unoptimized tree? Are there other possibilities to get those loop nodes? I need them to check whether function calls are done in loops or not. Without the bodies of loops I can get information about functions called from other functions using the chain links, but not whether they are called within loops. Another thing I don't understand is the following. This dumped function node contains two body definitions, one undefined and one with a proper node chain. Is this a dump error or has it special meaning? @1639 function_decl name: @2001 mngl: @2002 type: @2003 scpe: @812 srcp: char_traits.h:322 chan: @2004 note: member accs: pub args: @2005 body: undefined link: extern body: @2006 Maybe someone could help me or point me to other resources. Thanks in advance, Sascha Jopen From mtrudel@gmx.ch Fri Mar 9 15:36:00 2007 From: mtrudel@gmx.ch (Marco Trudel) Date: Fri, 09 Mar 2007 15:36:00 -0000 Subject: --with-sysroot and --with-build-sysroot In-Reply-To: <45D96513.1080800@gmx.ch> References: <45D96513.1080800@gmx.ch> Message-ID: <45F16BD4.3050706@gmx.ch> Anyone? Marco Trudel wrote: > Hey all > > I don't really understand the meaning and difference of --with-sysroot > and --with-build-sysroot. From http://gcc.gnu.org/install/configure.html: > > > --with-sysroot=dir > > Tells GCC to consider dir as the root of a tree that contains a > > (subset of) the root filesystem of the target operating system. > > The GCC that is used to compile the current GCC source or the final > compiled GCC later at runtime? I assume for both. > > > > Target > > system headers, libraries and run-time object files will be searched > > in there. > > I'm compiling a build=i686-pc-linux-gnu host=i686-pc-linux-gnu > target=i686-pc-linux-gnu. I put glibc and glibc-devel into sysroot. This > worked with GCC 4.2 but fails with GCC 4.3 because "linux/limits.h" > can't be found [1]. > I'd say GCC 4.3 does the correct thing but how then was GCC 4.2 able to > compile the setup? I always assumed that "--with-sysroot" is for the > created compiler and "--with-build-sysroot" for the compiler compiling > the new compiler. > > Also I'm doing a build=i686-pc-linux-gnu host=i686-pc-mingw32 > target=i686-pc-linux-gnu compilation with also --with-sysroot set and > containing glibc and glibc-devel. That works with GCC 4.2 and GCC 4.3. I > would have assumed that GCC 4.3 also fails because it already fails for > a host=i686-pc-linux-gnu. > > > > --with-build-sysroot=dir > > Tells GCC to consider dir as the system root (see --with-sysroot) > > while building target libraries, instead of the directory specified > > with --with-sysroot. > > So this overwrites --with-sysroot for target libraries. What is > --with-sysroot then left to be used for? target binaries? Other things? > > > > This option is only useful when you are already > > using --with-sysroot. You can use --with-build-sysroot when you are > > configuring with --prefix set to a directory that is different from > > the one in which you are installing GCC and your target libraries. > > So assumed I have: > --prefix=/home/me/gcc-tmp > --with-sysroot=/home/me/gcc-tmp/sysroot > > But will finally install it into /home/me/gcc. What do I have to set > --with-build-sysroot to? What for? The sysroot will be found relative to > the GCC binaries because it is a subdirectory of the prefix. > > > > This option affects the system root for the compiler used to build > > target libraries (which runs on the build system); it does not affect > > the compiler which is used to build GCC itself. > > And --with-sysroot is used for both? Then for my setup (having sys-root > as a subdir of prefix) makes --with-build-sysroot superfluous? > Where then makes --with-build-sysroot sense? Assumed I do: > --prefix=/home/me/gcc-tmp > --with-sysroot=/home/me/sysroot > Won't it be found absolutely when moving gcc to /home/me/gcc? Or do I > still have to set build-sysroot to /home/me/sysroot? > > > thanks > Marco > > [1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30832 > From iant@google.com Fri Mar 9 15:43:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Fri, 09 Mar 2007 15:43:00 -0000 Subject: dump-translation-unit format In-Reply-To: <000301c76251$e7081c90$b51855b0$@net> References: <000301c76251$e7081c90$b51855b0$@net> Message-ID: "Sascha Alexander Jopen" writes: > I'm currently working on the output of gcc/g++ -fdump-translation-unit to do > source code analysis. I found several references that the internal ast > should include nodes for for, while and do constructs. But I can't find > those nodes in the dumped files. Sometimes there are such FOR_STMT nodes > when I compile large units, but when compiling a small test unit containing > not much more than a for loop, this loop isn't included in the dump. Instead > there is a GOTO_EXPR where I would expect the for loop. This holds for other > loops and conditional expressions as well. All FOR_STMT nodes I encountered > where not from my custom code, but from templates from system includes. > > Are there any optimizations done on the tree before dumping it, and how can > I prevent this to get an unoptimized tree? Are there other possibilities to > get those loop nodes? I need them to check whether function calls are done > in loops or not. Without the bodies of loops I can get information about > functions called from other functions using the chain links, but not whether > they are called within loops. Which version of gcc are you using? In mainline -fdump-translation-unit just dumps the global declarations. If you want to see FOR_STMT nodes, you need -fdump-tree-original. But that is pretty unsatisfactory these days since for_stmt nodes are not dumped in a useful way. And that only happens for C++; for C FOR_STMT nodes are never generated. > Another thing I don't understand is the following. This dumped function node > contains two body definitions, one undefined and one with a proper node > chain. Is this a dump error or has it special meaning? > > @1639 function_decl name: @2001 mngl: @2002 type: @2003 > scpe: @812 srcp: char_traits.h:322 > chan: @2004 note: member accs: pub > args: @2005 body: undefined > link: extern body: @2006 > > Maybe someone could help me or point me to other resources. The tree dump code prints out "body: undefined" for an external function which is not to be compiled by itself. But such a function can still have a body; this will be the case for a C++ inline function. This is somewhat confusing. Ian From Vladimir.Simonov@acronis.com Fri Mar 9 15:59:00 2007 From: Vladimir.Simonov@acronis.com (Vladimir Simonov) Date: Fri, 09 Mar 2007 15:59:00 -0000 Subject: gcc forgets to decrease esp after function call In-Reply-To: <17905.28252.856544.931176@zebedee.pink> References: <45F15674.9000701@acronis.com> <17905.22833.766154.45450@zebedee.pink> <45F1681A.6030307@acronis.com> <17905.28252.856544.931176@zebedee.pink> Message-ID: <45F180B3.50901@acronis.com> Hi again, Ok, thank you. I'll try to prepare minimal testcase. It is not so easy because the problem apears while handling complex templated code. But I need advices about workarround the problem. Say, How can I force gcc to use ebp instead of esp to address local variables? How can I force gcc to use "leave"(ebp) on function return instead of "add XXX, esp"? If above is possible incorrect esp hanling may be easy workarrounded. Thank you in advance Vladimir Simonov Andrew Haley wrote: > Vladimir Simonov writes: > > Hi > > > > To be distinct. > > Here is the problem function. > > OK, thanks, now it is clear. The "ret 4" removes a word from the > stack that belongs to the caller. > > This is, as you say, definitely a code generation bug. Now, we have a > problem. You would like it fixed, but you can't produce a test case > that a gcc maintainer can use for a bug report. If you can produce a > test case we can see if tis is fixed in other gcc versions. > > Andrew. > From aph@redhat.com Fri Mar 9 17:29:00 2007 From: aph@redhat.com (Andrew Haley) Date: Fri, 09 Mar 2007 17:29:00 -0000 Subject: gcc forgets to decrease esp after function call In-Reply-To: <45F180B3.50901@acronis.com> References: <45F15674.9000701@acronis.com> <17905.22833.766154.45450@zebedee.pink> <45F1681A.6030307@acronis.com> <17905.28252.856544.931176@zebedee.pink> <45F180B3.50901@acronis.com> Message-ID: <17905.33869.537927.207102@zebedee.pink> Vladimir Simonov writes: > Hi again, > > Ok, thank you. > I'll try to prepare minimal testcase. It is not so easy > because the problem apears while handling complex > templated code. > > But I need advices about workarround the problem. > Say, > How can I force gcc to use ebp instead of > esp to address local variables? -fno-omit-frame-pointer ought to do it. Andrew. From iprmaster@gmail.com Fri Mar 9 18:00:00 2007 From: iprmaster@gmail.com (max) Date: Fri, 09 Mar 2007 18:00:00 -0000 Subject: Internal representation of double variables - 3.4.6 vs 4.1.0 In-Reply-To: References: Message-ID: Hi gcc developers and users, I have discovered that my code gives different results if compiled with different gcc versions, namely 3.4.6 and 4.1.0. Since I wanted to understand why, I compile my code again w/o any optimization (-O0) and with debug symbols (-g). I have found that differences (very small, 10e-12 on a 32-bit machine) started to appear in the return value of a routine which performs vector-vector multiplication, i.d. double vecdot(double *v) { double sum = 0; for(i = 0; i < n; i++) sum += v[i] * v[i]; return sum; } even if elements of v[] are the same. Do these versions use different "internal" representation of doubles? I agree that the sum above is ill-conditioned, but why do different gccs give (w/o optimization) different results? Thanks for your help, Max From terry@chem.gu.se Fri Mar 9 18:33:00 2007 From: terry@chem.gu.se (Terry Frankcombe) Date: Fri, 09 Mar 2007 18:33:00 -0000 Subject: Internal representation of double variables - 3.4.6 vs 4.1.0 In-Reply-To: References: Message-ID: <1173463194.5215.5.camel@fkpc167> On Fri, 2007-03-09 at 18:29 +0100, max wrote: > Hi gcc developers and users, > > I have discovered that my code gives different results if compiled > with different gcc versions, namely 3.4.6 and 4.1.0. > Since I wanted to understand why, I compile my code again w/o any > optimization (-O0) and with debug symbols (-g). > I have found that differences (very small, 10e-12 on a 32-bit machine) > started to appear in the return value of a routine which performs > vector-vector multiplication, i.d. > > double vecdot(double *v) > { > double sum = 0; > for(i = 0; i < n; i++) > sum += v[i] * v[i]; > return sum; > } > > even if elements of v[] are the same. Do these versions use different > "internal" representation of doubles? > I agree that the sum above is ill-conditioned, but why do different > gccs give (w/o optimization) different results? > > Thanks for your help, > Max (Slightly off-topic. But only slightly!) After reading this, I went off looking for a gcc option enforcing IEEE floating point behaviour, assuming gcc was like the Intel compilers and by default sacrificed some exactness in the floating point model for speed, even with no optimisation. I could find none. So, does gcc use a well-defined and reproducible floating-point model by default? If not, can one turn on strict IEEE arithmetic? Ciao Terry -- Dr Terry Frankcombe Physical Chemistry, Department of Chemistry G??teborgs Universitet SE-412 96 G??teborg Sweden Ph: +46 76 224 0887 Skype: terry.frankcombe From brian@dessent.net Fri Mar 9 18:47:00 2007 From: brian@dessent.net (Brian Dessent) Date: Fri, 09 Mar 2007 18:47:00 -0000 Subject: Internal representation of double variables - 3.4.6 vs 4.1.0 References: <1173463194.5215.5.camel@fkpc167> Message-ID: <45F1A884.B239ACBC@dessent.net> Terry Frankcombe wrote: > After reading this, I went off looking for a gcc option enforcing IEEE > floating point behaviour, assuming gcc was like the Intel compilers and > by default sacrificed some exactness in the floating point model for > speed, even with no optimisation. I could find none. So, does gcc use > a well-defined and reproducible floating-point model by default? If > not, can one turn on strict IEEE arithmetic? That is not the problem. The problem is that the intel x86 processor uses an internal 80 bit representation for 'double', which normally has only 64 bits. This causes excess precision, which can appear as rounding errors in the ULP, but are not really errors, just misunderstandings of how IEE 754 works. You can work around this with -ffloat-store but this incurs a speed penalty as it means temporary values can't be kept in registers but repeatedly stored and loaded from memory. Or you can use SSE for fp math (-mfpmath=sse) instead of 387, if your architecture supports it. See gcc bug 323 for examples of this non-bug being reported over and over again dozens of times over the years. Brian From terry@chem.gu.se Fri Mar 9 18:55:00 2007 From: terry@chem.gu.se (Terry Frankcombe) Date: Fri, 09 Mar 2007 18:55:00 -0000 Subject: Internal representation of double variables - 3.4.6 vs 4.1.0 In-Reply-To: <45F1A884.B239ACBC@dessent.net> References: <1173463194.5215.5.camel@fkpc167> <45F1A884.B239ACBC@dessent.net> Message-ID: <1173466047.5215.11.camel@fkpc167> On Fri, 2007-03-09 at 10:33 -0800, Brian Dessent wrote: > Terry Frankcombe wrote: > > > After reading this, I went off looking for a gcc option enforcing IEEE > > floating point behaviour, assuming gcc was like the Intel compilers and > > by default sacrificed some exactness in the floating point model for > > speed, even with no optimisation. I could find none. So, does gcc use > > a well-defined and reproducible floating-point model by default? If > > not, can one turn on strict IEEE arithmetic? > > That is not the problem. The problem is that the intel x86 processor > uses an internal 80 bit representation for 'double', which normally has > only 64 bits. This causes excess precision, which can appear as > rounding errors in the ULP, but are not really errors, just > misunderstandings of how IEE 754 works. You can work around this with > -ffloat-store but this incurs a speed penalty as it means temporary > values can't be kept in registers but repeatedly stored and loaded from > memory. Or you can use SSE for fp math (-mfpmath=sse) instead of 387, > if your architecture supports it. > > See gcc bug 323 for > examples of this non-bug being reported over and over again dozens of > times over the years. > > Brian So the short answers are "No" and "No", right? ;-) My understanding of -ffloat-store is that it only works when there's actually a variable involved. Is that right? (I'm used to working with Compaq and Intel Fortran compilers, where you can set flags that say, effectively, "Use a standard, well-defined and portable floating point arithmetic model irrespective of what the CPU's trying to do.") Ciao Terry From brian@dessent.net Fri Mar 9 19:08:00 2007 From: brian@dessent.net (Brian Dessent) Date: Fri, 09 Mar 2007 19:08:00 -0000 Subject: Internal representation of double variables - 3.4.6 vs 4.1.0 References: <1173463194.5215.5.camel@fkpc167> <45F1A884.B239ACBC@dessent.net> <1173466047.5215.11.camel@fkpc167> Message-ID: <45F1AD7C.CE30AC9A@dessent.net> Terry Frankcombe wrote: > My understanding of -ffloat-store is that it only works when there's > actually a variable involved. Is that right? Right, it's not a guaranteed fix. > (I'm used to working with Compaq and Intel Fortran compilers, where you > can set flags that say, effectively, "Use a standard, well-defined and > portable floating point arithmetic model irrespective of what the CPU's > trying to do.") I'd say you pretty much get that with -mfpmath=sse. The only reason anyone should ever use 387 is if binary compatibility with ancient pre-SSE pentiums/K6s is required. Otherwise, it's an ancient and creaky fp architecture that would be best obsoleted (which they finally did in x86_64 AFAIK.) Brian From terry@chem.gu.se Fri Mar 9 19:27:00 2007 From: terry@chem.gu.se (Terry Frankcombe) Date: Fri, 09 Mar 2007 19:27:00 -0000 Subject: Internal representation of double variables - 3.4.6 vs 4.1.0 In-Reply-To: <45F1AD7C.CE30AC9A@dessent.net> References: <1173463194.5215.5.camel@fkpc167> <45F1A884.B239ACBC@dessent.net> <1173466047.5215.11.camel@fkpc167> <45F1AD7C.CE30AC9A@dessent.net> Message-ID: <1173467304.5215.19.camel@fkpc167> On Fri, 2007-03-09 at 10:54 -0800, Brian Dessent wrote: > Terry Frankcombe wrote: > > > My understanding of -ffloat-store is that it only works when there's > > actually a variable involved. Is that right? > > Right, it's not a guaranteed fix. > > > (I'm used to working with Compaq and Intel Fortran compilers, where you > > can set flags that say, effectively, "Use a standard, well-defined and > > portable floating point arithmetic model irrespective of what the CPU's > > trying to do.") > > I'd say you pretty much get that with -mfpmath=sse. The only reason > anyone should ever use 387 is if binary compatibility with ancient > pre-SSE pentiums/K6s is required. Otherwise, it's an ancient and creaky > fp architecture that would be best obsoleted (which they finally did in > x86_64 AFAIK.) > > Brian For the world at large: Is there any sensible reason that these options seem to buried in processor-specific sections? Surely the hardware floating point model varies on more than just the x86 family and friends. Why isn't there a simple, global option to get a portable floating point model? (Particularly now that gfortran is becoming more popular!) Tying the floating point model to a particular hardware feature/instruction set (SSE) seems absolutely absurd to me. It should be abstracted to a much higher level. Terry From eljay@adobe.com Sat Mar 10 18:37:00 2007 From: eljay@adobe.com (John (Eljay) Love-Jensen) Date: Sat, 10 Mar 2007 18:37:00 -0000 Subject: Internal representation of double variables - 3.4.6 vs 4.1.0 References: <1173467304.5215.19.camel@fkpc167> Message-ID: Hi Terry, > Is there any sensible reason that these options seem to buried in processor-specific sections? My guess is because they are processor-specific options. > Surely the hardware floating point model varies on more than just the x86 family and friends. Yes. For example, not all 680x0 machines has a FPU. > Why isn't there a simple, global option to get a portable floating point model? Because there are different FPU facilities on different platforms that may have a different, non-portable floating-point model. > Particularly now that gfortran is becoming more popular! If the Fortran users express a desire for some Fortran level floating-point compliance to a portable floating-point model, perhaps the maintainer of the gfortran front-end tool-chain driver will add a flag to that effect. I imagine such a flag would have these guarantees: + behind the scenes, specifies the processor-specific option to insure floating-point portability + may impose severe performance penalties (one-to-two orders of magnitude) on some platforms + may cause the compile to fail if the floating-point constraint cannot be fulfilled (which is probably a good thing) > Tying the floating point model to a particular hardware feature/instruction set (SSE) seems absolutely absurd to me. It should be abstracted to a much higher level. It's a trade-off, without a doubt. Java has a facility that allows strong guarantees on floating-point fidelity. And Mathematica allows very powerful expression of symbolic and mathematical manipulation and expression. And there's always Lisp. Sincerely, --Eljay From jopen@gmx.net Sat Mar 10 21:47:00 2007 From: jopen@gmx.net (Sascha Alexander Jopen) Date: Sat, 10 Mar 2007 21:47:00 -0000 Subject: AW: dump-translation-unit format Message-ID: <000101c76343$409f9f70$c1dede50$@net> Hi, Sorry for my double posts on this list and answering to the wrong persons. I had/have major trouble with my mail client and anti-spam. I hope that everything works as expected now. > > I'm currently working on the output of gcc/g++ -fdump-translation- > unit > > to do source code analysis. I found several references that the > > internal ast should include nodes for for, while and do constructs. > > But I can't find those nodes in the dumped files. Sometimes there > > are such FOR_STMT nodes when I compile large units, but when > > compiling a small test unit containing not much more than a for > > loop, this loop isn't included in the dump. Instead there is a > > GOTO_EXPR where I > would > > expect the for loop. This holds for other loops and conditional > > expressions as well. All FOR_STMT nodes I encountered where not from > my custom code, but from templates from system includes. > > > > Are there any optimizations done on the tree before dumping it, and > > how can I prevent this to get an unoptimized tree? Are there other > > possibilities to get those loop nodes? I need them to check whether > > function calls are done in loops or not. Without the bodies of loops > I > > can get information about functions called from other functions > > using the chain links, but not whether they are called within loops. > > Which version of gcc are you using? In mainline -fdump-translation- > unit just dumps the global declarations. If you want to see FOR_STMT > nodes, you need -fdump-tree-original. But that is pretty > unsatisfactory these days since for_stmt nodes are not dumped in a > useful way. And that only happens for C++; for C FOR_STMT nodes are > never generated. > I'm using recent gcc-4.1.2. I used -fdump-tree-original-raw to obtain all declarations from within functions. It seems that I can find all loop constructs there, although there are many other nodes dumped, which I do not understand completely by now. To do automatic parsing of the output seems to be not as simple as I hoped initially. But thank you for the -fdump-tree-original hint, anyway. > > > Another thing I don't understand is the following. This dumped > > function node contains two body definitions, one undefined and one > > with a proper node chain. Is this a dump error or has it special > meaning? > > > > @1639 function_decl name: @2001 mngl: @2002 type: @2003 > > scpe: @812 srcp: char_traits.h:322 > > chan: @2004 note: member accs: pub > > args: @2005 body: undefined > > link: extern body: @2006 > > > > Maybe someone could help me or point me to other resources. > > The tree dump code prints out "body: undefined" for an external > function which is not to be compiled by itself. But such a function > can still have a body; this will be the case for a C++ inline function. > This is somewhat confusing. > > Ian I do not understand the link: external. All my own functions are also marked as external, though they are defined, declared and used within the same compilation unit. Additionally I do only have one compilation unit for testing. Why are those functions marked as externally linked? Sascha From facundofc@gmail.com Sun Mar 11 06:22:00 2007 From: facundofc@gmail.com (Facundo Ciccioli) Date: Sun, 11 Mar 2007 06:22:00 -0000 Subject: Clobbered registers Message-ID: <56aed05a0703101346l21869a0epf9033da335ce638e@mail.gmail.com> I wrote a function which modifies esp register through some asm instructions (it pushes things to the stack). Everything works perfect for now because the function takes care of restauring the content of esp issuing an add instruction too so that it can return allright. But reading GCC docs I found this: "If you refer to a particular hardware register from the assembler code, you will probably have to list the register after the third colon to tell the compiler the register's value is modified." Ok, so I do that. But looking at the assembler code generated by the compiler I notice that it is exactly the same than before I did what the docs say. So I wonder, why does the compiler needs to know if I execute an instruction that modifies some register? And also (maybe the answer to the former would respond this) why does the code doesn't change? Thanks a lot, FaQ From vishnu_m_menon@yahoo.com Sun Mar 11 14:46:00 2007 From: vishnu_m_menon@yahoo.com (Vishnu M Menon) Date: Sun, 11 Mar 2007 14:46:00 -0000 Subject: Reserving the same virtual address space range in several programs Message-ID: <803480.85995.qm@web38906.mail.mud.yahoo.com> Hi, I am trying to solve this problem: reserve the same virtual memory address range in a given set of programs so that no addresses falling within this range will be used by the processes for any other purpose. Later I'll map a shared memory region to this address using mmap(.) or shmat(.). My question is: is there a way I can use GCC to achieve this VM address reservation? The programs are fully in my control and are extremely specialized, so I am at liberty to use techniques sane people would balk at. To give a clearer idea of what I'm getting at, reserving 10 MB of memory space might be achieved through something like: char g_MemArray[ 10 * ( 1 << 20 ) ]; int main() { printf("Starts at %p\n", g_MemArray ); return 0; } But of course, layout of global variables will vary from program to program. I am trying to see if somehow the layout can be specified so that VM addresses are guaranteed to be the same. TIA for the replies. I would also welcome any solutions that do not involve gcc, though I realize this would be off-topic (for which I apologize in advance!). Regards, Vishnu From sadri.sarray@gmail.com Sun Mar 11 14:51:00 2007 From: sadri.sarray@gmail.com (Sadri SARRAY) Date: Sun, 11 Mar 2007 14:51:00 -0000 Subject: How to Install GCC Message-ID: <92e033780703110745p60d734dfm4aff466d7a14f390@mail.gmail.com> Dear Madam, Sir Please, Would you like to send me a procedure to install the GCC compiler on a Linux-Ubuntu OS ? Regards, From cdp_doomed@gmx.net Sun Mar 11 15:03:00 2007 From: cdp_doomed@gmx.net (Steffen Wendzel) Date: Sun, 11 Mar 2007 15:03:00 -0000 Subject: How to Install GCC In-Reply-To: <92e033780703110745p60d734dfm4aff466d7a14f390@mail.gmail.com> References: <92e033780703110745p60d734dfm4aff466d7a14f390@mail.gmail.com> Message-ID: <20070311155148.35752c89.cdp_doomed@gmx.net> as root: # apt-get install gcc regards steffen -- website: http://cdp.doomed-reality.org hardened linux: http://hardenedlinux.sourceforge.net From tschwinge@gnu.org Sun Mar 11 15:58:00 2007 From: tschwinge@gnu.org (Thomas Schwinge) Date: Sun, 11 Mar 2007 15:58:00 -0000 Subject: How to Install GCC In-Reply-To: <92e033780703110745p60d734dfm4aff466d7a14f390@mail.gmail.com> References: <92e033780703110745p60d734dfm4aff466d7a14f390@mail.gmail.com> Message-ID: <20070311150107.GQ4439@fencepost.gnu.org> Hello! On Sun, Mar 11, 2007 at 10:45:53AM -0400, Sadri SARRAY wrote: > Please, Would you like to send me a procedure to install the GCC > compiler on a Linux-Ubuntu OS ? With a power screwdriver. Regards, Thomas -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 191 bytes Desc: Digital signature URL: From lopezibanez@gmail.com Sun Mar 11 16:22:00 2007 From: lopezibanez@gmail.com (=?ISO-8859-1?Q?Manuel_L=F3pez-Ib=E1=F1ez?=) Date: Sun, 11 Mar 2007 16:22:00 -0000 Subject: How to Install GCC In-Reply-To: <92e033780703110745p60d734dfm4aff466d7a14f390@mail.gmail.com> References: <92e033780703110745p60d734dfm4aff466d7a14f390@mail.gmail.com> Message-ID: <6c33472e0703110858x659e794ev5eb3595f09f3ace4@mail.gmail.com> On 11/03/07, Sadri SARRAY wrote: > Dear Madam, Sir > > Please, Would you like to send me a procedure to install the GCC > compiler on a Linux-Ubuntu OS ? > http://www.google.com/search?&q=how%20to%20install%20gcc%20in%20ubuntu Or in short: sudo apt-get install gcc build-essential Next time: http://www.catb.org/~esr/faqs/smart-questions.html Cheers, Manuel. From bdavis9659@sbcglobal.net Sun Mar 11 17:37:00 2007 From: bdavis9659@sbcglobal.net (Bud Davis) Date: Sun, 11 Mar 2007 17:37:00 -0000 Subject: Reserving the same virtual address space range in several programs In-Reply-To: <803480.85995.qm@web38906.mail.mud.yahoo.com> Message-ID: <37955.19203.qm@web81213.mail.mud.yahoo.com> --- Vishnu M Menon wrote: > Hi, > > I am trying to solve this problem: reserve the same > virtual memory address range in a given set of > programs so that no addresses falling within this > range will be used by the processes for any other > purpose. Later I'll map a shared memory region to > this > address using mmap(.) or shmat(.). > > My question is: is there a way I can use GCC to > achieve this VM address reservation? The programs > are > fully in my control and are extremely specialized, > so > I am at liberty to use techniques sane people would > balk at. > > To give a clearer idea of what I'm getting at, > reserving 10 MB of memory space might be achieved > through something like: > > char g_MemArray[ 10 * ( 1 << 20 ) ]; > > int > main() > { > printf("Starts at %p\n", g_MemArray ); > return 0; > } > > But of course, layout of global variables will vary > from program to program. I am trying to see if > somehow > the layout can be specified so that VM addresses are > guaranteed to be the same. > > TIA for the replies. I would also welcome any > solutions that do not involve gcc, though I realize > this would be off-topic (for which I apologize in > advance!). > > Regards, > Vishnu > there is an example on the web showing how to do this on a unix system (it concerns fortran common blocks, but the concepts are the same). http://gfortran.info/pmwiki.php?n=CodeSnippets From aph@redhat.com Mon Mar 12 04:28:00 2007 From: aph@redhat.com (Andrew Haley) Date: Mon, 12 Mar 2007 04:28:00 -0000 Subject: Clobbered registers In-Reply-To: <56aed05a0703101346l21869a0epf9033da335ce638e@mail.gmail.com> References: <56aed05a0703101346l21869a0epf9033da335ce638e@mail.gmail.com> Message-ID: <17908.15942.408305.73060@zebedee.pink> Facundo Ciccioli writes: > I wrote a function which modifies esp register through some asm > instructions (it pushes things to the stack). Everything works perfect > for now because the function takes care of restauring the content of > esp issuing an add instruction too so that it can return allright. Right. Good. asms shouldn't clobber SP. SP is controlled by the compiler. > But reading GCC docs I found this: > > "If you refer to a particular hardware register from the assembler > code, you will probably have to list the register after the third > colon to tell the compiler the register's value is modified." > > Ok, so I do that. But looking at the assembler code generated by the > compiler I notice that it is exactly the same than before I did what > the docs say. So I wonder, why does the compiler needs to know if I > execute an instruction that modifies some register? And also (maybe > the answer to the former would respond this) why does the code doesn't > change? If you use a specific hardware register, say R7, then you need to tell the compiler you have done so, so that the compiler doesn't use that register to store a temporary. Andrew. From eyna2911@yahoo.com Mon Mar 12 08:12:00 2007 From: eyna2911@yahoo.com (Erna Yusnida) Date: Mon, 12 Mar 2007 08:12:00 -0000 Subject: error while install gcc Message-ID: <20070312042832.70348.qmail@web32713.mail.mud.yahoo.com> linux:/home/erna/gcc-4.1.2/gcc # configure --prefix=/usr bash: configure: command not found linux:/home/erna/gcc-4.1.2/gcc # ./configure cat: ./BASE-VER: No such file or directory configure: error: cannot run /bin/sh ./config.sub can someone help me solve this problem????? pls show me a details step to install gcc. I'm using SuSE 9.1 pro.i hv install gcc in Yast. But when i want to install ndiswrapper, the error tell that gcc 3.3 or newer version should be used. i hv read the articles in suse forum that to fix the problem should update the gcc.but when i install the gcc, i got the error..pls...someone..help me out!!!! pls give a details instruction to make this work.. ____________________________________________________________________________________ 8:00? 8:25? 8:40? Find a flick in no time with the Yahoo! Search movie showtime shortcut. http://tools.search.yahoo.com/shortcuts/#news From castillo@teisa.unican.es Mon Mar 12 10:46:00 2007 From: castillo@teisa.unican.es (Juan Castillo) Date: Mon, 12 Mar 2007 10:46:00 -0000 Subject: where can I get gcc optimizations information In-Reply-To: <17903.57444.43797.324340@zebedee.pink> References: <200703081057.45511.castillo@teisa.unican.es> <17903.57444.43797.324340@zebedee.pink> Message-ID: <200703120912.33753.castillo@teisa.unican.es> > Juan Castillo writes: > > I need some help with gcc optimizations and I don't know where I > > can get it. > > > > The objective of my work is to estimate how many machine > > instructions I can save in a program execution employing compiler > > optimizations. I am working with ARM architecture. Anyway, I have > > understood that main gcc optimizations are > > architecture-independent. > > > > In the gcc user's manual I have read that flags -O, -O1, -O2, -O3 > > and -Os activate different optimization flags (starting with "-f", > > I think), but not all of them are available individually. If I > > switch on all flags available individually for -O1 (-fdefer-pop, > > -fmerge-constants...) they have no effect in obtained machine code, > > but if I compile with -O1 option, there is a reduction of about 50% > > in machine instructions number with respect to basic compilation. > > > > With these results, I suppose that -O1 performs more actions that > > are not reported in any document I have found in The Internet. I > > have downloaded the gcc source-code but it is too difficult for me > > to understand it. My question is: where can I get full information > > about gcc optimizations and how they are performed? > > Full information is in the source. As Euclid (or someone else!) may > once have said, "There is no royal road to mathematics". If you are > really to understand, you'll have to get in there some time. > > However, some things will help you. -fverbose-asm produces a list of > optimization passes. The dumps "-da" and "-fdump-tree-all" produce a > lot of files, one per optimization pass, so you can see what each pass > did. Once you know which pass does what, you can start to look at the > code. > Thanks for your answer. When using "-fverbose-asm" flag in the commmand line to produce the list of optimization passes, I suppose you mean adding the "-S" flag to see the assemble file, don't you? I say this because using the flag in a common compilation doesn't produce any change. Anyway, taking a look at the assemble file, I can see the flags employed when I compile with -O1 option, but if I introduce them all in the command line instead of -O1 (it is supposed that the executable file would be the same), optimizations are not performed. What am I doing wrong? I have read source code and -O1 flag activates some other flags and it seems it does not any more. > > And another question: would be possible to get a benchmark or > > similar for compiler optimizations? That is, some set of programs > > that estimate the save that a compiler can achieve. I know it > > depends on the algotihms compiled, employed architecture and more > > (please, don't remember me that...). I just need an > > estimation. That would be great for my work. > > SPEC is a standard, but it's unfree and therefore off-topic here. > > Andrew. Thank you very much. -------------------------------------------------------------------- Juan Castillo Microelectronics Engineering Group. Dep. TEISA University of Cantabria. Spain. E-mail: castillo@teisa.unican.es -------------------------------------------------------------------- From sunil@qualcorelogic.com Mon Mar 12 10:56:00 2007 From: sunil@qualcorelogic.com (Parmar Sunil) Date: Mon, 12 Mar 2007 10:56:00 -0000 Subject: help to includes header files Message-ID: <45F57C32.7060806@qualcorelogic.com> Hi, I am a new user of gcc. I have written a simple program in which I am using stdio.h file. But compiler could not locate the path for the header files and it is giving error. stdio.h: No such file or directory When I included the $GCC/include using option -I$GCC/include, it was giving error about the files (header) which were included in the stdio.h file. stdio.h:7: sys/feature_tests.h: No such file or directory stdio.h:15: stdio_iso_SUNWCC.h: No such file or directory Is there any option which look at all the directories for headers ? If I am not wrong, this option can be given during installation. Can it be? Are these header files linked with libraries ? Please give me suggestion to solve this problem. Thanks -- Parmar Sunil From mikael.debie@student.uclouvain.be Mon Mar 12 11:53:00 2007 From: mikael.debie@student.uclouvain.be (Mikael De Bie) Date: Mon, 12 Mar 2007 11:53:00 -0000 Subject: Problem using libraries Message-ID: <1173696940.9242.6.camel@ptitbeuk> Hi everybody, I'm trying to create a UNO component for openoffice. In this component, I would use gecode libraries. But I get an error hwen I compile the whole component whith this class. Here's the errors I get : 1. ---- If I'm using the -c option, the linking is not done and the component library loading failes : Warning : g++: -lgecodeint: linker input file unused because linking not done g++: -lgecodeset: linker input file unused because linking not done g++: -lgecodeminimodel: linker input file unused because linking not done g++: -lgecodekernel: linker input file unused because linking not done g++: -lgecodesearch: linker input file unused because linking not done Erreur : error (CannotRegisterImplementationException): loading component library failed: scsolver.uno.so 2. ---- If I don't use the -c option, here's the error I get : /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib/crt1.o: In function `_start': (.text+0x18): undefined reference to `main' But I don't have any main function, since it's a uno component for openoffice This is the part of the Makefile to compile the class gecode.cxx : gecode.o : $(HEADER) $(NUMDIR)/gecode.cxx /usr/bin/g++ `pkg-config --libs --cflags gecode gecode-minimodel gecode-search` -DDEBUG -Os -mtune=pentium4 -I../../../source/inc -I. -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3 -DHAVE_GCC_VISIBILITY_FEATURE -DENABLE_SCSOLVER_UNO_ALGORITHM \ -o gecode.o -fPIC -fno-rtti -fno-common -export-dynamic -fvisibility=hidden -c ../../../source/numeric/gecode.cxx Have anyone any idea to help me ? Thanks in advance ! Mikael De Bie From eljay@adobe.com Mon Mar 12 11:57:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Mon, 12 Mar 2007 11:57:00 -0000 Subject: error while install gcc In-Reply-To: <20070312042832.70348.qmail@web32713.mail.mud.yahoo.com> Message-ID: Hi Erna, > pls give a details instruction to make this work.. http://gcc.gnu.org/install/configure.html HTH, --Eljay From eljay@adobe.com Mon Mar 12 12:43:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Mon, 12 Mar 2007 12:43:00 -0000 Subject: where can I get gcc optimizations information In-Reply-To: <200703120912.33753.castillo@teisa.unican.es> Message-ID: Hi Juan, > When using "-fverbose-asm" flag in the commmand line to produce the list of > optimization passes, I suppose you mean adding the "-S" flag to see the > assemble file, don't you? I say this because using the flag in a common > compilation doesn't produce any change. > Anyway, taking a look at the assemble file, I can see the flags employed when > I compile with -O1 option, but if I introduce them all in the command line > instead of -O1 (it is supposed that the executable file would be the same), > optimizations are not performed. What am I doing wrong? I have read source > code and -O1 flag activates some other flags and it seems it does not any > more. -O0 (which is the default if not specified) disables optimizations. So introducing specific flagged optimizations in the context of optimizations disabled has no effect. HTH, --Eljay From aph@redhat.com Mon Mar 12 13:20:00 2007 From: aph@redhat.com (Andrew Haley) Date: Mon, 12 Mar 2007 13:20:00 -0000 Subject: where can I get gcc optimizations information In-Reply-To: <200703120912.33753.castillo@teisa.unican.es> References: <200703081057.45511.castillo@teisa.unican.es> <17903.57444.43797.324340@zebedee.pink> <200703120912.33753.castillo@teisa.unican.es> Message-ID: <17909.19183.456194.255564@zebedee.pink> Juan Castillo writes: > > Juan Castillo writes: > > > I need some help with gcc optimizations and I don't know where I > > > can get it. > > > > > > The objective of my work is to estimate how many machine > > > instructions I can save in a program execution employing compiler > > > optimizations. I am working with ARM architecture. Anyway, I have > > > understood that main gcc optimizations are > > > architecture-independent. > > > > > > In the gcc user's manual I have read that flags -O, -O1, -O2, -O3 > > > and -Os activate different optimization flags (starting with "-f", > > > I think), but not all of them are available individually. If I > > > switch on all flags available individually for -O1 (-fdefer-pop, > > > -fmerge-constants...) they have no effect in obtained machine code, > > > but if I compile with -O1 option, there is a reduction of about 50% > > > in machine instructions number with respect to basic compilation. > > > > > > With these results, I suppose that -O1 performs more actions that > > > are not reported in any document I have found in The Internet. I > > > have downloaded the gcc source-code but it is too difficult for me > > > to understand it. My question is: where can I get full information > > > about gcc optimizations and how they are performed? > > > > Full information is in the source. As Euclid (or someone else!) may > > once have said, "There is no royal road to mathematics". If you are > > really to understand, you'll have to get in there some time. > > > > However, some things will help you. -fverbose-asm produces a list of > > optimization passes. The dumps "-da" and "-fdump-tree-all" produce a > > lot of files, one per optimization pass, so you can see what each pass > > did. Once you know which pass does what, you can start to look at the > > code. > > > Thanks for your answer. > When using "-fverbose-asm" flag in the commmand line to produce the list of > optimization passes, I suppose you mean adding the "-S" flag to see the > assemble file, don't you? I say this because using the flag in a common > compilation doesn't produce any change. You have to use -save-temps to get the assembly file. The dumps are probably the most interesting part. > Anyway, taking a look at the assemble file, I can see the flags > employed when I compile with -O1 option, but if I introduce them > all in the command line instead of -O1 (it is supposed that the > executable file would be the same) It won't be. Without -O, you won't get any optimization. > optimizations are not performed. What am I doing wrong? I have read > source code and -O1 flag activates some other flags and it seems it > does not any more. Andrew. From feradz@gmail.com Mon Mar 12 16:02:00 2007 From: feradz@gmail.com (Ferad Zyulkyarov) Date: Mon, 12 Mar 2007 16:02:00 -0000 Subject: help to includes header files In-Reply-To: <45F57C32.7060806@qualcorelogic.com> References: <45F57C32.7060806@qualcorelogic.com> Message-ID: Hi, Probably there is a problem with the installation of your gcc, particularly stdlibc.. These header files should be in /usr/include. In this case I just install a clean gcc - there is no fixing hassles. On 3/12/07, Parmar Sunil wrote: > Hi, > I am a new user of gcc. I have written a simple program in which I am > using stdio.h file. But compiler could not locate the path for the > header files and it is giving error. > stdio.h: No such file or directory > When I included the $GCC/include using option -I$GCC/include, it was > giving error about the files (header) which were included in the stdio.h > file. > stdio.h:7: sys/feature_tests.h: No such file or directory > stdio.h:15: stdio_iso_SUNWCC.h: No such file or directory > > Is there any option which look at all the directories for headers ? If I > am not wrong, this option can be given during installation. Can it be? > Are these header files linked with libraries ? > Please give me suggestion to solve this problem. > Thanks > > -- > Parmar Sunil > > > -- Ferad Zyulkyarov Barcelona Supercomputing Center From aph@redhat.com Mon Mar 12 16:06:00 2007 From: aph@redhat.com (Andrew Haley) Date: Mon, 12 Mar 2007 16:06:00 -0000 Subject: where can I get gcc optimizations information In-Reply-To: References: <200703081057.45511.castillo@teisa.unican.es> <17903.57444.43797.324340@zebedee.pink> <200703120912.33753.castillo@teisa.unican.es> <17909.19183.456194.255564@zebedee.pink> Message-ID: <17909.31117.108756.319594@zebedee.pink> Sunzir Deepur writes: > Hi > > On 3/12/07, Andrew Haley wrote: > > Juan Castillo writes: > > > > Juan Castillo writes: > > > > However, some things will help you. -fverbose-asm produces a list of > > > > optimization passes. The dumps "-da" and "-fdump-tree-all" produce a > > > > lot of files, one per optimization pass, so you can see what each pass > > > > did. Once you know which pass does what, you can start to look at the > > > > code. > > What is the difference between -fdump-tree-all and -fdump-rtl-all ? What differences did you see when you looked? > what does the -da annotations mean ? I don't understand this question. Andrew. From sunzird@gmail.com Mon Mar 12 16:21:00 2007 From: sunzird@gmail.com (Sunzir Deepur) Date: Mon, 12 Mar 2007 16:21:00 -0000 Subject: where can I get gcc optimizations information In-Reply-To: <17909.19183.456194.255564@zebedee.pink> References: <200703081057.45511.castillo@teisa.unican.es> <17903.57444.43797.324340@zebedee.pink> <200703120912.33753.castillo@teisa.unican.es> <17909.19183.456194.255564@zebedee.pink> Message-ID: Hi On 3/12/07, Andrew Haley wrote: > Juan Castillo writes: > > > Juan Castillo writes: > > > However, some things will help you. -fverbose-asm produces a list of > > > optimization passes. The dumps "-da" and "-fdump-tree-all" produce a > > > lot of files, one per optimization pass, so you can see what each pass > > > did. Once you know which pass does what, you can start to look at the > > > code. What is the difference between -fdump-tree-all and -fdump-rtl-all ? what does the -da annotations mean ? Thanks sunzir From sunzird@gmail.com Mon Mar 12 16:21:00 2007 From: sunzird@gmail.com (Sunzir Deepur) Date: Mon, 12 Mar 2007 16:21:00 -0000 Subject: where can I get gcc optimizations information In-Reply-To: <17909.31117.108756.319594@zebedee.pink> References: <200703081057.45511.castillo@teisa.unican.es> <17903.57444.43797.324340@zebedee.pink> <200703120912.33753.castillo@teisa.unican.es> <17909.19183.456194.255564@zebedee.pink> <17909.31117.108756.319594@zebedee.pink> Message-ID: Hello > > On 3/12/07, Andrew Haley wrote: > > What is the difference between -fdump-tree-all and -fdump-rtl-all ? > > What differences did you see when you looked? well, fdump-rtl produced a lot of files in RTL syntax, and i guess each file corresponds to a different PASS. when used with -dv it also produces VCG graphes, but not to them all. why doesn't it produce a vcg file to the last five passes too ? when i tried fdump-tree-all, it produced files with numbers that are prefixed with 't'. i guess it stands for 'tree' but the syntax of these files was unclear to me. are those files correspons to passes, too ? where can i learn about their syntax ? > > what does the -da annotations mean ? > > I don't understand this question. I just didn't understand what does the -da does. it says it adds annotations but i couldn't understand where.. Thank You !!!! sunzir. From David.CARTER-HITCHIN@rbos.com Mon Mar 12 16:24:00 2007 From: David.CARTER-HITCHIN@rbos.com (CARTER-HITCHIN, David, GBM) Date: Mon, 12 Mar 2007 16:24:00 -0000 Subject: where can I get gcc optimizations information Message-ID: <3B4C77997DD0254B86D3C9454476B6BC0F03EC1D@lonms00812.fm.rbsgrp.net> Hi GCC'ers > > > > Juan Castillo writes: > > > > However, some things will help you. -fverbose-asm > produces a list of > > > > optimization passes. The dumps "-da" and > "-fdump-tree-all" produce a > > > > lot of files, one per optimization pass, so you can > see what each pass Forgive me if I've missed something obvious, but does anyone know if the output from -fdump-tree-all is documented somewhere? I was trying to understand a vexing C++ parse the other day and having such documents would have helped. Many Thanks, David. *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our websites at: www.rbs.com www.rbsgc.com www.rbsmarkets.com *********************************************************************************** From aph@redhat.com Mon Mar 12 16:36:00 2007 From: aph@redhat.com (Andrew Haley) Date: Mon, 12 Mar 2007 16:36:00 -0000 Subject: where can I get gcc optimizations information In-Reply-To: <3B4C77997DD0254B86D3C9454476B6BC0F03EC1D@lonms00812.fm.rbsgrp.net> References: <3B4C77997DD0254B86D3C9454476B6BC0F03EC1D@lonms00812.fm.rbsgrp.net> Message-ID: <17909.32414.881087.533133@zebedee.pink> CARTER-HITCHIN, David, GBM writes: > *********************************************************************************** > The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. > Authorised and regulated by the Financial Services Authority > > This e-mail message is confidential and for use by the > addressee only. Please do not send such attachments to this list. We cannot read your mails. If there is no way you can send mail from your location without such attachments, there are web-based services you can use. Andrew. From David.CARTER-HITCHIN@rbos.com Mon Mar 12 16:40:00 2007 From: David.CARTER-HITCHIN@rbos.com (CARTER-HITCHIN, David, GBM) Date: Mon, 12 Mar 2007 16:40:00 -0000 Subject: Signatures Was: where can I get gcc optimizations information Message-ID: <3B4C77997DD0254B86D3C9454476B6BC0F03EC1E@lonms00812.fm.rbsgrp.net> Hi Andrew et al., > > This e-mail message is confidential and for use by the > > addressee only. > Please do not send such attachments to this list. We cannot read your > mails. Why not? The addressee is the list and all the members of that list. I dont' see anything at odds with the legal signature. Also, you evidently can read my mails, as you have done so and are now responding to me! I am writing in confidence to this list, that is - I am confident that my words are going to end up with the list's recipients. > If there is no way you can send mail from your location without such > attachments, there are web-based services you can use. You're right - there's nothing I can do about it. If you feel so strongly about this then I can use a web gateway if they are not prohibited here, but it's never been a problem before - either on this list or many of the others to which I belong. I can always reply from my home account and remove all signs of a signature, but what of people who only have access at work? Regards, David. From aph@redhat.com Mon Mar 12 16:47:00 2007 From: aph@redhat.com (Andrew Haley) Date: Mon, 12 Mar 2007 16:47:00 -0000 Subject: Signatures Was: where can I get gcc optimizations information In-Reply-To: <3B4C77997DD0254B86D3C9454476B6BC0F03EC1E@lonms00812.fm.rbsgrp.net> References: <3B4C77997DD0254B86D3C9454476B6BC0F03EC1E@lonms00812.fm.rbsgrp.net> Message-ID: <17909.33368.751048.296437@zebedee.pink> CARTER-HITCHIN, David, GBM writes: > Hi Andrew et al., > > > > This e-mail message is confidential and for use by the > > > addressee only. > > > Please do not send such attachments to this list. We cannot read your > > mails. > > Why not? The addressee is the list and all the members of that list. http://gcc.gnu.org/lists.html: Policies Please do not include or reference confidentiality notices, like: The referring document contains privileged and confidential information. If you are not the intended recipient you must not disseminate, copy or take any action in reliance on it, and we request that you notify companyname immediately. Such disclaimers are inappropriate for mail sent to public lists. If your company automatically adds something like this to outgoing mail, and you can't convince them to stop, you might consider using a free web-based e-mail account. Andrew. From David.CARTER-HITCHIN@rbos.com Mon Mar 12 19:10:00 2007 From: David.CARTER-HITCHIN@rbos.com (CARTER-HITCHIN, David, GBM) Date: Mon, 12 Mar 2007 19:10:00 -0000 Subject: Signatures Was: where can I get gcc optimizations information Message-ID: <3B4C77997DD0254B86D3C9454476B6BC0F03EC20@lonms00812.fm.rbsgrp.net> Hello Andrew (once again), > Such disclaimers are inappropriate for mail sent to public lists. If > your company automatically adds something like this to outgoing mail, > and you can't convince them to stop, you might consider using a free > web-based e-mail account. I have at least two of these, and they're both banned here at work, hence my point about people not being able to interact with the list, who work in such organisations. Regards, David. > -----Original Message----- > From: Andrew Haley [mailto:aph@redhat.com] > Sent: 12 March 2007 16:40 > To: CARTER-HITCHIN, David, GBM > Cc: 'Sunzir Deepur'; gcc-help@gcc.gnu.org > Subject: RE: Signatures Was: where can I get gcc > optimizations information > > CARTER-HITCHIN, David, GBM writes: > > Hi Andrew et al., > > > > > > This e-mail message is confidential and for use by the > > > > addressee only. > > > > > Please do not send such attachments to this list. We > cannot read your > > > mails. > > > > Why not? The addressee is the list and all the members of > that list. > > http://gcc.gnu.org/lists.html: > > > Policies > > Please do not include or reference confidentiality notices, like: > > The referring document contains privileged and confidential > information. If you are not the intended recipient you must not > disseminate, copy or take any action in reliance on it, and we > request that you notify companyname immediately. > > > Andrew. > From mw_triad@users.sourceforge.net Mon Mar 12 20:32:00 2007 From: mw_triad@users.sourceforge.net (Matthew Woehlke) Date: Mon, 12 Mar 2007 20:32:00 -0000 Subject: how to cast away 'volatile'? Message-ID: I have a code snippet that looks roughly like this: extern void my_free(void* ptr); int foo() { volatile long * bar; ... my_free(bar); } This generates the warning 'cast discards qualifiers from pointer target type' at my_free() (gcc 3.4.3). Other than disabling the flag that generates the warning (in general I want these warnings!), how do I suppress this? my_free is of course a free() wrapper, i.e. I don't see any problems discarding the qualifier at this point. I already tried this, which seems like it used to work (I am moving the code from one project to another): my_free(void*)bar); ...and it doesn't help. -- Matthew Emacs is a nice OS - but it lacks a good text editor. That's why I am using Vim. -- Anonymous From jeffreyholle@bellsouth.net Mon Mar 12 21:18:00 2007 From: jeffreyholle@bellsouth.net (Jeffrey Holle) Date: Mon, 12 Mar 2007 21:18:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: Message-ID: Matthew Woehlke wrote: > my_free(void*)bar); Should be: my_free((void*)bar); From mw_triad@users.sourceforge.net Mon Mar 12 21:42:00 2007 From: mw_triad@users.sourceforge.net (Matthew Woehlke) Date: Mon, 12 Mar 2007 21:42:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: Message-ID: Jeffrey Holle wrote: > Matthew Woehlke wrote: > >> my_free(void*)bar); > > Should be: > my_free((void*)bar); ...excusing the typo. :-) The point was I have tried what you suggested (i.e. what I wrote, sans the obvious typo), and I get the same warning. I'm attaching a file that demonstrates the problem when built with '-Wcast-qual'. Note that it builds with the warning (cast.c:8), but no errors. (Runs OK too...) -- Matthew Emacs is a nice OS - but it lacks a good text editor. That's why I am using Vim. -- Anonymous -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: cast.c URL: From crowl@google.com Mon Mar 12 22:06:00 2007 From: crowl@google.com (Lawrence Crowl) Date: Mon, 12 Mar 2007 22:06:00 -0000 Subject: Linux c++ opmization--- linux runs at half the speed of windows? In-Reply-To: References: Message-ID: <29bd08b70703121442t199859d7h3c0159c2dc1a4c15@mail.gmail.com> Is your windows compiler doing automatic parallelization by chance? Twice as fast on a dual core processor is a bit too coincidental. :-) On 3/8/07, Shane R wrote: > Hi, > > I hope this is the appropriate forum. Please direct me to the correct one if > it is not. > > I am trying to optimize a c++ application that I ported from a windows > system to Linux. > The app is a terminal based application that does some one time file io at > the start then runs completely in memory. After the one time io the app runs > successive timed epochs on the same data in Windows as Linux. The app is a > program that runs some code for doing non-linear optmization (math stuff). > > The reason why I am posting is that I timed the time it takes for the > application to complete an epoch. It take twice as long in Linux as > windows?!?! > > My system is an Intel Centrino Duo with 2gigs of ram. The application is > only using a fraction of available memory in windows and linux. The > application is single-threaded in both. > > I am using Visual Studio 2003 in Windows and when I type gcc -v I get: > Target: i486-linux-gnu > Configured with: ../src/configure -v > --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr > --enable-shared --with-system-zlib --libexecdir=/usr/lib > --without-included-gettext --enable-threads=posix --enable-nls > --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu > --enable-libstdcxx-debug --enable-mpfr --enable-checking=release > i486-linux-gnu > Thread model: posix > gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) > > > > I am currently using these g++ options: > > CFLAGS = -o3 -O3 -march=pentium4 -ffast-math -funroll-loops -Wall > -Wno-return-type > > But I have tried every permutation of the above options to virtually no > effect > > The average run time of an epoch in windows is about 3000 milliseconds while > the average run time of an epoch in Linux is 6000! > > I don't know if it matters but I am doing calls to the rand() function in > both my windows and linux apps. > > On another note does anyone have any experience with the Intel drop in > replacement for GCC? > > Thanks in advance for any help, > > Shane > > _________________________________________________________________ > Match.com - Click Here To Find Singles In Your Area Today! > http://match.engb.msn.com/ > > -- Lawrence Crowl From arturas.moskvinas@gmail.com Mon Mar 12 23:13:00 2007 From: arturas.moskvinas@gmail.com (=?UTF-8?B?QXJ0xatyYXMgTW9za3ZpbmFz?=) Date: Mon, 12 Mar 2007 23:13:00 -0000 Subject: Linux c++ opmization--- linux runs at half the speed of windows? In-Reply-To: <29bd08b70703121442t199859d7h3c0159c2dc1a4c15@mail.gmail.com> References: <29bd08b70703121442t199859d7h3c0159c2dc1a4c15@mail.gmail.com> Message-ID: <45F5CECE.7060605@gmail.com> Hi, You should try profiling, it should help you to find the place were program is taking longest (gprof). Maybe you use some floating point operations??? Commercial compilers often like to use non IEEE compliant floating operations, try -ffast-math... > Is your windows compiler doing automatic parallelization by chance? > Twice as fast on a dual core processor is a bit too coincidental. :-) > > On 3/8/07, Shane R wrote: >> Hi, >> >> I hope this is the appropriate forum. Please direct me to the correct >> one if >> it is not. >> >> I am trying to optimize a c++ application that I ported from a windows >> system to Linux. >> The app is a terminal based application that does some one time file >> io at >> the start then runs completely in memory. After the one time io the >> app runs >> successive timed epochs on the same data in Windows as Linux. The app >> is a >> program that runs some code for doing non-linear optmization (math >> stuff). >> >> The reason why I am posting is that I timed the time it takes for the >> application to complete an epoch. It take twice as long in Linux as >> windows?!?! >> >> My system is an Intel Centrino Duo with 2gigs of ram. The application is >> only using a fraction of available memory in windows and linux. The >> application is single-threaded in both. >> >> I am using Visual Studio 2003 in Windows and when I type gcc -v I get: >> Target: i486-linux-gnu >> Configured with: ../src/configure -v >> --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr >> --enable-shared --with-system-zlib --libexecdir=/usr/lib >> --without-included-gettext --enable-threads=posix --enable-nls >> --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu >> --enable-libstdcxx-debug --enable-mpfr --enable-checking=release >> i486-linux-gnu >> Thread model: posix >> gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) >> >> >> >> I am currently using these g++ options: >> >> CFLAGS = -o3 -O3 -march=pentium4 -ffast-math -funroll-loops -Wall >> -Wno-return-type >> >> But I have tried every permutation of the above options to virtually no >> effect >> >> The average run time of an epoch in windows is about 3000 milliseconds >> while >> the average run time of an epoch in Linux is 6000! >> >> I don't know if it matters but I am doing calls to the rand() function in >> both my windows and linux apps. >> >> On another note does anyone have any experience with the Intel drop in >> replacement for GCC? >> >> Thanks in advance for any help, >> >> Shane >> >> _________________________________________________________________ >> Match.com - Click Here To Find Singles In Your Area Today! >> http://match.engb.msn.com/ >> >> > > From john.carter@tait.co.nz Mon Mar 12 23:49:00 2007 From: john.carter@tait.co.nz (John Carter) Date: Mon, 12 Mar 2007 23:49:00 -0000 Subject: Linux c++ opmization--- linux runs at half the speed of windows? In-Reply-To: References: Message-ID: On Thu, 8 Mar 2007, Shane R wrote: > I am trying to optimize a c++ application that I ported from a windows system > to Linux. 1. Do you use gcc under windows as well? If so which version on windows and which on Linux? gcc is not the best optimizer in the world.... 2. Run... vmstat 5 for a half a page whilst your app is running and post that. 3. Watch "top", is your CPU running at 100%? Is it very near 100% in user mode? Is your particular app running at very near 100% in user mode? 4. Run your app under "strace" and see what it's doing. 5. -O3 and -funroll-loops does not necessarily improve things if it destroys the cache utility. 6. -O2 -fomit-frame-pointer -march=WHATEVERAPPROPRIATE may do better. 7. My general experience is Linux Apps run significantly faster than windows. 8. Fire up gkrellm. Hmm you say you have a centrino duo, does that mean it has dual cores? Does gkrellm show you have two CPU's running? ie. Do you have the right kernel for your Dual core? > The app is a terminal based application that does some one time file io at > the start then runs completely in memory. Does it read/write lots to any file / device eg. terminal? John Carter Phone : (64)(3) 358 6639 Tait Electronics Fax : (64)(3) 359 4632 PO Box 1645 Christchurch Email : john.carter@tait.co.nz New Zealand From david@carter-hitchin.clara.co.uk Tue Mar 13 03:28:00 2007 From: david@carter-hitchin.clara.co.uk (DCH) Date: Tue, 13 Mar 2007 03:28:00 -0000 Subject: -fdump-tree-all documentation. In-Reply-To: <3B4C77997DD0254B86D3C9454476B6BC0F03EC1D@lonms00812.fm.rbs grp.net> References: <3B4C77997DD0254B86D3C9454476B6BC0F03EC1D@lonms00812.fm.rbsgrp.net> Message-ID: Hi GCC'ers Forgive me if I've missed something obvious, but does anyone know if the output from -fdump-tree-all is documented somewhere? I was trying to understand a vexing C++ parse the other day and having such documents would have helped. Many Thanks, David. From clumsguy@gmail.com Tue Mar 13 07:03:00 2007 From: clumsguy@gmail.com (mike xu) Date: Tue, 13 Mar 2007 07:03:00 -0000 Subject: Does gcc-2.95 support such function? In-Reply-To: <7103aeea0703122022k2d050e55n5ed17f539af923be@mail.gmail.com> References: <7103aeea0703122022k2d050e55n5ed17f539af923be@mail.gmail.com> Message-ID: <7103aeea0703122028o21273170m7b384f890f8dcf10@mail.gmail.com> Hello, I want to use gcc to collect all the parameter's value used by one function in all my source code during compile time. But I am not sure of that gcc supports this or not? Below is an example: $grep ConfigGetParam * -r src/addon_util.c:789: ConfigGetParam("T1", chParamValue, CONFIG_MAXPARAMLENGTH); src/bdgporttable.c:128: ConfigGetParam(Name, tempBuf, CONFIG_MAXPARAMLENGTH); src/agent.c:2534: ConfigStatus = ConfigGetParam("SNMP", oBuffer, MAX_MAXPARAMLENGTH); ... The result I expected is a list of the values of ConfigGetParam function's first parameter, if src/bdgporttable.c:128: Name="WHOAMI", then the list is: "T1" "WHOAMI" "SNMP" ... Does gcc have such feature? If it supports, which parameter I shall assign to gcc during compile time? Thanks a lot, Mike From lordgalloth@gmail.com Tue Mar 13 08:57:00 2007 From: lordgalloth@gmail.com (Galloth) Date: Tue, 13 Mar 2007 08:57:00 -0000 Subject: Linux c++ opmization--- linux runs at half the speed of windows? In-Reply-To: <29bd08b70703121442t199859d7h3c0159c2dc1a4c15@mail.gmail.com> References: <29bd08b70703121442t199859d7h3c0159c2dc1a4c15@mail.gmail.com> Message-ID: <5abcb5650703130003q4669159fx3d04a97f016e275d@mail.gmail.com> hi, is it possible, that Your windows compiler is able to optimize for Core or Core2 processors? Pentium4 is not Dual Core. Intel rebuild the whole processor. Jan K 2007/3/12, Lawrence Crowl : > Is your windows compiler doing automatic parallelization by chance? > Twice as fast on a dual core processor is a bit too coincidental. :-) > > On 3/8/07, Shane R wrote: > > Hi, > > > > I hope this is the appropriate forum. Please direct me to the correct one if > > it is not. > > > > I am trying to optimize a c++ application that I ported from a windows > > system to Linux. > > The app is a terminal based application that does some one time file io at > > the start then runs completely in memory. After the one time io the app runs > > successive timed epochs on the same data in Windows as Linux. The app is a > > program that runs some code for doing non-linear optmization (math stuff). > > > > The reason why I am posting is that I timed the time it takes for the > > application to complete an epoch. It take twice as long in Linux as > > windows?!?! > > > > My system is an Intel Centrino Duo with 2gigs of ram. The application is > > only using a fraction of available memory in windows and linux. The > > application is single-threaded in both. > > > > I am using Visual Studio 2003 in Windows and when I type gcc -v I get: > > Target: i486-linux-gnu > > Configured with: ../src/configure -v > > --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr > > --enable-shared --with-system-zlib --libexecdir=/usr/lib > > --without-included-gettext --enable-threads=posix --enable-nls > > --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu > > --enable-libstdcxx-debug --enable-mpfr --enable-checking=release > > i486-linux-gnu > > Thread model: posix > > gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) > > > > > > > > I am currently using these g++ options: > > > > CFLAGS = -o3 -O3 -march=pentium4 -ffast-math -funroll-loops -Wall > > -Wno-return-type > > > > But I have tried every permutation of the above options to virtually no > > effect > > > > The average run time of an epoch in windows is about 3000 milliseconds while > > the average run time of an epoch in Linux is 6000! > > > > I don't know if it matters but I am doing calls to the rand() function in > > both my windows and linux apps. > > > > On another note does anyone have any experience with the Intel drop in > > replacement for GCC? > > > > Thanks in advance for any help, > > > > Shane > > > > _________________________________________________________________ > > Match.com - Click Here To Find Singles In Your Area Today! > > http://match.engb.msn.com/ > > > > > > > -- > Lawrence Crowl > -- Jan Kastil galloth@jabbim.cz From aph@redhat.com Tue Mar 13 09:41:00 2007 From: aph@redhat.com (Andrew Haley) Date: Tue, 13 Mar 2007 09:41:00 -0000 Subject: -fdump-tree-all documentation. In-Reply-To: <200703122349.l2CNnjOg000953@mx1.redhat.com> References: <3B4C77997DD0254B86D3C9454476B6BC0F03EC1D@lonms00812.fm.rbsgrp.net> <200703122349.l2CNnjOg000953@mx1.redhat.com> Message-ID: <17910.26477.347058.814071@zebedee.pink> DCH writes: > Forgive me if I've missed something obvious, but does anyone > know if the output from -fdump-tree-all is documented somewhere? It's C, more or less, except for a few additions such as Phi nodes. Which part are you having difficulty with? Andrew. From aph@redhat.com Tue Mar 13 14:51:00 2007 From: aph@redhat.com (Andrew Haley) Date: Tue, 13 Mar 2007 14:51:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: Message-ID: <17910.29117.938526.285262@zebedee.pink> Matthew Woehlke writes: > I have a code snippet that looks roughly like this: > > extern void my_free(void* ptr); > > int foo() > { > volatile long * bar; > ... > my_free(bar); > } > > This generates the warning 'cast discards qualifiers from pointer target > type' at my_free() (gcc 3.4.3). Other than disabling the flag that > generates the warning (in general I want these warnings!), how do I > suppress this? my_free is of course a free() wrapper, i.e. I don't see > any problems discarding the qualifier at this point. I already tried > this, which seems like it used to work (I am moving the code from one > project to another): > > my_free(void*)bar); > > ...and it doesn't help. I think this is bad practice. You'd be far better advised to malloc() the memory, keep a void* pointer to it, but cast to volatile long * when volatile is actually required. Andrew. From ndenmark@googlemail.com Tue Mar 13 15:21:00 2007 From: ndenmark@googlemail.com (Nate Denmark) Date: Tue, 13 Mar 2007 15:21:00 -0000 Subject: Optimisation puzzle Message-ID: Hello all, I have a question about the optimiser in GCC. Take this bit of code: for(x = 0; x != 10; x++) puts("Hello"); When compiled with full optimisations (-O3, -fexpensive-optimizations etc.) it generates the following loop in assembly: .L2: incl %ebx movl $.LC0, (%esp) call puts cmpl $10, %ebx jne .L2 .LC0 points to the "Hello" string. I'm wondering why GCC puts that 'movl' line inside the loop, so that it's executed each time, when it could go before the loop? As I understand it, 'puts' shouldn't do anything to the stack, and the return value is passed back in eax, so I'm not sure why it's doing the 'movl' each time. If I force loop unrolling the same thing happens -- the 'movl' each iteration. That said, I don't know much about compiler design so I'm probably missing something here! Thanks, Nate From iant@google.com Tue Mar 13 15:25:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Tue, 13 Mar 2007 15:25:00 -0000 Subject: Optimisation puzzle In-Reply-To: References: Message-ID: "Nate Denmark" writes: > I have a question about the optimiser in GCC. Take this bit of code: > > for(x = 0; x != 10; x++) > puts("Hello"); > > When compiled with full optimisations (-O3, -fexpensive-optimizations > etc.) it generates the following loop in assembly: > > .L2: > incl %ebx > movl $.LC0, (%esp) > call puts > cmpl $10, %ebx > jne .L2 > > .LC0 points to the "Hello" string. I'm wondering why GCC puts that > 'movl' line inside the loop, so that it's executed each time, when it > could go before the loop? As I understand it, 'puts' shouldn't do > anything to the stack, and the return value is passed back in eax, so > I'm not sure why it's doing the 'movl' each time. If I force loop > unrolling the same thing happens -- the 'movl' each iteration. Technically the parameters pushed on the stack become the property of the function being called. For example, code like this: int foo (int a) { int *p = &a; *p = 1; return *p; } could be compiled to change the value pushed on the stack. Since gcc doesn't know how puts is implemented, it can't assume that puts does not change the value on the stack. So it has to restore the value before each call, just in case. Ian From iant@google.com Tue Mar 13 15:27:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Tue, 13 Mar 2007 15:27:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <17910.29117.938526.285262@zebedee.pink> References: <17910.29117.938526.285262@zebedee.pink> Message-ID: Andrew Haley writes: > Matthew Woehlke writes: > > I have a code snippet that looks roughly like this: > > > > extern void my_free(void* ptr); > > > > int foo() > > { > > volatile long * bar; > > ... > > my_free(bar); > > } > > > > This generates the warning 'cast discards qualifiers from pointer target > > type' at my_free() (gcc 3.4.3). Other than disabling the flag that > > generates the warning (in general I want these warnings!), how do I > > suppress this? my_free is of course a free() wrapper, i.e. I don't see > > any problems discarding the qualifier at this point. I already tried > > this, which seems like it used to work (I am moving the code from one > > project to another): > > > > my_free(void*)bar); > > > > ...and it doesn't help. > > I think this is bad practice. You'd be far better advised to malloc() > the memory, keep a void* pointer to it, but cast to volatile long * > when volatile is actually required. Note that this is also somewhat dubious on a strict reading of the C standard. The standard discusss access to volatile qualified objects, and it says that casting away volatile is undefined. The standard says absolutely nothing about volatile qualified pointers to non-volatile objects. So you should not expect any particular semantics from a volatile-qualified pointer which points to a non-volatile-qualified object. Ian From aph@redhat.com Tue Mar 13 15:51:00 2007 From: aph@redhat.com (Andrew Haley) Date: Tue, 13 Mar 2007 15:51:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: <17910.29117.938526.285262@zebedee.pink> Message-ID: <17910.49874.908961.521088@zebedee.pink> Ian Lance Taylor writes: > Andrew Haley writes: > > > Matthew Woehlke writes: > > > I have a code snippet that looks roughly like this: > > > > > > extern void my_free(void* ptr); > > > > > > int foo() > > > { > > > volatile long * bar; > > > ... > > > my_free(bar); > > > } > > > > > > This generates the warning 'cast discards qualifiers from pointer target > > > type' at my_free() (gcc 3.4.3). Other than disabling the flag that > > > generates the warning (in general I want these warnings!), how do I > > > suppress this? my_free is of course a free() wrapper, i.e. I don't see > > > any problems discarding the qualifier at this point. I already tried > > > this, which seems like it used to work (I am moving the code from one > > > project to another): > > > > > > my_free(void*)bar); > > > > > > ...and it doesn't help. > > > > I think this is bad practice. You'd be far better advised to malloc() > > the memory, keep a void* pointer to it, but cast to volatile long * > > when volatile is actually required. > > Note that this is also somewhat dubious on a strict reading of the C > standard. The standard discusss access to volatile qualified objects, > and it says that casting away volatile is undefined. The standard > says absolutely nothing about volatile qualified pointers to > non-volatile objects. So you should not expect any particular > semantics from a volatile-qualified pointer which points to a > non-volatile-qualified object. Mmmm, but let's say you want a dynamic shared buffer between threads. How else would you do it, other than a malloc() and a cast? Andrew. From iant@google.com Tue Mar 13 15:58:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Tue, 13 Mar 2007 15:58:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <17910.49874.908961.521088@zebedee.pink> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> Message-ID: Andrew Haley writes: > Ian Lance Taylor writes: > > Note that this is also somewhat dubious on a strict reading of the C > > standard. The standard discusss access to volatile qualified objects, > > and it says that casting away volatile is undefined. The standard > > says absolutely nothing about volatile qualified pointers to > > non-volatile objects. So you should not expect any particular > > semantics from a volatile-qualified pointer which points to a > > non-volatile-qualified object. > > Mmmm, but let's say you want a dynamic shared buffer between threads. > How else would you do it, other than a malloc() and a cast? volatile won't help you there anyhow. If you follow the standard, there is exactly one thing you can reliably do with volatile: use it to access a memory mapped device register. volatile doesn't help when sharing a memory buffer between threads because volatile carries no implication of a read/write memory barrier. If you are on a multi-core SMP system, and the threads are running on different cores, and you don't use any explicit memory fence machine instructions, then the processors are completely free to rearrange the memory accesses with respect to each other. That is, each processor will provide a consistent view of memory within the processor, but the two processors will not provide consistent views of memory with respect to each other. This happens in practice, not just in theory, because each processor has its own local cache. That means that the only correct way to share a memory buffer between threads is to use a mutex, and it means that the mutex code can not be written in standard conformant C. The mutex code must use asm statements to insert memory barriers as required (on the x86 a lock prefix serves as a memory barrier (except that some specific x86 processors have bugs, but I digress...)). And once you are using a mutex, there is no reason to use volatile. Using volatile will give you no extra protection, it will merely cost you some efficiency. Ian From aph@redhat.com Tue Mar 13 16:01:00 2007 From: aph@redhat.com (Andrew Haley) Date: Tue, 13 Mar 2007 16:01:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> Message-ID: <17910.51750.756198.304591@zebedee.pink> Ian Lance Taylor writes: > Andrew Haley writes: > > > Ian Lance Taylor writes: > > > > Note that this is also somewhat dubious on a strict reading of the C > > > standard. The standard discusss access to volatile qualified objects, > > > and it says that casting away volatile is undefined. The standard > > > says absolutely nothing about volatile qualified pointers to > > > non-volatile objects. So you should not expect any particular > > > semantics from a volatile-qualified pointer which points to a > > > non-volatile-qualified object. > > > > Mmmm, but let's say you want a dynamic shared buffer between threads. > > How else would you do it, other than a malloc() and a cast? > > volatile won't help you there anyhow. If you follow the standard, > there is exactly one thing you can reliably do with volatile: use it > to access a memory mapped device register. > > volatile doesn't help when sharing a memory buffer between threads > because volatile carries no implication of a read/write memory > barrier. If you are on a multi-core SMP system, and the threads are > running on different cores, and you don't use any explicit memory > fence machine instructions, then the processors are completely free to > rearrange the memory accesses with respect to each other. That is, > each processor will provide a consistent view of memory within the > processor, but the two processors will not provide consistent views of > memory with respect to each other. This happens in practice, not just > in theory, because each processor has its own local cache. > > That means that the only correct way to share a memory buffer between > threads is to use a mutex, and it means that the mutex code can not be > written in standard conformant C. The mutex code must use asm > statements to insert memory barriers as required (on the x86 a lock > prefix serves as a memory barrier (except that some specific x86 > processors have bugs, but I digress...)). > > And once you are using a mutex, there is no reason to use volatile. > Using volatile will give you no extra protection, it will merely cost > you some efficiency. I didn't mean to suggest that volatile would necessarily be sufficient, but that it would be necessary. Surely the compiler needs to know that the buffer is volatile, or what's to stop it re-ordering accesses around the asm statements that are the memory barriers? I know that in gcc we add a memory clobber to such asms, but that isn't generally true. OK, if we have POSIX threads we also have POSIX mutexes... I suppse we have to ask the OP why he's using volatile. Andrew. From kpfleming@starnetworks.us Tue Mar 13 16:02:00 2007 From: kpfleming@starnetworks.us (Kevin P. Fleming) Date: Tue, 13 Mar 2007 16:02:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> Message-ID: <45F6CAB2.1050008@starnetworks.us> Ian Lance Taylor wrote: > That means that the only correct way to share a memory buffer between > threads is to use a mutex, and it means that the mutex code can not be > written in standard conformant C. The mutex code must use asm > statements to insert memory barriers as required (on the x86 a lock > prefix serves as a memory barrier (except that some specific x86 > processors have bugs, but I digress...)). This comment makes me curious, since I see (and work on) plenty of code that shares data structures between threads using only a mutex for protection and no memory barrier instructions of any kind. This code is using standard POSIX threading constructs and seems to work fine on multi-CPU and multi-core systems, both x86 and other flavors. Are you referring to a specific sort of memory sharing between threads here, or are you saying that you think that _all_ objects shared between threads need to be protected in this way? From iant@google.com Tue Mar 13 16:06:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Tue, 13 Mar 2007 16:06:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <17910.51750.756198.304591@zebedee.pink> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <17910.51750.756198.304591@zebedee.pink> Message-ID: Andrew Haley writes: > I didn't mean to suggest that volatile would necessarily be > sufficient, but that it would be necessary. Surely the compiler needs > to know that the buffer is volatile, or what's to stop it re-ordering > accesses around the asm statements that are the memory barriers? I > know that in gcc we add a memory clobber to such asms, but that isn't > generally true. OK, if we have POSIX threads we also have POSIX > mutexes... Right: you have to use a mutex for correctness, and the mutex has to be magic. And once you use a magic mutex, using volatile doesn't make any difference. Ian From iant@google.com Tue Mar 13 16:09:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Tue, 13 Mar 2007 16:09:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <45F6CAB2.1050008@starnetworks.us> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> Message-ID: "Kevin P. Fleming" writes: > Ian Lance Taylor wrote: > > That means that the only correct way to share a memory buffer between > > threads is to use a mutex, and it means that the mutex code can not be > > written in standard conformant C. The mutex code must use asm > > statements to insert memory barriers as required (on the x86 a lock > > prefix serves as a memory barrier (except that some specific x86 > > processors have bugs, but I digress...)). > > This comment makes me curious, since I see (and work on) plenty of code > that shares data structures between threads using only a mutex for > protection and no memory barrier instructions of any kind. This code is > using standard POSIX threading constructs and seems to work fine on > multi-CPU and multi-core systems, both x86 and other flavors. The mutex code itself, assuming it is written correctly, provides the required memory barriers. > Are you referring to a specific sort of memory sharing between threads > here, or are you saying that you think that _all_ objects shared between > threads need to be protected in this way? All objects shared between threads need to protected by a mutex, or by some other type of memory barrier. Ian From aph@redhat.com Tue Mar 13 16:13:00 2007 From: aph@redhat.com (Andrew Haley) Date: Tue, 13 Mar 2007 16:13:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> Message-ID: <17910.52394.276700.319625@zebedee.pink> Ian Lance Taylor writes: > > All objects shared between threads need to protected by a mutex, or by > some other type of memory barrier. It's an interesting contention -- that in GNU/Linux userspace there are essentially no legitimate uses for volatile. Hmmmm... Andrew. From noel.yap@gmail.com Tue Mar 13 16:23:00 2007 From: noel.yap@gmail.com (Noel Yap) Date: Tue, 13 Mar 2007 16:23:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <17910.52394.276700.319625@zebedee.pink> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> Message-ID: <70d0a1130703130913y490dff72x2434dde69203cfb9@mail.gmail.com> IIRC, volatile is used when the memory is outside of the program's control (eg written to by external hardware). Noel On 3/13/07, Andrew Haley wrote: > Ian Lance Taylor writes: > > > > All objects shared between threads need to protected by a mutex, or by > > some other type of memory barrier. > > It's an interesting contention -- that in GNU/Linux userspace there > are essentially no legitimate uses for volatile. Hmmmm... > > Andrew. > From iant@google.com Tue Mar 13 16:25:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Tue, 13 Mar 2007 16:25:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <17910.52394.276700.319625@zebedee.pink> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> Message-ID: Andrew Haley writes: > Ian Lance Taylor writes: > > > > All objects shared between threads need to protected by a mutex, or by > > some other type of memory barrier. > > It's an interesting contention -- that in GNU/Linux userspace there > are essentially no legitimate uses for volatile. Hmmmm... There is one legitimate use: the C standard blesses the specific case of "volatile sig_atomic_t". A signal handler can reliably access a variable of that type. I don't think there is any other reason to use volatile in userspace. It simply does not mean what it seems to mean. Ian From kpfleming@starnetworks.us Tue Mar 13 16:33:00 2007 From: kpfleming@starnetworks.us (Kevin P. Fleming) Date: Tue, 13 Mar 2007 16:33:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> Message-ID: <45F6D063.4090506@starnetworks.us> Ian Lance Taylor wrote: > The mutex code itself, assuming it is written correctly, provides the > required memory barriers. OK, that's what I hoped you would say :-) Thanks for the clarification. From iant@google.com Tue Mar 13 16:52:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Tue, 13 Mar 2007 16:52:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <70d0a1130703130913y490dff72x2434dde69203cfb9@mail.gmail.com> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> <70d0a1130703130913y490dff72x2434dde69203cfb9@mail.gmail.com> Message-ID: "Noel Yap" writes: > IIRC, volatile is used when the memory is outside of the program's > control (eg written to by external hardware). Yes--which can not happen in GNU/Linux userspace. Ian From eager@eagercon.com Tue Mar 13 16:54:00 2007 From: eager@eagercon.com (Michael Eager) Date: Tue, 13 Mar 2007 16:54:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <17910.52394.276700.319625@zebedee.pink> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> Message-ID: <45F6D6A6.2000300@eagercon.com> Andrew Haley wrote: > Ian Lance Taylor writes: > > > > All objects shared between threads need to protected by a mutex, or by > > some other type of memory barrier. > > It's an interesting contention -- that in GNU/Linux userspace there > are essentially no legitimate uses for volatile. Hmmmm... I think that is an over-generalization. There are uses for volatile in user code, but they are limited. Volatile is needed in the code which implements a mutex. Volatile is needed when accessing a machine register, or an OS variable (e.g., system time, errno) so that the latest value is fetched or set, rather than being optimized away. It can also be used to share data between threads, but it becomes problematic if accesses are not atomic. It's reasonable to use a shared volatile sig_atomic_t to communicate between threads, to say "I'm done" or "Start processing". Non-atomic operations may pick up data which is inconsistent. Using a volatile pointer to a shared memory guarantees that each read/write of the buffer will be generated, even when it appears to the compiler that there are redundant accesses. But, and I think this is Ian's point, unless access to this shared buffer is protected by a mutex, the data may be garbled. -- Michael Eager eager@eagercon.com 1960 Park Blvd., Palo Alto, CA 94306 650-325-8077 From aph@redhat.com Tue Mar 13 16:58:00 2007 From: aph@redhat.com (Andrew Haley) Date: Tue, 13 Mar 2007 16:58:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> Message-ID: <17910.55089.390780.927653@zebedee.pink> Ian Lance Taylor writes: > Andrew Haley writes: > > > Ian Lance Taylor writes: > > > > > > All objects shared between threads need to protected by a mutex, or by > > > some other type of memory barrier. > > > > It's an interesting contention -- that in GNU/Linux userspace there > > are essentially no legitimate uses for volatile. Hmmmm... > > There is one legitimate use: the C standard blesses the specific case > of "volatile sig_atomic_t". A signal handler can reliably access a > variable of that type. > > I don't think there is any other reason to use volatile in userspace. I just thought of another one -- auto variables that are local to a function that contains the invocation of a setjmp macro. Andrew. From aph@redhat.com Tue Mar 13 17:32:00 2007 From: aph@redhat.com (Andrew Haley) Date: Tue, 13 Mar 2007 17:32:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <45F6D6A6.2000300@eagercon.com> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> <45F6D6A6.2000300@eagercon.com> Message-ID: <17910.55346.39652.519778@zebedee.pink> Michael Eager writes: > Andrew Haley wrote: > > Ian Lance Taylor writes: > > > > > > All objects shared between threads need to protected by a mutex, or by > > > some other type of memory barrier. > > > > It's an interesting contention -- that in GNU/Linux userspace there > > are essentially no legitimate uses for volatile. Hmmmm... > > I think that is an over-generalization. > > There are uses for volatile in user code, but they are limited. > Volatile is needed in the code which implements a mutex. I think that falls into Ian's category of "magic". > Volatile is needed when accessing a machine register, or an OS > variable (e.g., system time, errno) so that the latest value is > fetched or set, rather than being optimized away. > > It can also be used to share data between threads, but it becomes > problematic if accesses are not atomic. It's reasonable to use a > shared volatile sig_atomic_t to communicate between threads, to say > "I'm done" or "Start processing". Is that really safe, though? There's nothing to stop the machine from reordering memory writes, even if the compiler doesn't. Andrew. From osv@javad.com Tue Mar 13 19:29:00 2007 From: osv@javad.com (Sergei Organov) Date: Tue, 13 Mar 2007 19:29:00 -0000 Subject: how to cast away 'volatile'? References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> Message-ID: Ian Lance Taylor writes: [...] > And once you are using a mutex, there is no reason to use volatile. > Using volatile will give you no extra protection, it will merely cost > you some efficiency. Yes, that's how it is intended to work. However practice may vary. Some time ago there was an interesting example posted in a newsgroup[1]. The initial program was: for (...) { if (...) pthread_mutex_lock(...); x = ... x ... if (...) pthread_mutex_unlock(...); } and compiler did the following transformation that breaks thread-safety ('r' is register): r = x; for (...) { if (...) { x = r; pthread_mutex_lock(...); r = x; } r = ... r ... if (...) { x = r; pthread_mutex_unlock(...); r = x; } } x = r; This transformation seems to be OK both from the C language POV and from pthread standard POV (though the latter obviously was not intentional), but it creates accesses to 'x' outside of the mutex-protected section that in turn breaks thread-safety. Making 'x' volatile would prevent such an optimization in practice, isn't it? [1] See for details. -- Sergei. From mw_triad@users.sourceforge.net Tue Mar 13 19:30:00 2007 From: mw_triad@users.sourceforge.net (Matthew Woehlke) Date: Tue, 13 Mar 2007 19:30:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <17910.55346.39652.519778@zebedee.pink> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> <45F6D6A6.2000300@eagercon.com> <17910.55346.39652.519778@zebedee.pink> Message-ID: Andrew Haley wrote: > Michael Eager writes: >> It can also be used to share data between threads, but it becomes >> problematic if accesses are not atomic. It's reasonable to use a >> shared volatile sig_atomic_t to communicate between threads, to say >> "I'm done" or "Start processing". > > Is that really safe, though? There's nothing to stop the machine from > reordering memory writes, even if the compiler doesn't. ...my understanding is that is exactly what 'fence' is for. (Although I have yet to meet a processor that doesn't SIGILL when I try to use it :-). So I stick with e.g. 'lock or 0,%sp'...) -- Matthew HIPPOS feel unacknowledged. HIPPOS get angry. > PRAISE HIPPOS HIPPOS seem somewhat placated. From mw_triad@users.sourceforge.net Tue Mar 13 19:50:00 2007 From: mw_triad@users.sourceforge.net (Matthew Woehlke) Date: Tue, 13 Mar 2007 19:50:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <17910.51750.756198.304591@zebedee.pink> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <17910.51750.756198.304591@zebedee.pink> Message-ID: Andrew Haley wrote: > I suppse we have to ask the OP why he's using volatile. Ok, I guess I should answer that. It's part of a typedef that is essentially 'typedef volatile long atom_t', i.e. the type that is passed to atomicAdd, atomicSwap, etc functions (which are of course written with inline assembler using 'lock' - the memory barriers are handled). Also because atomicRead is a no-op to simply read the value, since this is safe. So I'm expecting 'volatile' to a: discourage compilers from doing stupid reordering to the code, like say putting the read before a call to atomicXyz, and b: force a re-read from memory (in case some other thread is changing the value) rather than using a cached value. Now I'm wondering if maybe I should just drop the volatile, but I'm not sure I trust doing that...? Michael Eager's post makes it sound like I am in exactly the few cases where use of 'volatile' is appropriate. Oh, and did I mention I'm actually implementing lightweight mutexes? :-) I can't use pthread mutexes; this code is supposed to build on Windows and Solaris also (Solaris has pthread mutexes but not the FAST/ADAPTIVE type AFAIK). -- Matthew HIPPOS feel unacknowledged. HIPPOS get angry. > PRAISE HIPPOS HIPPOS seem somewhat placated. From eager@eagercon.com Tue Mar 13 20:41:00 2007 From: eager@eagercon.com (Michael Eager) Date: Tue, 13 Mar 2007 20:41:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <17910.55346.39652.519778@zebedee.pink> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> <45F6D6A6.2000300@eagercon.com> <17910.55346.39652.519778@zebedee.pink> Message-ID: <45F70096.3020504@eagercon.com> Andrew Haley wrote: > Michael Eager writes: > > It can also be used to share data between threads, but it becomes > > problematic if accesses are not atomic. It's reasonable to use a > > shared volatile sig_atomic_t to communicate between threads, to say > > "I'm done" or "Start processing". > > Is that really safe, though? There's nothing to stop the machine from > reordering memory writes, even if the compiler doesn't. Yes, it's safe. It doesn't matter which microsecond that the flag is set. (Or if it does, then your code should be using a mutex or some other form of synchronization.) Say you have one thread which performs some process when it sees a shared flag set. It checks this flag every second. If another process sets this flag, the service thread will notice and take action. If the signaling process and the receiving process both try to access the shared memory at the same time, the processor may reorder the operations as it chooses. The worst case is that the server will check and see that the flag is not set, then the signaling process will set the flag. The result is a short delay in the receiving process noticing that the flag is set. Note that there is a race condition which is problematic. If the receiving process clears the flag, at the same time that the signaling process sets it, then these may be reordered. So you need to insure that only one of the processes ever writes to the flag. -- Michael Eager eager@eagercon.com 1960 Park Blvd., Palo Alto, CA 94306 650-325-8077 From aph@redhat.com Tue Mar 13 20:41:00 2007 From: aph@redhat.com (Andrew Haley) Date: Tue, 13 Mar 2007 20:41:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> <45F6D6A6.2000300@eagercon.com> <17910.55346.39652.519778@zebedee.pink> Message-ID: <17911.3175.828023.748009@zebedee.pink> Matthew Woehlke writes: > Andrew Haley wrote: > > Michael Eager writes: > >> It can also be used to share data between threads, but it becomes > >> problematic if accesses are not atomic. It's reasonable to use a > >> shared volatile sig_atomic_t to communicate between threads, to say > >> "I'm done" or "Start processing". > > > > Is that really safe, though? There's nothing to stop the machine from > > reordering memory writes, even if the compiler doesn't. > > ...my understanding is that is exactly what 'fence' is for. That's my understanding too. Here, we're really talking about non-x86 processors which have much weaker ordering guarantees. Andrew. From david@carter-hitchin.clara.co.uk Tue Mar 13 20:44:00 2007 From: david@carter-hitchin.clara.co.uk (DCH) Date: Tue, 13 Mar 2007 20:44:00 -0000 Subject: -fdump-tree-all documentation. In-Reply-To: <17910.26477.347058.814071@zebedee.pink> References: <3B4C77997DD0254B86D3C9454476B6BC0F03EC1D@lonms00812.fm.rbsgrp.net> <200703122349.l2CNnjOg000953@mx1.redhat.com> <17910.26477.347058.814071@zebedee.pink> Message-ID: Hi Andrew et alumni, At 08:57 13/03/2007, Andrew Haley wrote: >DCH writes: > > > Forgive me if I've missed something obvious, but does anyone > > know if the output from -fdump-tree-all is documented somewhere? > >It's C, more or less, except for a few additions such as Phi nodes. I guess that means no :-) Looks nothing like C to me, but there again I'm used to looking a normal type C, not some kind of parsed C. >Which part are you having difficulty with? Well, most of it really. Basically someone posted this to ACCU-general a while ago: ==================================================== struct no_default_ctor { no_default_ctor(int i) : m_i(i) { }; ~no_default_ctor() { }; private: no_default_ctor(); const int m_i; }; // Why is `no_default_ctor(Anint)' below a syntax error? const int Anint = 3; int foo() { no_default_ctor name(Anint); // This works. no_default_ctor(Anint); // This gives me a syntax error. no_default_ctor(3); // But this does not. (no_default_ctor)(Anint); // And neither does this. } ==================================================== It provoked some discussion, the outcome of that was rather unclear. I thought at least I could pass it into GCC to see how no_default_ctor(Anint) is parsed and got the following output. I think I decided at the time that it was being interpreted as a function-style cast, but then I wasn't sure, and now I can't even see that for some reason. There was some discussion if it was a cast or a declaration. There are a couple of references in the output below to line 13 but I don't know the syntax here to unwind it. ;; Function int foo() (_Z3foov) ;; enabled by -fdump-tree-original @1 function_decl name: @2 mngl: @3 type: @4 srcp: ctors_orig.cpp:12 extern body: @5 @2 identifier_node strg: foo lngt: 3 @3 identifier_node strg: _Z3foov lngt: 7 @4 function_type size: @6 algn: 64 retn: @7 prms: @8 @5 compound_stmt line: 17 body: @9 @6 integer_cst type: @10 low : 64 @7 integer_type name: @11 size: @12 algn: 32 prec: 32 min : @13 max : @14 @8 tree_list valu: @15 @9 scope_stmt line: 12 begn clnp next: @16 @10 integer_type name: @17 size: @6 algn: 64 prec: 36 unsigned min : @18 max : @19 @11 type_decl name: @20 type: @7 srcp: :0 artificial @12 integer_cst type: @10 low : 32 @13 integer_cst type: @7 high: -1 low : -2147483648 @14 integer_cst type: @7 low : 2147483647 @15 void_type name: @21 algn: 8 @16 compound_stmt line: 12 body: @22 next: @23 @17 identifier_node strg: bit_size_type lngt: 13 @18 integer_cst type: @10 low : 0 @19 integer_cst type: @10 low : -1 @20 identifier_node strg: int lngt: 3 @21 type_decl name: @24 type: @15 srcp: :0 artificial @22 scope_stmt line: 12 begn clnp next: @25 @23 scope_stmt line: 17 end clnp @24 identifier_node strg: void lngt: 4 @25 decl_stmt line: 13 decl: @26 next: @27 @26 var_decl name: @28 type: @29 scpe: @1 srcp: ctors_orig.cpp:13 size: @30 algn: 32 used: 1 @27 expr_stmt line: 13 expr: @31 next: @32 @28 identifier_node strg: name lngt: 4 @29 record_type name: @33 size: @30 algn: 32 struct flds: @34 fncs: @35 binf: @36 @30 integer_cst type: @10 low : 32 @31 stmt_expr type: @15 stmt: @37 @32 cleanup_stmt line: 13 decl: @26 expr: @38 next: @39 @33 type_decl name: @40 type: @29 srcp: ctors_orig.cpp:1 artificial @34 field_decl name: @41 type: @42 scpe: @29 srcp: ctors_orig.cpp:6 private size: @43 algn: 32 bpos: @44 @35 function_decl name: @40 type: @45 scpe: @29 srcp: ctors_orig.cpp:2 member public constructor args: @46 extern @36 binfo type: @29 bases: 0 @37 compound_stmt line: 13 body: @47 @38 call_expr type: @15 fn : @48 args: @49 @39 decl_stmt line: 14 decl: @50 next: @51 @40 identifier_node strg: no_default_ctor lngt: 15 @41 identifier_node strg: m_i lngt: 3 @42 integer_type qual: c name: @11 unql: @7 size: @52 algn: 32 prec: 32 min : @53 max : @54 @43 integer_cst type: @10 low : 32 @44 integer_cst type: @10 low : 0 @45 method_type size: @6 algn: 64 clas: @29 retn: @15 prms: @55 @46 parm_decl name: @56 type: @57 scpe: @35 srcp: ctors_orig.cpp:2 artificial argt: @57 size: @58 algn: 32 used: 0 @47 expr_stmt line: 13 expr: @59 @48 addr_expr type: @60 op 0: @61 @49 tree_list valu: @62 @50 var_decl name: @63 type: @29 scpe: @1 srcp: ctors_orig.cpp:14 size: @30 algn: 32 used: 1 @51 expr_stmt line: 14 expr: @64 next: @65 @52 integer_cst type: @10 low : 32 @53 integer_cst type: @7 high: -1 low : -2147483648 @54 integer_cst type: @7 low : 2147483647 @55 tree_list valu: @66 chan: @67 @56 identifier_node strg: this lngt: 4 @57 pointer_type qual: c unql: @66 size: @68 algn: 32 ptd : @29 @58 integer_cst type: @10 low : 32 @59 call_expr type: @15 fn : @69 args: @70 @60 pointer_type size: @58 algn: 32 ptd : @71 @61 function_decl name: @72 mngl: @73 type: @71 scpe: @29 srcp: ctors_orig.cpp:3 member public destructor args: @74 extern @62 nop_expr type: @66 op 0: @75 @63 identifier_node strg: Anint lngt: 5 @64 stmt_expr type: @15 stmt: @76 @65 cleanup_stmt line: 14 decl: @50 expr: @77 next: @78 @66 pointer_type size: @58 algn: 32 ptd : @29 @67 tree_list valu: @7 chan: @8 @68 integer_cst type: @10 low : 32 @69 addr_expr type: @79 op 0: @80 @70 tree_list valu: @81 chan: @82 @71 method_type size: @6 algn: 64 clas: @29 retn: @15 prms: @83 @72 identifier_node strg: __comp_dtor lngt: 11 @73 identifier_node strg: _ZN15no_default_ctorD1Ev lngt: 24 @74 parm_decl name: @56 type: @57 scpe: @61 srcp: ctors_orig.cpp:3 artificial argt: @57 size: @58 algn: 32 used: 0 @75 nop_expr type: @66 op 0: @84 @76 compound_stmt line: 14 body: @85 @77 call_expr type: @15 fn : @86 args: @87 @78 expr_stmt line: 15 expr: @88 next: @89 @79 pointer_type size: @58 algn: 32 ptd : @45 @80 function_decl name: @90 mngl: @91 type: @45 scpe: @29 srcp: ctors_orig.cpp:2 member public constructor args: @92 extern @81 addr_expr type: @66 op 0: @26 @82 tree_list valu: @93 @83 tree_list valu: @66 chan: @8 @84 addr_expr type: @66 op 0: @26 @85 expr_stmt line: 14 expr: @94 @86 addr_expr type: @60 op 0: @61 @87 tree_list valu: @95 @88 convert_expr type: @15 op 0: @96 @89 expr_stmt line: 16 expr: @97 next: @98 @90 identifier_node strg: __comp_ctor lngt: 11 @91 identifier_node strg: _ZN15no_default_ctorC1Ei lngt: 24 @92 parm_decl name: @56 type: @57 scpe: @80 srcp: ctors_orig.cpp:2 artificial argt: @57 size: @58 algn: 32 used: 0 @93 integer_cst type: @7 low : 3 @94 call_expr type: @15 fn : @99 args: @100 @95 nop_expr type: @66 op 0: @101 @96 target_expr type: @29 decl: @102 init: @103 clnp: @104 @97 convert_expr type: @15 op 0: @105 @98 scope_stmt line: 17 end clnp @99 addr_expr type: @60 op 0: @106 @100 tree_list valu: @107 @101 nop_expr type: @66 op 0: @108 @102 var_decl type: @29 scpe: @1 srcp: ctors_orig.cpp:15 artificial size: @30 algn: 32 used: 0 @103 compound_expr type: @29 op 0: @109 op 1: @102 @104 call_expr type: @15 fn : @110 args: @111 @105 target_expr type: @29 decl: @112 init: @50 clnp: @113 @106 function_decl name: @90 mngl: @114 type: @71 scpe: @29 srcp: ctors_orig.cpp:5 member private constructor args: @115 undefined extern @107 addr_expr type: @66 op 0: @50 @108 addr_expr type: @66 op 0: @50 @109 call_expr type: @15 fn : @116 args: @117 @110 addr_expr type: @60 op 0: @61 @111 tree_list valu: @118 @112 var_decl type: @29 scpe: @1 srcp: ctors_orig.cpp:16 artificial size: @30 algn: 32 used: 0 @113 call_expr type: @15 fn : @119 args: @120 @114 identifier_node strg: _ZN15no_default_ctorC1Ev lngt: 24 @115 parm_decl name: @56 type: @57 scpe: @106 srcp: ctors_orig.cpp:5 artificial argt: @57 size: @58 algn: 32 used: 0 @116 addr_expr type: @79 op 0: @80 @117 tree_list valu: @121 chan: @122 @118 nop_expr type: @66 op 0: @123 @119 addr_expr type: @60 op 0: @61 @120 tree_list valu: @124 @121 addr_expr type: @66 op 0: @102 @122 tree_list valu: @125 @123 nop_expr type: @66 op 0: @126 @124 nop_expr type: @66 op 0: @127 @125 integer_cst type: @7 low : 3 @126 addr_expr type: @66 op 0: @102 @127 nop_expr type: @66 op 0: @128 @128 addr_expr type: @66 op 0: @112 Is this clear to anyone? Is there a doc somewhere which tells me how to read this output? Many thank-yous, David From mw_triad@users.sourceforge.net Tue Mar 13 20:51:00 2007 From: mw_triad@users.sourceforge.net (Matthew Woehlke) Date: Tue, 13 Mar 2007 20:51:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <17911.3175.828023.748009@zebedee.pink> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> <45F6D6A6.2000300@eagercon.com> <17910.55346.39652.519778@zebedee.pink> <17911.3175.828023.748009@zebedee.pink> Message-ID: Andrew Haley wrote: > Matthew Woehlke writes: > > Andrew Haley wrote: > > > Michael Eager writes: > > >> It can also be used to share data between threads, but it becomes > > >> problematic if accesses are not atomic. It's reasonable to use a > > >> shared volatile sig_atomic_t to communicate between threads, to say > > >> "I'm done" or "Start processing". > > > > > > Is that really safe, though? There's nothing to stop the machine from > > > reordering memory writes, even if the compiler doesn't. > > > > ...my understanding is that is exactly what 'fence' is for. > > That's my understanding too. Here, we're really talking about non-x86 > processors which have much weaker ordering guarantees. On non-x86 processors I actually resort to pthread mutexes :-) (at least until/unless I have inline assembly implementations for those...) So far no one has successfully answered my original question; how do I suppress these dang warnings? :-) -- Matthew HIPPOS feel unacknowledged. HIPPOS get angry. > PRAISE HIPPOS HIPPOS seem somewhat placated. From mw_triad@users.sourceforge.net Tue Mar 13 21:33:00 2007 From: mw_triad@users.sourceforge.net (Matthew Woehlke) Date: Tue, 13 Mar 2007 21:33:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: Message-ID: Matthew Woehlke wrote: > I have a code snippet that looks roughly like this: > > extern void my_free(void* ptr); > > int foo() > { > volatile long * bar; > ... > my_free(bar); > } > > This generates the warning 'cast discards qualifiers from pointer target > type' at my_free() (gcc 3.4.3). Other than disabling the flag that > generates the warning (in general I want these warnings!), how do I > suppress this? my_free is of course a free() wrapper, i.e. I don't see > any problems discarding the qualifier at this point. I already tried > this, which seems like it used to work (I am moving the code from one > project to another): > > my_free((void*)bar); > > ...and it doesn't help. Hmm, maybe the problem is -Wcast-qual... does that cover both implicit *and* explicit casts, or just explicit ones? Is there a way (like, I guess, const_cast in C++) to selectively disable a -Wcast-qual warning? -- Matthew HIPPOS feel unacknowledged. HIPPOS get angry. > PRAISE HIPPOS HIPPOS seem somewhat placated. From crowl@google.com Tue Mar 13 21:56:00 2007 From: crowl@google.com (Lawrence Crowl) Date: Tue, 13 Mar 2007 21:56:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> Message-ID: <29bd08b70703131432v57a9cff6qf628ba4834d1c538@mail.gmail.com> On 13 Mar 2007 08:50:25 -0700, Ian Lance Taylor wrote: > volatile doesn't help when sharing a memory buffer between threads > because volatile carries no implication of a read/write memory > barrier. The C++ standards committee has adopted the same view; existing volatile semantics will remain unchanged and there will be separate semantics for communicating between threads. The C standards committee is only now beginning to address these issues, and so (to my knowledge) has not yet formed an opinion. In the meantime, there is POSIX. -- Lawrence Crowl From iant@google.com Wed Mar 14 01:12:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Wed, 14 Mar 2007 01:12:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <45F70096.3020504@eagercon.com> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> <45F6D6A6.2000300@eagercon.com> <17910.55346.39652.519778@zebedee.pink> <45F70096.3020504@eagercon.com> Message-ID: Michael Eager writes: > > There's nothing to stop the machine from > > reordering memory writes, even if the compiler doesn't. > > Yes, it's safe. It doesn't matter which microsecond that the flag is set. > (Or if it does, then your code should be using a mutex or some other > form of synchronization.) > > Say you have one thread which performs some process when it sees > a shared flag set. It checks this flag every second. If another > process sets this flag, the service thread will notice and take action. > > If the signaling process and the receiving process both try to > access the shared memory at the same time, the processor may > reorder the operations as it chooses. The worst case is that > the server will check and see that the flag is not set, then > the signaling process will set the flag. The result is a short > delay in the receiving process noticing that the flag is set. > > Note that there is a race condition which is problematic. If the > receiving process clears the flag, at the same time that the > signaling process sets it, then these may be reordered. So you > need to insure that only one of the processes ever writes to the > flag. I think that will be OK in practice provided the only memory shared between the two processes is the signalling flag itself. Ian From iant@google.com Wed Mar 14 04:20:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Wed, 14 Mar 2007 04:20:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> Message-ID: Sergei Organov writes: > Ian Lance Taylor writes: > [...] > > And once you are using a mutex, there is no reason to use volatile. > > Using volatile will give you no extra protection, it will merely cost > > you some efficiency. > > Yes, that's how it is intended to work. However practice may vary. Some > time ago there was an interesting example posted in a newsgroup[1]. > > The initial program was: > > for (...) { > if (...) pthread_mutex_lock(...); > x = ... x ... > if (...) pthread_mutex_unlock(...); > } > > and compiler did the following transformation that breaks thread-safety > ('r' is register): > > r = x; > for (...) { > if (...) { x = r; pthread_mutex_lock(...); r = x; } > r = ... r ... > if (...) { x = r; pthread_mutex_unlock(...); r = x; } > } > x = r; > > This transformation seems to be OK both from the C language POV and from > pthread standard POV (though the latter obviously was not intentional), > but it creates accesses to 'x' outside of the mutex-protected section > that in turn breaks thread-safety. > > Making 'x' volatile would prevent such an optimization in practice, > isn't it? That is an interesting example. The question is whether declaring x volatile would prevent the compiler from moving a load or store to x across the call to pthread_mutex_lock or pthread_mutex_unlock. I guess I agree that it would. x must have the correct value when the functions are called. The use of volatile would ensure that x can only be read and written once. So there is no way to move the load or store. Interesting. Thanks. Ian From olecom@flower.upol.cz Wed Mar 14 10:07:00 2007 From: olecom@flower.upol.cz (Oleg Verych) Date: Wed, 14 Mar 2007 10:07:00 -0000 Subject: how to cast away 'volatile'? References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <45F6D063.4090506@starnetworks.us> Message-ID: > From: "Kevin P. Fleming" > Newsgroups: gmane.comp.gcc.help > Subject: Re: how to cast away 'volatile'? > Date: Tue, 13 Mar 2007 11:25:07 -0500 > > Ian Lance Taylor wrote: >> The mutex code itself, assuming it is written correctly, provides the >> required memory barriers. > > OK, that's what I hoped you would say :-) Thanks for the clarification. > Maybe articles by Paul McKenney will be helpful on this topic, but they mainly a hardware/kernel thing: "Memory Ordering in Modern Microprocessors" ____ From aph@redhat.com Wed Mar 14 12:21:00 2007 From: aph@redhat.com (Andrew Haley) Date: Wed, 14 Mar 2007 12:21:00 -0000 Subject: -fdump-tree-all documentation. In-Reply-To: <200703132042.l2DKg4P5026776@mx1.redhat.com> References: <3B4C77997DD0254B86D3C9454476B6BC0F03EC1D@lonms00812.fm.rbsgrp.net> <200703122349.l2CNnjOg000953@mx1.redhat.com> <17910.26477.347058.814071@zebedee.pink> <200703132042.l2DKg4P5026776@mx1.redhat.com> Message-ID: <17911.51534.977035.359224@zebedee.pink> DCH writes: > Hi Andrew et alumni, > > At 08:57 13/03/2007, Andrew Haley wrote: > >DCH writes: > > > > > Forgive me if I've missed something obvious, but does anyone > > > know if the output from -fdump-tree-all is documented somewhere? > > > >It's C, more or less, except for a few additions such as Phi nodes. > > I guess that means no :-) Looks nothing like C to me, but there again > I'm used to looking a normal type C, not some kind of parsed C. Oh, you mean the front end dump. Most of the dumps look like this: () (D.779) { struct * #ref#1#2.24; { struct * D.782; void *[] * D.784; void * #ref#0#0; struct * D.786; void * #ref#1#2; ... etc. Only _one_ of the dumps looks like the one below, and that's the original translation unit. > Well, most of it really. Basically someone posted this to ACCU-general > a while ago: > > ==================================================== > struct no_default_ctor { > no_default_ctor(int i) : m_i(i) { }; > ~no_default_ctor() { }; > private: > no_default_ctor(); > const int m_i; > }; > > // Why is `no_default_ctor(Anint)' below a syntax error? > > const int Anint = 3; > int foo() { > no_default_ctor name(Anint); // This works. > no_default_ctor(Anint); // This gives me a syntax error. > no_default_ctor(3); // But this does not. > (no_default_ctor)(Anint); // And neither does this. > } > ==================================================== > > It provoked some discussion, the outcome of that was rather > unclear. I thought at least I could pass it into GCC to see how > no_default_ctor(Anint) is parsed and got the following output. I > think I decided at the time that it was being interpreted as a > function-style cast, but then I wasn't sure, and now I can't even > see that for some reason. There was some discussion if it was a > cast or a declaration. There are a couple of references in the > output below to line 13 but I don't know the syntax here to unwind > it. > > ;; Function int foo() (_Z3foov) > ;; enabled by -fdump-tree-original > > @1 function_decl name: @2 mngl: @3 type: @4 > srcp: ctors_orig.cpp:12 extern > body: @5 > @2 identifier_node strg: foo lngt: 3 > @3 identifier_node strg: _Z3foov lngt: 7 > @4 function_type size: @6 algn: 64 retn: @7 > prms: @8 > @5 compound_stmt line: 17 body: @9 > @6 integer_cst type: @10 low : 64 > @7 integer_type name: @11 size: @12 algn: 32 > prec: 32 min : @13 max : @14 > @8 tree_list valu: @15 > @9 scope_stmt line: 12 begn clnp > next: @16 > @10 integer_type name: @17 size: @6 algn: 64 > prec: 36 unsigned min : @18 > max : @19 Each one of these is a tree node, and links are replaced by numbers of the form @N. After that, it's just tree nodes. Most of the meaning of these nodes is documented in gcc/tree.def, but a few nodes are language-specific and are documented in the language front ends. > Is this clear to anyone? Is there a doc somewhere which tells me > how to read this output? Andrew. From aph@redhat.com Wed Mar 14 12:57:00 2007 From: aph@redhat.com (Andrew Haley) Date: Wed, 14 Mar 2007 12:57:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> <45F6D6A6.2000300@eagercon.com> <17910.55346.39652.519778@zebedee.pink> <17911.3175.828023.748009@zebedee.pink> Message-ID: <17911.59556.878450.4390@zebedee.pink> Matthew Woehlke writes: > Andrew Haley wrote: > > Matthew Woehlke writes: > > > Andrew Haley wrote: > > > > Michael Eager writes: > > > >> It can also be used to share data between threads, but it becomes > > > >> problematic if accesses are not atomic. It's reasonable to use a > > > >> shared volatile sig_atomic_t to communicate between threads, to say > > > >> "I'm done" or "Start processing". > > > > > > > > Is that really safe, though? There's nothing to stop the machine from > > > > reordering memory writes, even if the compiler doesn't. > > > > > > ...my understanding is that is exactly what 'fence' is for. > > > > That's my understanding too. Here, we're really talking about non-x86 > > processors which have much weaker ordering guarantees. > > On non-x86 processors I actually resort to pthread mutexes :-) (at least > until/unless I have inline assembly implementations for those...) > > So far no one has successfully answered my original question; how do I > suppress these dang warnings? :-) I did. Maybe you didn't see it, or maybe you didn't like the suggestion. Andrew. From rodrigo.benenson@inria.fr Wed Mar 14 14:22:00 2007 From: rodrigo.benenson@inria.fr (rodrigo benenson) Date: Wed, 14 Mar 2007 14:22:00 -0000 Subject: Template class heritance strange behaviour Message-ID: I have a question about the namespace management when heriting a templated class. Given the following code, why the member variable 'c' is managed differently than the member method 'set_c' ? Thanks for you explanations. rodrigob. http://www-rocq.inria.fr/~benenson/ The following code compiles. ////////////////////////////////////////// template class Parent { public: T1 c; void set_c(T1 &val) { c = val; } }; template class Child : Parent { T2 d; public: void set_d(T2 _d) { d = _d; //c = _d; // <<< this line generates error : 'c' was not declared in this scope this->c = _d; // this access work fine Parent::c = _d; // this access work fine too set_c(_d); // there is no problem in finding 'set_c' in the scope } }; int main(void) { Child the_child; the_child.set_d(5); return 0; } ////////////////////////////////////////// Command: g++ test.cpp -o test && ./test g++ --version g++ (GCC) 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) From eljay@adobe.com Wed Mar 14 14:43:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Wed, 14 Mar 2007 14:43:00 -0000 Subject: Template class heritance strange behaviour In-Reply-To: Message-ID: Hi rodrigob, > //c = _d; // <<< this line generates error : 'c' was not declared > in this scope Yep, that is an error. That line (if uncommented) is bad C++. > this->c = _d; // this access work fine Yep, that is correct. That's C++. > Parent::c = _d; // this access work fine too Yep, that is correct. That's C++, too. In Child, I think you can also use something like: using Parent::c; Google for "Koenig lookup" (two phase lookup) if you want details. Here's one URL: http://h21007.www2.hp.com/dspp/tech/tech_TechDocumentDetailPage_IDX/1,1701,9 90,00.html HTH, --Eljay From mw_triad@users.sourceforge.net Wed Mar 14 15:08:00 2007 From: mw_triad@users.sourceforge.net (Matthew Woehlke) Date: Wed, 14 Mar 2007 15:08:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <17911.59556.878450.4390@zebedee.pink> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> <45F6D6A6.2000300@eagercon.com> <17910.55346.39652.519778@zebedee.pink> <17911.3175.828023.748009@zebedee.pink> <17911.59556.878450.4390@zebedee.pink> Message-ID: Andrew Haley wrote: > Matthew Woehlke writes: >> So far no one has successfully answered my original question; how do I >> suppress these dang warnings? :-) > > I did. Maybe you didn't see it, or maybe you didn't like the > suggestion. "Didn't see it"? I just re-read your posts; the only thing I see that might be a suggestion is "don't use volatile". So if there was something else, I must apologize, because I'm not finding it. :-) Actually I realized the problem might be -Wcast-qual, does that cover implicit casts, explicit casts, or both? I probably added it to my old code because I didn't write most of it, and so don't trust it. :-) It may be that I have to live with it, and turn it off once I am satisfied that all the warnings it produces are innocuous? (Unless there is a way to tell gcc to make an exception?) -- Matthew "unsubscribe me plz!!" -- Newbies From aph@redhat.com Wed Mar 14 15:17:00 2007 From: aph@redhat.com (Andrew Haley) Date: Wed, 14 Mar 2007 15:17:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> <45F6D6A6.2000300@eagercon.com> <17910.55346.39652.519778@zebedee.pink> <17911.3175.828023.748009@zebedee.pink> <17911.59556.878450.4390@zebedee.pink> Message-ID: <17912.4054.948921.54599@zebedee.pink> Matthew Woehlke writes: > Andrew Haley wrote: > > Matthew Woehlke writes: > >> So far no one has successfully answered my original question; how do I > >> suppress these dang warnings? :-) > > > > I did. Maybe you didn't see it, or maybe you didn't like the > > suggestion. > > "Didn't see it"? I just re-read your posts; the only thing I see that > might be a suggestion is "don't use volatile". So if there was something > else, I must apologize, because I'm not finding it. :-) I suggested keeping a non-volatile pointer (to the alloc'd memory) and a volatile pointer to the same memory, and using whichever was appropriate. I still think that's a good idea. The warning from gcc *is* correct: you're casting away volatile. Sure, you might be able to find a way to shut up the warning, but is it not surely better to fix the code instead? Andrew. From Vladimir.Simonov@acronis.com Wed Mar 14 15:26:00 2007 From: Vladimir.Simonov@acronis.com (Vladimir Simonov) Date: Wed, 14 Mar 2007 15:26:00 -0000 Subject: gcc forgets to decrease esp after function call In-Reply-To: <17910.58546.897282.378139@zebedee.pink> References: <45F15674.9000701@acronis.com> <17905.22833.766154.45450@zebedee.pink> <45F1681A.6030307@acronis.com> <17905.28252.856544.931176@zebedee.pink> <45F180B3.50901@acronis.com> <17905.33869.537927.207102@zebedee.pink> <45F1A223.6060406@acronis.com> <17905.42424.400663.138838@zebedee.pink> <45F292DA.30804@acronis.com> <17908.16759.282405.262830@zebedee.pink> <45F653D5.8070500@acronis.com> <17910.32685.453760.827798@zebedee.pink> <45F6E269.1050201@acronis.com> <17910.58546.897282.378139@zebedee.pink> Message-ID: <45F80E6C.5090601@acronis.com> Andrew Haley wrote: > Vladimir Simonov writes: > > > > Andrew Haley wrote: > > > Unfortunately, this does not produce a test case. > > > > > > To be clear: if you want this bug to be addressed, oy must produce a > > > test case that someone can run. You must also provide the expected > > > output. > > > > Sorry for delay with answer. I union both your letters. > > > > Are you able to reproduce my results using > > gcc 4.1.2/4.1.1? > > I didn't look in deatil. Once I have a test case I will do so. > > > Do you agree with my analysis? > > > > Do you mean I must add "main", body of called > > function, script to build executable and show that > > it crashes instead of print "Hello word"? > > That will do. > > > > Well, yeah, but that would break lots of other people's prgrams too, > > > and we know that doesn't happen. So I want to know what is so special > > > about yours. > > > > If you take a look at source you'll see that it is quite complex > > templated code. > > We have lots of that too. > > > I think the difference is in its complexity. Say, gcc 4.0.2 can't > > compile our projects at all due to "internal compiler error'. > > Well, that's an easy test case too. But really, I wouldn't use gcc > 4.0.x. > > > And we made some efforts to make gcc 4.1.1 to compile the > > sources. Now it can compile without internal crash but produced > > code is incorrect :( > > Sure, but once I have a test case I can try a bunch of different > compilers. And then we can figure out why the error is occurring, > etc... > > Andrew. > Hi The attached test case can be built by compile.sh. It produces two binaries - test_bin_bad & test_bin_good. test_bin_good prints "Hello word" before exit. test_bin_bad crashes. The difference is the only -O2 used while test_bin_bad build. The symptoms are the same - incorrect esp usage in caller after call function returning object. We reproduced the bug in gcc 4.1.0/4.1.1/4.1.2 gcc 3.x can't compile the sources. Regards Vladimir -------------- next part -------------- A non-text attachment was scrubbed... Name: gcc_bug.tgz Type: application/x-gzip Size: 191273 bytes Desc: not available URL: From mw_triad@users.sourceforge.net Wed Mar 14 17:57:00 2007 From: mw_triad@users.sourceforge.net (Matthew Woehlke) Date: Wed, 14 Mar 2007 17:57:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <17912.4054.948921.54599@zebedee.pink> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> <45F6D6A6.2000300@eagercon.com> <17910.55346.39652.519778@zebedee.pink> <17911.3175.828023.748009@zebedee.pink> <17911.59556.878450.4390@zebedee.pink> <17912.4054.948921.54599@zebedee.pink> Message-ID: Andrew Haley wrote: > Matthew Woehlke writes: >> Andrew Haley wrote: >>> Matthew Woehlke writes: >>>> So far no one has successfully answered my original question; how do I >>>> suppress these dang warnings? :-) >>> >>> I did. Maybe you didn't see it, or maybe you didn't like the >>> suggestion. >> >> "Didn't see it"? I just re-read your posts; the only thing I see that >> might be a suggestion is "don't use volatile". So if there was something >> else, I must apologize, because I'm not finding it. :-) > > I suggested keeping a non-volatile pointer (to the alloc'd memory) and > a volatile pointer to the same memory, and using whichever was > appropriate. I still think that's a good idea. The warning from gcc > *is* correct: you're casting away volatile. Sure, you might be able > to find a way to shut up the warning, but is it not surely better to > fix the code instead? Hmm... the problem is that this is from an API, the code using the API would have to keep track of both. Conversely, since the type is meant to be opaque, callers don't need to know that it is volatile. So I can do sneaky things like this: typedef struct { volatile long a; } atom_t; ...whenever it is accesses, m->a is used, which is volatile. But the struct as a whole (which is not volatile) can be passed to free(). This way the caller is "tricked" into keeping both a volatile and non-volatile around at the same time. :-) See, it took someone to force me to think about a different approach to solve this... thanks! :-) (The 'keep both' part was the important part; your original suggestion wasn't worded quite the same. This way I'm not "casting as needed", which is the part of your original suggestion that made me nervous. The actual data is *always* volatile, but it is wrapped in something that gcc doesn't complain about when the container is passed to free().) -- Matthew "unsubscribe me plz!!" -- Newbies From olanglois@quazal.com Wed Mar 14 19:14:00 2007 From: olanglois@quazal.com (Olivier Langlois) Date: Wed, 14 Mar 2007 19:14:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> <45F6D6A6.2000300@eagercon.com> <17910.55346.39652.519778@zebedee.pink> <17911.3175.828023.748009@zebedee.pink> <17911.59556.878450.4390@zebedee.pink> <17912.4054.948921.54599@zebedee.pink> Message-ID: <400BDC416E2A0042AA35DF3919BB8A518DA21C@mail.mtl.proksim.com> Hi, I am finding this thread very interesting to follow but I am surprised that nobody mentioned const_cast<> as it is the official way to cast away the volatile specifier. Is this because the problem is in C? Greetings, Olivier Langlois http://www.olivierlanglois.net From mw_triad@users.sourceforge.net Wed Mar 14 23:54:00 2007 From: mw_triad@users.sourceforge.net (Matthew Woehlke) Date: Wed, 14 Mar 2007 23:54:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <400BDC416E2A0042AA35DF3919BB8A518DA21C@mail.mtl.proksim.com> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> <45F6D6A6.2000300@eagercon.com> <17910.55346.39652.519778@zebedee.pink> <17911.3175.828023.748009@zebedee.pink> <17911.59556.878450.4390@zebedee.pink> <17912.4054.948921.54599@zebedee.pink> <400BDC416E2A0042AA35DF3919BB8A518DA21C@mail.mtl.proksim.com> Message-ID: Olivier Langlois wrote: > I am finding this thread very interesting to follow So am I! It's fun to see what a lively (and informative!) discussion my simple question caused. :-) > but I am surprised > that nobody mentioned const_cast<> as it is the official way to cast > away the volatile specifier. Is this because the problem is in C? Since const_cast is not supported in C, and I am writing in C, that seems likely. :-) I think at some point I actually asked 'what is the C equivalent of const_cast<>' (but I'm not sure if I actually posted that or just thought it...). -- Matthew "unsubscribe me plz!!" -- Newbies From g.kubik@resco.com.pl Thu Mar 15 09:16:00 2007 From: g.kubik@resco.com.pl (Grzegorz !Kubik) Date: Thu, 15 Mar 2007 09:16:00 -0000 Subject: mixing C with AS - example needed Message-ID: <01d701c76694$0bf161b0$0300a8c0@ibm7a3o17v27i2> Hello, I am trying to combine part of software written in C with another part written in AS. Example is needed, how to: - call assembler procedure from C program, - define and use RAM buffer common for C and assembler programs. I am using WinAVR, my target controller is AT90USB1287. Thank you for any help, Regards, Greg Kubik From osv@javad.com Thu Mar 15 09:50:00 2007 From: osv@javad.com (Sergei Organov) Date: Thu, 15 Mar 2007 09:50:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: (Matthew Woehlke's message of "Tue, 13 Mar 2007 14:29:15 -0500") References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <17910.51750.756198.304591@zebedee.pink> Message-ID: <87y7ly3m0h.fsf@javad.com> Matthew Woehlke writes: > Ok, I guess I should answer that. It's part of a typedef that is > essentially 'typedef volatile long atom_t', i.e. the type that is > passed to atomicAdd, atomicSwap, etc functions (which are of course > written with inline assembler using 'lock' - the memory barriers are > handled). Also because atomicRead is a no-op to simply read the value, > since this is safe. So I'm expecting 'volatile' to a: discourage > compilers from doing stupid reordering to the code, like say putting > the read before a call to atomicXyz, and b: force a re-read from > memory (in case some other thread is changing the value) rather than > using a cached value. > > Now I'm wondering if maybe I should just drop the volatile, but I'm > not sure I trust doing that...? Michael Eager's post makes it sound > like I am in exactly the few cases where use of 'volatile' is > appropriate. I think you may consider to remove 'volatile' from your interfaces, and cast *to* 'volatile' whenever you need volatile access, e.g.: int foo(int *p) { int volatile *vp = p; *vp = 10; return *vp; } -- Sergei. From aph@redhat.com Thu Mar 15 11:32:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 15 Mar 2007 11:32:00 -0000 Subject: gcc forgets to decrease esp after function call In-Reply-To: <45F80E6C.5090601@acronis.com> References: <45F15674.9000701@acronis.com> <17905.22833.766154.45450@zebedee.pink> <45F1681A.6030307@acronis.com> <17905.28252.856544.931176@zebedee.pink> <45F180B3.50901@acronis.com> <17905.33869.537927.207102@zebedee.pink> <45F1A223.6060406@acronis.com> <17905.42424.400663.138838@zebedee.pink> <45F292DA.30804@acronis.com> <17908.16759.282405.262830@zebedee.pink> <45F653D5.8070500@acronis.com> <17910.32685.453760.827798@zebedee.pink> <45F6E269.1050201@acronis.com> <17910.58546.897282.378139@zebedee.pink> <45F80E6C.5090601@acronis.com> Message-ID: <17913.5853.465646.305627@zebedee.pink> Vladimir Simonov writes: > The attached test case can be built by compile.sh. > It produces two binaries - test_bin_bad & test_bin_good. > > test_bin_good prints "Hello word" before exit. > test_bin_bad crashes. > > The difference is the only -O2 used while test_bin_bad build. > > The symptoms are the same - incorrect esp usage in caller > after call function returning object. > > We reproduced the bug in gcc 4.1.0/4.1.1/4.1.2 > gcc 3.x can't compile the sources. OK, we're getting closer. Unfortunately, your test case includes a ton of system headers for one particular system/version of gcc, and it also includes a lot of library code not used in your test case. Fillet that, and you will have a test case that can be submitted. Andrew. From Vladimir.Simonov@acronis.com Thu Mar 15 11:37:00 2007 From: Vladimir.Simonov@acronis.com (Vladimir Simonov) Date: Thu, 15 Mar 2007 11:37:00 -0000 Subject: gcc forgets to decrease esp after function call In-Reply-To: <17913.5853.465646.305627@zebedee.pink> References: <45F15674.9000701@acronis.com> <17905.22833.766154.45450@zebedee.pink> <45F1681A.6030307@acronis.com> <17905.28252.856544.931176@zebedee.pink> <45F180B3.50901@acronis.com> <17905.33869.537927.207102@zebedee.pink> <45F1A223.6060406@acronis.com> <17905.42424.400663.138838@zebedee.pink> <45F292DA.30804@acronis.com> <17908.16759.282405.262830@zebedee.pink> <45F653D5.8070500@acronis.com> <17910.32685.453760.827798@zebedee.pink> <45F6E269.1050201@acronis.com> <17910.58546.897282.378139@zebedee.pink> <45F80E6C.5090601@acronis.com> <17913.5853.465646.305627@zebedee.pink> Message-ID: <45F92EC7.2000106@acronis.com> Andrew Haley wrote: > Vladimir Simonov writes: > > The attached test case can be built by compile.sh. > > It produces two binaries - test_bin_bad & test_bin_good. > > > > test_bin_good prints "Hello word" before exit. > > test_bin_bad crashes. > > > > The difference is the only -O2 used while test_bin_bad build. > > > > The symptoms are the same - incorrect esp usage in caller > > after call function returning object. > > > > We reproduced the bug in gcc 4.1.0/4.1.1/4.1.2 > > gcc 3.x can't compile the sources. > > OK, we're getting closer. Hi Are you capable to reproduce the bug? > Unfortunately, your test case includes a > ton of system headers for one particular system/version of gcc, But it doesn't contain any #include directive. It is self consistent. Do you mean that I should add "#include" for system headers? I think this way we may made the bug less obvious. > and it > also includes a lot of library code not used in your test case. I understood it from the start of discussion :) I hoped: 1. GCC delelopers have some tools or methods to automatically remove text which does not affect codegeneration. Or some compile stage which contans intermediate data without unused by codegeneration prototypes, classes, etc. 2. GCC developers are smart enough to localize and try to fix gcc having such obvious indication as this - codegenerator "forgets" that it called function returning object. Is it impossible to find thin place/places taking into account above, fix it and check by our test? In such a case the test size has no defference in my opinion. > Fillet that, and you will have a test case that can be submitted. > It requires a lot of mannual work - remove a peace of code, then check that the test can be built, the check that the bug did not disappear, etc. We'll try. Regards Vladimir From vlibrado@bioingenieria.es Thu Mar 15 11:38:00 2007 From: vlibrado@bioingenieria.es (Victor Librado) Date: Thu, 15 Mar 2007 11:38:00 -0000 Subject: arm 9260ej-s dsp functions AS problems Message-ID: <45F92FFB.4050408@bioingenieria.es> Hello all, I`m working with an ATMEL arm at91sam9260 (core 9260EJ-S) under Linux (Linux kernel 2.6.15; armv5l-linux toolchain). I want to implement a FFT function in C code and I would like to take advantage of the asm DSP like functions the core provides. Compiler don??t uses them (in the .S file generated), can it be configured (a directive include in the makefile, in the source...) the gcc to use these asm DSP functions automatically providing so a much efficient and better arm code? Another option I have tried is to write these pieces of code in assembler using these functions... but the assembler returns error (assembler function not known). I updated to gcc4.1.2 version and compile this way: arm-linux-gnu-gcc-4.1 -v -msoft-float -mcpu=arm926ej-s -S mul.c -o mul.o Version 4.1.2 accepts the arm core as option but function doesn't assemble... Any idea or configuration of the gcc to get it working efficiently and optimized for this arm core? Thanks in advance. Victor Librado Sancho Departamento I+D ------------------------------------------------------------------------ ------------------------------------------------------------------------ From aph@redhat.com Thu Mar 15 11:42:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 15 Mar 2007 11:42:00 -0000 Subject: gcc forgets to decrease esp after function call In-Reply-To: <45F92EC7.2000106@acronis.com> References: <45F15674.9000701@acronis.com> <17905.22833.766154.45450@zebedee.pink> <45F1681A.6030307@acronis.com> <17905.28252.856544.931176@zebedee.pink> <45F180B3.50901@acronis.com> <17905.33869.537927.207102@zebedee.pink> <45F1A223.6060406@acronis.com> <17905.42424.400663.138838@zebedee.pink> <45F292DA.30804@acronis.com> <17908.16759.282405.262830@zebedee.pink> <45F653D5.8070500@acronis.com> <17910.32685.453760.827798@zebedee.pink> <45F6E269.1050201@acronis.com> <17910.58546.897282.378139@zebedee.pink> <45F80E6C.5090601@acronis.com> <17913.5853.465646.305627@zebedee.pink> <45F92EC7.2000106@acronis.com> Message-ID: <17913.12323.646294.479431@zebedee.pink> Vladimir Simonov writes: > Andrew Haley wrote: > > Vladimir Simonov writes: > > > The attached test case can be built by compile.sh. > > > It produces two binaries - test_bin_bad & test_bin_good. > > > > > > test_bin_good prints "Hello word" before exit. > > > test_bin_bad crashes. > > > > > > The difference is the only -O2 used while test_bin_bad build. > > > > > > The symptoms are the same - incorrect esp usage in caller > > > after call function returning object. > > > > > > We reproduced the bug in gcc 4.1.0/4.1.1/4.1.2 > > > gcc 3.x can't compile the sources. > > > > OK, we're getting closer. > > Hi > > Are you capable to reproduce the bug? Yes. > > Unfortunately, your test case includes a > > ton of system headers for one particular system/version of gcc, > But it doesn't contain any #include directive. > It is self consistent. > > Do you mean that I should > add "#include" for system headers? Yes. Otherwise it's not possible to compile it with any other version of gcc than the one you built it on. A test case should be standalone and not depend on a particulat gcc version. > I think this way we may made the bug less obvious. > > and it > > also includes a lot of library code not used in your test case. > > I understood it from the start of discussion :) > I hoped: > 1. GCC delelopers have some tools or methods to automatically > remove text which does not affect codegeneration. Or some compile > stage which contans intermediate data without unused by > codegeneration prototypes, classes, etc. > 2. GCC developers are smart enough to localize and try to fix gcc > having such obvious indication as this - codegenerator "forgets" > that it called function returning object. Is it impossible to find > thin place/places taking into account above, fix it and check by > our test? It's up to you, really. The more self-contained a test case you provide, the more likely someone is to fix your problem. Remember that they are, in this case, volunteers, and not highly motivated to spend a lot of time to try to remove all the extraneous code. > In such a case the test size has no defference in my opinion. > > > > Fillet that, and you will have a test case that can be submitted. > > It requires a lot of mannual work - remove a peace of code, then > check that the test can be built, the check that the bug did not > disappear, etc. It's your code, so presumably you are familiar with it. I stepped though the code in gdb, and it seemed that not many routines were actually involved. Andrew. From ITZHACK@il.ibm.com Thu Mar 15 13:57:00 2007 From: ITZHACK@il.ibm.com (Itzhack Goldberg) Date: Thu, 15 Mar 2007 13:57:00 -0000 Subject: Error: expected expression before return Message-ID: The following program doesn't pass compliation: #include int izik() { ( 1 == 1 ) && return 0 || return 1 ; } int main() { int rtrn = izik(); } The error is: error: expected expression before 'return' Please advise. - Itzhack From dwilliss@microimages.com Thu Mar 15 16:17:00 2007 From: dwilliss@microimages.com (Dave Williss) Date: Thu, 15 Mar 2007 16:17:00 -0000 Subject: Error: expected expression before return In-Reply-To: References: Message-ID: <45F95132.4050902@microimages.com> Itzhack Goldberg wrote: > The following program doesn't pass compliation: > > #include > int izik() > { > ( 1 == 1 ) && return 0 || return 1 ; > } > int main() > { > int rtrn = izik(); > } > > > The error is: error: expected expression before 'return' > > int izik() { return ( 1 == 1) ? 0 : 1; } This is C, not Perl :-) Shalom From jteran@mcmtelecom.com.mx Thu Mar 15 16:23:00 2007 From: jteran@mcmtelecom.com.mx (Teran Jesus) Date: Thu, 15 Mar 2007 16:23:00 -0000 Subject: Problem with java Message-ID: <52F9F54F025401488996B9795D659D8E108907@mcmmx012.mcm.mexico> Hello, I am using the java for a provisioning system and when i execute my program i get the next error, i have the libgcj-3.4.6-3.1 version, if i put an older version libgcj-3.2.2-5, the error doesn't appears, do you know what do i need with the new version to my program runs? Exception in thread "main" java.lang.NoClassDefFoundError: while resolving class: com.broadsoft.clients.oci.OCIClient at java.lang.VMClassLoader.resolveClass(java.lang.Class) (/usr/lib/libgcj.so.5.0.0) at java.lang.Class.initializeClass() (/usr/lib/libgcj.so.5.0.0) at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (/usr/lib/libgcj.so.5.0.0) at java.lang.Class.forName(java.lang.String) (/usr/lib/libgcj.so.5.0.0) at gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.5.0.0) at _Jv_ThreadRun(java.lang.Thread) (/usr/lib/libgcj.so.5.0.0) at _Jv_RunMain(java.lang.Class, byte const, int, byte const, boolean) (/usr/lib/libgcj.so.5.0.0) at __gcj_personality_v0 (/var/www/html/symphony/java.version=1.4.2) at __libc_start_main (/lib/tls/libc-2.3.4.so) at _Jv_RegisterClasses (/var/www/html/symphony/java.version=1.4.2) Caused by: java.lang.ClassNotFoundException: java.lang.StringBuilder not found in [file:/var/www/html/symphony/asociclient/build/classes/, file:/usr/share/java/libgcj-3.4.6.jar, file:./, core:/] at java.net.URLClassLoader.findClass(java.lang.String) (/usr/lib/libgcj.so.5.0.0) at gnu.gcj.runtime.VMClassLoader.findClass(java.lang.String) (/usr/lib/libgcj.so.5.0.0) at java.lang.ClassLoader.loadClass(java.lang.String, boolean) (/usr/lib/libgcj.so.5.0.0) at _Jv_FindClass(_Jv_Utf8Const, java.lang.ClassLoader) (/usr/lib/libgcj.so.5.0.0) at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (/usr/lib/libgcj.so.5.0.0) at _Jv_BytecodeVerifier.verify_instructions_0() (/usr/lib/libgcj.so.5.0.0) at _Jv_VerifyMethod(_Jv_InterpMethod) (/usr/lib/libgcj.so.5.0.0) at _Jv_PrepareClass(java.lang.Class) (/usr/lib/libgcj.so.5.0.0) at _Jv_WaitForState(java.lang.Class, int) (/usr/lib/libgcj.so.5.0.0) at java.lang.VMClassLoader.linkClass0(java.lang.Class) (/usr/lib/libgcj.so.5.0.0) at java.lang.VMClassLoader.resolveClass(java.lang.Class) (/usr/lib/libgcj.so.5.0.0) Atentamente: Ing. Jes?s Ter?n Bl?squez MCM Telecomunicaciones 53.50.00.57 Planeaci?n From aph@redhat.com Thu Mar 15 17:01:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 15 Mar 2007 17:01:00 -0000 Subject: Problem with java In-Reply-To: <52F9F54F025401488996B9795D659D8E108907@mcmmx012.mcm.mexico> References: <52F9F54F025401488996B9795D659D8E108907@mcmmx012.mcm.mexico> Message-ID: <17913.29449.206734.668339@zebedee.pink> Teran Jesus writes: > Hello, I am using the java for a provisioning system and when i > execute my program i get the next error, i have the > libgcj-3.4.6-3.1 version, if i put an older version libgcj-3.2.2-5, > the error doesn't appears, do you know what do i need with the new > version to my program runs? You need gcj Version 4.3 (not yet released) to run Java 1.5 code which uses java.lang.StringBuilder. Alternatively, if you're running on Fedora there's a new test RPM at http://download.fedoraproject.org/pub/fedora/linux/core/development/x86_64/os/Fedora/libgcj-4.1.2-4.x86_64.rpm http://download.fedoraproject.org/pub/fedora/linux/core/development/x86_64/os/Fedora/libgcj-4.1.2-4.i386.rpm Andrew. From jteran@mcmtelecom.com.mx Thu Mar 15 17:20:00 2007 From: jteran@mcmtelecom.com.mx (Teran Jesus) Date: Thu, 15 Mar 2007 17:20:00 -0000 Subject: Problem with java Message-ID: <52F9F54F025401488996B9795D659D8E108983@mcmmx012.mcm.mexico> Hello Andrew, I am using the red hat enterprise 4, why when i use the libgcj-3.2.2-5 version it works, do you have another solution? -----Original Message----- From: Andrew Haley [mailto:aph@redhat.com] Sent: Jueves, 15 de Marzo de 2007 10:24 a.m. To: Teran Jesus Cc: gcc-help@gcc.gnu.org Subject: Re: Problem with java Teran Jesus writes: > Hello, I am using the java for a provisioning system and when i > execute my program i get the next error, i have the > libgcj-3.4.6-3.1 version, if i put an older version libgcj-3.2.2-5, > the error doesn't appears, do you know what do i need with the new > version to my program runs? You need gcj Version 4.3 (not yet released) to run Java 1.5 code which uses java.lang.StringBuilder. Alternatively, if you're running on Fedora there's a new test RPM at http://download.fedoraproject.org/pub/fedora/linux/core/development/x86_64/o s/Fedora/libgcj-4.1.2-4.x86_64.rpm http://download.fedoraproject.org/pub/fedora/linux/core/development/x86_64/o s/Fedora/libgcj-4.1.2-4.i386.rpm Andrew. From aph@redhat.com Thu Mar 15 17:39:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 15 Mar 2007 17:39:00 -0000 Subject: Problem with java In-Reply-To: <52F9F54F025401488996B9795D659D8E108983@mcmmx012.mcm.mexico> References: <52F9F54F025401488996B9795D659D8E108983@mcmmx012.mcm.mexico> Message-ID: <17913.32852.791735.80366@zebedee.pink> Please don't top-post. Teran Jesus writes: > Hello Andrew, I am using the red hat enterprise 4, why when i use the > libgcj-3.2.2-5 version it works, do you have another solution? OK, my dates were wrong, sorry. We've had StringBuilder since May 2005, and it is in a couple of released versions. However, I don't know why this program works with libgcj 3.2.2. Maybe the program tries to "autodetect" which version of Java it's running on. Andrew. From Vladimir.Simonov@acronis.com Thu Mar 15 23:14:00 2007 From: Vladimir.Simonov@acronis.com (Vladimir Simonov) Date: Thu, 15 Mar 2007 23:14:00 -0000 Subject: gcc forgets to decrease esp after function call In-Reply-To: <17913.12323.646294.479431@zebedee.pink> References: <45F15674.9000701@acronis.com> <17905.22833.766154.45450@zebedee.pink> <45F1681A.6030307@acronis.com> <17905.28252.856544.931176@zebedee.pink> <45F180B3.50901@acronis.com> <17905.33869.537927.207102@zebedee.pink> <45F1A223.6060406@acronis.com> <17905.42424.400663.138838@zebedee.pink> <45F292DA.30804@acronis.com> <17908.16759.282405.262830@zebedee.pink> <45F653D5.8070500@acronis.com> <17910.32685.453760.827798@zebedee.pink> <45F6E269.1050201@acronis.com> <17910.58546.897282.378139@zebedee.pink> <45F80E6C.5090601@acronis.com> <17913.5853.465646.305627@zebedee.pink> <45F92EC7.2000106@acronis.com> <17913.12323.646294.479431@zebedee.pink> Message-ID: <45F984DB.3050201@acronis.com> Andrew Haley wrote: > Vladimir Simonov writes: > > Andrew Haley wrote: > > > Vladimir Simonov writes: > > > > The attached test case can be built by compile.sh. > > > > It produces two binaries - test_bin_bad & test_bin_good. > > > > > > > > test_bin_good prints "Hello word" before exit. > > > > test_bin_bad crashes. > > > > > > > > The difference is the only -O2 used while test_bin_bad build. > > > > > > > > The symptoms are the same - incorrect esp usage in caller > > > > after call function returning object. > > > > > > > > We reproduced the bug in gcc 4.1.0/4.1.1/4.1.2 > > > > gcc 3.x can't compile the sources. > > > > > > OK, we're getting closer. > > > > Hi > > > > Are you capable to reproduce the bug? > > Yes. > > > > Unfortunately, your test case includes a > > > ton of system headers for one particular system/version of gcc, > > But it doesn't contain any #include directive. > > It is self consistent. > > > > Do you mean that I should > > add "#include" for system headers? > > Yes. Otherwise it's not possible to compile it with any other version > of gcc than the one you built it on. A test case should be > standalone and not depend on a particulat gcc version. Sending you the test without inlined standard includes. But the source is still very large - ~1Mb. > > > I think this way we may made the bug less obvious. > > > > and it > > > also includes a lot of library code not used in your test case. > > > > I understood it from the start of discussion :) > > I hoped: > > > 1. GCC delelopers have some tools or methods to automatically > > remove text which does not affect codegeneration. Or some compile > > stage which contans intermediate data without unused by > > codegeneration prototypes, classes, etc. > > > 2. GCC developers are smart enough to localize and try to fix gcc > > having such obvious indication as this - codegenerator "forgets" > > that it called function returning object. Is it impossible to find > > thin place/places taking into account above, fix it and check by > > our test? > > It's up to you, really. The more self-contained a test case you > provide, the more likely someone is to fix your problem. Remember > that they are, in this case, volunteers, and not highly motivated to > spend a lot of time to try to remove all the extraneous code. > > > In such a case the test size has no defference in my opinion. > > > > > > > Fillet that, and you will have a test case that can be submitted. > > > > It requires a lot of mannual work - remove a peace of code, then > > check that the test can be built, the check that the bug did not > > disappear, etc. > > It's your code, so presumably you are familiar with it. I stepped > though the code in gdb, and it seemed that not many routines were > actually involved. We have tried to minimize the test but without significant success. If we try to create simple test case from scratch we can't reproduce the problem. I have a feeling the problem appears if huge templated code involved into codegeneration. If I understand correct it is impossible to file this bug to gcc bugzilla - it does not permit attachements. Do you think I need to post the problem to some another list to get it solved? Or just leave it( and you :) ) alone? Regards Vladimir -------------- next part -------------- A non-text attachment was scrubbed... Name: gcc_bug.tgz Type: application/x-gzip Size: 81859 bytes Desc: not available URL: From tprince@myrealbox.com Fri Mar 16 11:52:00 2007 From: tprince@myrealbox.com (Timothy C Prince) Date: Fri, 16 Mar 2007 11:52:00 -0000 Subject: errors while using -lgfortran instead of libg2c.a Message-ID: <1174000481.c7c3da3ctprince@myrealbox.com> -----Original Message----- From: "satyaakam goswami" To: gcc-help@gcc.gnu.org Date: Thu, 8 Mar 2007 11:07:05 +0530 Subject: errors while using -lgfortran instead of libg2c.a we getting undefined symbol:`d_sign', please suggest. /tsi71/pubref/liba/lnx86_gcc_ia32/liblapack.a /tsi71/pubref/liba/lnx86_gcc_ia32/libblas.a /tsi71/pubref/liba/lnx86_gcc_ia32/liblamatrix++.a -lm -lgfortran /tsi71/pubref/liba/lnx86_gcc_ia32/liblapack++.a(dtimmg.o): In function `dtimmg_': dtimmg.c:(.text+0xe47): undefined reference to `d_sign' dtimmg.c:(.text+0xf11): undefined reference to `d_sign' dtimmg.c:(.text+0x1004): undefined reference to `d_sign' dtimmg.c:(.text+0x10de): undefined reference to `d_sign' dtimmg.c:(.text+0x120d): undefined reference to `d_sign' Satya _____________________________ It's probably better not to mix libraries built with libg2c with gfortran. One would think that a linux distribution which supports a satisfactory gfortran (gcc 4.1 or newer) would have libraries built for libgfortran. Older libraries might be better rebuilt using gfortran. Tim Prince From sigra@home.se Fri Mar 16 12:39:00 2007 From: sigra@home.se (Erik) Date: Fri, 16 Mar 2007 12:39:00 -0000 Subject: Optimisation puzzle In-Reply-To: References: Message-ID: <45FA852C.1090904@home.se> Nate Denmark skrev: > I have a question about the optimiser in GCC. Take this bit of code: > > for(x = 0; x != 10; x++) > puts("Hello"); > > When compiled with full optimisations (-O3, -fexpensive-optimizations > etc.) it generates the following loop in assembly: > > .L2: > incl %ebx > movl $.LC0, (%esp) > call puts > cmpl $10, %ebx > jne .L2 > > .LC0 points to the "Hello" string. I'm wondering why GCC puts that > 'movl' line inside the loop, so that it's executed each time, when it > could go before the loop? As I understand it, 'puts' shouldn't do > anything to the stack, and the return value is passed back in eax, so > I'm not sure why it's doing the 'movl' each time. If I force loop > unrolling the same thing happens -- the 'movl' each iteration. From man:puts I see that it is declared "int puts(const char *)". This means that puts does not promise to leave its argument unchanged. Therefore the caller must push the argument anew before each call. If it had been declared "int puts(const char * const)" instead, the push should be moved outside the loop. Unfortunately this does not seem to work. I tried with the following program: void q(const unsigned int); void f() {for (unsigned int x = 0; x != 10; x++) q(77);} and built it with "gcc -std=c99 -Os -Wall -Wextra -Werror -S": .L2: subl $12, %esp incl %ebx pushl $77 call q addl $16, %esp cmpl $10, %ebx jne .L2 As you can see, "pushl $77" is still inside the loop even though q promises to not change its argument. This must be a bug. I tried to reproduce the bug with Ada and although the loop generated from Ada source code is indeed 2 instruction shorter (5 instructions instead of 7 instructions for C), the bug seems to be there too. I have this program in f.adb: with Q; procedure F is begin for i in 1 .. 10 loop Q(77); end loop; end F; and q.ads: procedure Q(N : in Natural); and built with "gnatgcc -Os -Wall -Wextra -Wextra -Werror -S f.adb": .L5: pushl $77 .LCFI3: call _ada_q popl %eax decl %ebx jns .L5 So if you need this loop to be tight, write it in Ada. But something, probably GCC, still needs to be fixed to get the "pushl $77" out of the loop (for any language). Unless someone explains that I have misses something, I will report this as a bug to gcc. Note 1: Tested with gcc 4.1.1 (Gentoo 4.1.1-r3) and gnatgcc 3.4.5 (from Gentoo dev-lang/gnat-3.45). Note 2: If you change the loop in C to "for (unsigned int x = 10; x; --x)" you will get it down to 6 instructions. Still not as tight as the Ada version, but one instruction less than your version. That gcc does not optimize your version to the 6 instruction version seems to be another bug. (I will report that too unless someone objects.) From Markus.Duft@salomon.at Fri Mar 16 13:49:00 2007 From: Markus.Duft@salomon.at (Duft Markus) Date: Fri, 16 Mar 2007 13:49:00 -0000 Subject: Cross GCC and Sysroot Message-ID: <18597F2B47F1394A9B309945EC724112D0B361@servex01.wamas.com> Hi! I'm working on getting a compiler-farm up, that can cross compile to multiple platforms. It's allready almost done, but there are some small problems left over. Since the Compiler-Farm will only compile (no preprocessing, no linking, etc.) because of usage of DISTCC, i wanted to ask if there is a way to build binutils/gcc in a way that there are only the really necessary parts (as, gcc, g++) without support for linking and other unwanted stuff. The second problem is, how to find out what to put in the sysroot packages used to bootstrap the crossc ompilers for each platform. At the moment this is a really annoying manual process of sorting out and tar'ing together /usr/include and /usr/lib with some additional softlinks. Is there a somewhat short list of files i need for this purpose? The sysroot package is used only for bootstrapping gcc, since everything that the cross-gcc will see is preprocessed allready. Any comments/ideas appreciated ;o) Thanks in Advance, Markus From karuottu@mbnet.fi Fri Mar 16 15:20:00 2007 From: karuottu@mbnet.fi (Kai Ruottu) Date: Fri, 16 Mar 2007 15:20:00 -0000 Subject: Cross GCC and Sysroot In-Reply-To: <18597F2B47F1394A9B309945EC724112D0B361@servex01.wamas.com> References: <18597F2B47F1394A9B309945EC724112D0B361@servex01.wamas.com> Message-ID: <45FAA186.4070207@mbnet.fi> Duft Markus kirjoitti: > Hi! > > I'm working on getting a compiler-farm up, that can cross compile to > multiple platforms. It's allready almost done, but there are some small > problems left over. > > Since the Compiler-Farm will only compile (no preprocessing, no linking, > etc.) because of usage of DISTCC, i wanted to ask if there is a way to > build binutils/gcc in a way that there are only the really necessary > parts (as, gcc, g++) without support for linking and other unwanted > stuff. > Just leave the build when it stops! It stops when trying libgcc, so if you don't link, where you will need libgcc? > The second problem is, how to find out what to put in the sysroot > packages used to bootstrap the crossc ompilers for each platform. At the > moment this is a really annoying manual process of sorting out and > tar'ing together /usr/include and /usr/lib with some additional > softlinks. Is there a somewhat short list of files i need for this > purpose? > You don't need anything for the $target system... > The sysroot package is used only for bootstrapping gcc, since everything > that the cross-gcc will see is preprocessed allready. > No 'bootstrap' required either... In a nutshell: Building GCC binaries requires ONLY the $host GCC ! Nothing for the $target ! Producing anything for the $target WITH the new GCC then can require quite a lot $target stuff ! From Markus.Duft@salomon.at Fri Mar 16 17:24:00 2007 From: Markus.Duft@salomon.at (Duft Markus) Date: Fri, 16 Mar 2007 17:24:00 -0000 Subject: Cross GCC and Sysroot Message-ID: <18597F2B47F1394A9B309945EC724112D0B394@servex01.wamas.com> Kai Ruottu <> wrote: > Duft Markus kirjoitti: >> Hi! >> >> I'm working on getting a compiler-farm up, that can cross compile to >> multiple platforms. It's allready almost done, but there are some >> small problems left over. >> >> Since the Compiler-Farm will only compile (no preprocessing, no >> linking, etc.) because of usage of DISTCC, i wanted to ask if there >> is a way to build binutils/gcc in a way that there are only the >> really necessary parts (as, gcc, g++) without support for linking >> and other unwanted stuff. >> > Just leave the build when it stops! It stops when trying libgcc, so > if you don't link, > where you will need libgcc? You're right ;o) i don't need libgcc anyways. But i'm inside an automated build system, which will die if there is an error. Additionally i can't do "make install" in this state, can i? >> The second problem is, how to find out what to put in the sysroot >> packages used to bootstrap the crossc ompilers for each platform. At >> the moment this is a really annoying manual process of sorting out >> and tar'ing together /usr/include and /usr/lib with some additional >> softlinks. Is there a somewhat short list of files i need for this >> purpose? >> > You don't need anything for the $target system... >> The sysroot package is used only for bootstrapping gcc, since >> everything that the cross-gcc will see is preprocessed allready. >> > No 'bootstrap' required either... > > In a nutshell: Building GCC binaries requires ONLY the $host GCC ! > Nothing for > the $target ! Producing anything for the $target WITH the new GCC > then can require > quite a lot $target stuff ! Oki doki.... ;o) Thanks, Markus From pranabesh.dash@gmail.com Fri Mar 16 21:31:00 2007 From: pranabesh.dash@gmail.com (Pranabesh Dash) Date: Fri, 16 Mar 2007 21:31:00 -0000 Subject: GCC 4.1.0 compile error In-Reply-To: <47694070703161021v12b67ee3j144baf0459f428dd@mail.gmail.com> References: <47694070703161021v12b67ee3j144baf0459f428dd@mail.gmail.com> Message-ID: <47694070703161024h49462899od3df2cc1bc9b4ff1@mail.gmail.com> On 3/16/07, Pranabesh Dash wrote: > > Hi, > The following piece of code compiles fine with 3.4.2, 4.0.0 but errors out on 4.1.0. Seems like a GCC bug. The friend function name is recognized if called as a function but does not work when used as a function pointer. An explicit function declaration (or definition reordered) is needed to get it to compile with 4.1.0. > > Do you believe this is a bug or a feature??? > > --P.D > > #include > > using namespace std; > > class object; > typedef void (func_ptr)( object* ); > class object { > > public: > object() {} > ~object() {} > > void top_func(); > void call_func_ptr(func_ptr); > protected: > friend void frnd_func(object*); > > private: > int member; > }; > > //friend.cpp: In member function #void object::top_func()#: > //friend.cpp:27: error: #frnd_func# was not declared in this scope > // The following needs to be uncommented to get 4.1.0 to compile > //void frnd_func(object*) ; > > void object::top_func() { > frnd_func(this); // Does not complain on this > call_func_ptr(frnd_func); // But complains on this !!!!! > } > > void object::call_func_ptr(func_ptr fp) { > fp(this); > } > > void frnd_func(object* obj) { > obj->member = 4; > } > > main () { > > object my_obj; > } > From iant@google.com Fri Mar 16 21:35:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Fri, 16 Mar 2007 21:35:00 -0000 Subject: Optimisation puzzle In-Reply-To: <45FA852C.1090904@home.se> References: <45FA852C.1090904@home.se> Message-ID: Erik writes: > From man:puts I see that it is declared "int puts(const char > *)". This means that puts does not promise to leave its argument > unchanged. Therefore the caller must push the argument anew before > each call. If it had been declared "int puts(const char * const)" > instead, the push should be moved outside the loop. Unfortunately this > does not seem to work. I tried with the following program: > void q(const unsigned int); > void f() {for (unsigned int x = 0; x != 10; x++) q(77);} > > and built it with "gcc -std=c99 -Os -Wall -Wextra -Werror -S": > .L2: > subl $12, %esp > incl %ebx > pushl $77 > call q > addl $16, %esp > cmpl $10, %ebx > jne .L2 > > As you can see, "pushl $77" is still inside the loop even though q > promises to not change its argument. This must be a bug. This is not a bug. const on an automatic variable in C is more advisory than anything else. You are not permitted to change a const object, but you can cast its address to a non-const pointer. The only time const really means something is when it is applied to a global or static variable. In that case the compiler is permitted to put the variable in read-only storage. That is, this is legal C: int q (const unsigned int i) { int *p = (int *) &i; *p = 1; return i; } Ian From iant@google.com Fri Mar 16 22:07:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Fri, 16 Mar 2007 22:07:00 -0000 Subject: GCC 4.1.0 compile error In-Reply-To: <47694070703161024h49462899od3df2cc1bc9b4ff1@mail.gmail.com> References: <47694070703161021v12b67ee3j144baf0459f428dd@mail.gmail.com> <47694070703161024h49462899od3df2cc1bc9b4ff1@mail.gmail.com> Message-ID: "Pranabesh Dash" writes: > The following piece of code compiles fine with 3.4.2, 4.0.0 but > errors out on 4.1.0. Seems like a GCC bug. The friend function name > is recognized if called as a function but does not work when used as > a function pointer. An explicit function declaration (or definition > reordered) is needed to get it to compile with 4.1.0. > > Do you believe this is a bug or a feature??? This is a feature. It is caused by closer conformance to the C++ standard. See the -ffriend-injection option and see "ARM-style name-injection" in http://gcc.gnu.org/gcc-4.1/changes.html. Ian From sigra@home.se Fri Mar 16 22:24:00 2007 From: sigra@home.se (Erik) Date: Fri, 16 Mar 2007 22:24:00 -0000 Subject: Optimisation puzzle In-Reply-To: References: <45FA852C.1090904@home.se> Message-ID: <45FB1566.5010605@home.se> Ian Lance Taylor skrev: > Erik writes: > > >> From man:puts I see that it is declared "int puts(const char >> *)". This means that puts does not promise to leave its argument >> unchanged. Therefore the caller must push the argument anew before >> each call. If it had been declared "int puts(const char * const)" >> instead, the push should be moved outside the loop. Unfortunately this >> does not seem to work. I tried with the following program: >> void q(const unsigned int); >> void f() {for (unsigned int x = 0; x != 10; x++) q(77);} >> >> and built it with "gcc -std=c99 -Os -Wall -Wextra -Werror -S": >> .L2: >> subl $12, %esp >> incl %ebx >> pushl $77 >> call q >> addl $16, %esp >> cmpl $10, %ebx >> jne .L2 >> >> As you can see, "pushl $77" is still inside the loop even though q >> promises to not change its argument. This must be a bug. >> > > This is not a bug. const on an automatic variable in C is more > advisory than anything else. You are not permitted to change a const > object, but you can cast its address to a non-const pointer. It is a bug. If not in gcc, then in C, that allows the programmers to do such strange things, preventing the compiler from optimizing the code. The right thing for gcc to do would be to enable such optimizations and warn when the code casts away constness, that it could break optimized code. I believe that is what gcc already does for some stupidities; gcc performs some optimizations that are broken by reinterpret_cast and gives "warning: dereferencing type-punned pointer will break strict-aliasing rules". So gcc should be modified to be useful for users who need the optimization but not the bizarre misfeatures of C. Anyway, it is surely a bug that gcc does not optimize away the "pushl $77" inside the loop from the Ada program. Unlike C, Ada was not designed for ugly hacks, but for clarity and for letting compilers perform optimizations. So a promise is a promise. If a function says it will not touch something, it won't. From iant@google.com Fri Mar 16 23:33:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Fri, 16 Mar 2007 23:33:00 -0000 Subject: Optimisation puzzle In-Reply-To: <45FB1566.5010605@home.se> References: <45FA852C.1090904@home.se> <45FB1566.5010605@home.se> Message-ID: Erik writes: > > This is not a bug. const on an automatic variable in C is more > > advisory than anything else. You are not permitted to change a const > > object, but you can cast its address to a non-const pointer. > It is a bug. If not in gcc, then in C, that allows the programmers to > do such strange things, preventing the compiler from optimizing the > code. The right thing for gcc to do would be to enable such > optimizations and warn when the code casts away constness, that it > could break optimized code. I believe that is what gcc already does > for some stupidities; gcc performs some optimizations that are broken > by reinterpret_cast and gives "warning: dereferencing type-punned > pointer will break strict-aliasing rules". So gcc should be modified > to be useful for users who need the optimization but not the bizarre > misfeatures of C. Those uses of reinterpret_cast are actually forbidden by the standard; that warning is telling you that you are doing something forbidden. The standard serves as a contract between the compiler and the programmer. There are reasons to sometimes modify the standard; it's not clear that this is one of them. > Anyway, it is surely a bug that gcc does not optimize away the "pushl > $77" inside the loop from the Ada program. Unlike C, Ada was not > designed for ugly hacks, but for clarity and for letting compilers > perform optimizations. So a promise is a promise. If a function says > it will not touch something, it won't. I don't know Ada. Ian From crowl@google.com Sat Mar 17 10:28:00 2007 From: crowl@google.com (Lawrence Crowl) Date: Sat, 17 Mar 2007 10:28:00 -0000 Subject: Optimisation puzzle In-Reply-To: <45FB1566.5010605@home.se> References: <45FA852C.1090904@home.se> <45FB1566.5010605@home.se> Message-ID: <29bd08b70703161632t2b6e0eddn31dbd17b4207f53b@mail.gmail.com> On 3/16/07, Erik wrote: > Ian Lance Taylor skrev: > > Erik writes: > > > > > >> From man:puts I see that it is declared "int puts(const char > >> *)". This means that puts does not promise to leave its argument > >> unchanged. Therefore the caller must push the argument anew before > >> each call. If it had been declared "int puts(const char * const)" > >> instead, the push should be moved outside the loop. Unfortunately this > >> does not seem to work. I tried with the following program: > >> void q(const unsigned int); > >> void f() {for (unsigned int x = 0; x != 10; x++) q(77);} > >> > >> and built it with "gcc -std=c99 -Os -Wall -Wextra -Werror -S": > >> .L2: > >> subl $12, %esp > >> incl %ebx > >> pushl $77 > >> call q > >> addl $16, %esp > >> cmpl $10, %ebx > >> jne .L2 > >> > >> As you can see, "pushl $77" is still inside the loop even though q > >> promises to not change its argument. This must be a bug. > > > > This is not a bug. const on an automatic variable in C is more > > advisory than anything else. You are not permitted to change a const > > object, but you can cast its address to a non-const pointer. The "lost optimization" in this case has nothing to do with const versus non-const. The issue is that the call deallocates the parameters. The pushl is allocating the argument. While it is possible to avoid the deallocation and reallocation, doing so requires either changing the calling convention or doing "whole program" optimization. In either event, all of the tools that understand the calling convention, like the debugger, would need to be modified. Again, this can be done, but not without investment and a period of "bugs". Note that in C++, you are not permitted to modify a const parameter. The compiler can optimize on that basis, but in this case, the code would be unaffected because of the allocation issue. > It is a bug. If not in gcc, then in C, that allows the programmers to do > such strange things, preventing the compiler from optimizing the code. > The right thing for gcc to do would be to enable such optimizations and > warn when the code casts away constness, that it could break optimized > code. I believe that is what gcc already does for some stupidities; gcc > performs some optimizations that are broken by reinterpret_cast and > gives "warning: dereferencing type-punned pointer will break > strict-aliasing rules". So gcc should be modified to be useful for users > who need the optimization but not the bizarre misfeatures of C. Given the need for compatibility with existing programs at the time that const was introduced, I don't think it is possible to have the kind of const safety that you seem to want. > Anyway, it is surely a bug that gcc does not optimize away the "pushl > $77" inside the loop from the Ada program. I think the Ada behavior is correct as well, because of the argument allocation. Skipping that would change the ABI, which should not be done lightly. > Unlike C, Ada was not designed for ugly hacks, but for clarity > and for letting compilers perform optimizations. I think that is an unfair characterization of C. The C language was designed to let programmers do the kinds of optimizations that most compilers of the day were not doing. It enabled many programmers get out of assembly coding. Ada had the advantage of being designed some ten years after C, when compilers could be relied upon to do optimizations. Even so, it was a bit of a stretch, and Ada lost many of its potential users because of poor initial performance. I am not saying that the Ada designers made a mistake, just that there were consequences. > So a promise is a promise. If a function says it will not touch > something, it won't. But, as I've shown, this notion does not apply to the example. -- Lawrence Crowl From sigra@home.se Sat Mar 17 22:24:00 2007 From: sigra@home.se (Erik) Date: Sat, 17 Mar 2007 22:24:00 -0000 Subject: Optimisation puzzle In-Reply-To: <29bd08b70703161632t2b6e0eddn31dbd17b4207f53b@mail.gmail.com> References: <45FA852C.1090904@home.se> <45FB1566.5010605@home.se> <29bd08b70703161632t2b6e0eddn31dbd17b4207f53b@mail.gmail.com> Message-ID: <45FBC2EC.8090900@home.se> Lawrence Crowl skrev: > On 3/16/07, Erik wrote: >> Ian Lance Taylor skrev: >> > Erik writes: >> > >> > >> >> From man:puts I see that it is declared "int puts(const char >> >> *)". This means that puts does not promise to leave its argument >> >> unchanged. Therefore the caller must push the argument anew before >> >> each call. If it had been declared "int puts(const char * const)" >> >> instead, the push should be moved outside the loop. Unfortunately >> this >> >> does not seem to work. I tried with the following program: >> >> void q(const unsigned int); >> >> void f() {for (unsigned int x = 0; x != 10; x++) q(77);} >> >> >> >> and built it with "gcc -std=c99 -Os -Wall -Wextra -Werror -S": >> >> .L2: >> >> subl $12, %esp >> >> incl %ebx >> >> pushl $77 >> >> call q >> >> addl $16, %esp >> >> cmpl $10, %ebx >> >> jne .L2 >> >> >> >> As you can see, "pushl $77" is still inside the loop even though q >> >> promises to not change its argument. This must be a bug. >> > >> > This is not a bug. const on an automatic variable in C is more >> > advisory than anything else. You are not permitted to change a const >> > object, but you can cast its address to a non-const pointer. > > The "lost optimization" in this case has nothing to do with const > versus non-const. The issue is that the call deallocates the > parameters. The pushl is allocating the argument. OK, as I understand it, the pushl $77 does 2 things: 1. Copy the value 77. 2. Allocate space for it (by changing the stack pointer). And in C, allocating the space must be done in each iteration because the called function deallocates it. But copying the value 77 in each iteration could be optimized away. But what about Ada? Does it have the same calling convetion? See the Ada loop: .L5: pushl $77 .LCFI3: call _ada_q popl %eax decl %ebx jns .L5 It looks like in Ada, the caller deallocates the parameter (popl). If this is so, it would mean that both the push and the pop should be moved out of the loop, something like: pushl $77 .L5: .LCFI3: call _ada_q decl %ebx jns .L5 popl %eax This would cut the loop down to only 3 instructions. Not bad compared to the 7 instructions in the original C loop. But the C version should probably be counted as having 8 instructions to make the comparison accurate, since it has a hidden popl inside q, which is not in Q of the Ada version. Is this correct? From stecarucci@hotmail.com Sun Mar 18 11:09:00 2007 From: stecarucci@hotmail.com (stefano carucci) Date: Sun, 18 Mar 2007 11:09:00 -0000 Subject: data type & sections Message-ID: Hello all, my question is: Is it possible to set a data type (for example, the type "Matrix",customized by means of a struct, or a standard type, as "int") in a certain section (defined in the linker script, as ".data") in order for every Matrix-items (for example) to be placed in a dedicated memory? maybe, by means of a #pragma...? further details : the target processor is a microblaze. I have read about linker script ( http://sourceware.org/binutils/docs-2.17/ld/Scripts.html ) Thank you for your kindness!!! Stefano Carucci _________________________________________________________________ Windows Live OneCare: tutto per la cura del tuo PC ! Provalo Gratis! http://onecare.live.com/standard/it-it/default.htm From ITZHACK@il.ibm.com Sun Mar 18 15:03:00 2007 From: ITZHACK@il.ibm.com (Itzhack Goldberg) Date: Sun, 18 Mar 2007 15:03:00 -0000 Subject: Error: expected expression before return In-Reply-To: <45F95132.4050902@microimages.com> Message-ID: Hi, Thanks for the quick and accurate answer. However I wonder about how gcc/gdb handles compound statements like: ((rtrn1=open("/tmp/file1",O_RDONLY))) && ((rtrn2=open("/tmp/file2",O_WRONLY))) ... What I see is, that the two expressions are treated as one statement when I try to "step" through the code with gdb... Is there a way/flag I could introduce so that I could indeed step through the statement, one expression at the time ? Thanks in advance, - Itzhack Dave Williss To Itzhack Goldberg/Haifa/IBM@IBMIL 15/03/07 15:59 cc gcc-help@gcc.gnu.org, Tehila Meyzels/Haifa/IBM@IBMIL Subject Re: Error: expected expression before return Itzhack Goldberg wrote: > The following program doesn't pass compliation: > > #include > int izik() > { > ( 1 == 1 ) && return 0 || return 1 ; > } > int main() > { > int rtrn = izik(); > } > > > The error is: error: expected expression before 'return' > > int izik() { return ( 1 == 1) ? 0 : 1; } This is C, not Perl :-) Shalom From dberlin@dberlin.org Mon Mar 19 06:29:00 2007 From: dberlin@dberlin.org (Daniel Berlin) Date: Mon, 19 Mar 2007 06:29:00 -0000 Subject: Signatures Was: where can I get gcc optimizations information In-Reply-To: <3B4C77997DD0254B86D3C9454476B6BC0F03EC20@lonms00812.fm.rbsgrp.net> References: <3B4C77997DD0254B86D3C9454476B6BC0F03EC20@lonms00812.fm.rbsgrp.net> Message-ID: <4aca3dc20703180803o3fbdc47av38fc17245cb0aeda@mail.gmail.com> On 3/12/07, CARTER-HITCHIN, David, GBM wrote: > Hello Andrew (once again), > > > Such disclaimers are inappropriate for mail sent to public lists. If > > your company automatically adds something like this to outgoing mail, > > and you can't convince them to stop, you might consider using a free > > web-based e-mail account. > > I have at least two of these, and they're both banned here at work, hence > my point about people not being able to interact with the list, who work > in such organisations. > We're sorry, but thousands of people are not going to possibly take on liability and risk simply because your company believes it is a good idea to add disclaimers to mails. If this means you can't interact with people, maybe your company should reconsider it's stance on attempting to foist the liability and risk of using email onto others (which is effectively what these disclaimers do). If they won't, we're sorry, but we're doing this to avoid burdening thousands of people who can use the list without having to worry about these things. You can, of course, argue that these disclaimers mean nothing, and are worse than useless, but at least i'm not willing to spend the tens of thousands of dollars it would cost in court to prove it for each different one i receive. IAAL, Dan From supermax9@yandex.ru Mon Mar 19 06:35:00 2007 From: supermax9@yandex.ru (supermax9) Date: Mon, 19 Mar 2007 06:35:00 -0000 Subject: Multiprocessor compiling Message-ID: <9547114.post@talk.nabble.com> My question is very simple - can I achieve a descrease of overall compiling time with gcc on a multiprocessor system? -- View this message in context: http://www.nabble.com/Multiprocessor-compiling-tf3425303.html#a9547114 Sent from the gcc - Help mailing list archive at Nabble.com. From brian@dessent.net Mon Mar 19 10:12:00 2007 From: brian@dessent.net (Brian Dessent) Date: Mon, 19 Mar 2007 10:12:00 -0000 Subject: Multiprocessor compiling References: <9547114.post@talk.nabble.com> Message-ID: <45FE2F38.2EB160A1@dessent.net> supermax9 wrote: > My question is very simple - can I achieve a descrease of overall compiling > time with gcc on a multiprocessor system? gcc itself is single-threaded, so a single instance of it can not benefit from multiple cores. However, you can instruct make to launch multiple jobs in parallel with the -j argument, and so assuming that your Makefile does not contain incorrect or inaccurate dependency relations (i.e. it is "parallel make safe"), and assuming that you have multiple files to compile, then you can in fact take advantage of as many cores/processors as the system has. Brian From Markus.Duft@salomon.at Mon Mar 19 10:17:00 2007 From: Markus.Duft@salomon.at (Duft Markus) Date: Mon, 19 Mar 2007 10:17:00 -0000 Subject: Cross GCC and Sysroot Message-ID: <18597F2B47F1394A9B309945EC724112D0B4ED@servex01.wamas.com> Hi! My question is still not answered, has anybody ideas about this? What i need: * A minimal gcc (*and* g++) * It will be use only for compiling with distcc (so no preprocessing or linking, so i don't need libgcc and stuff) * The build must not exit with an error (as the solution below supposes...) I really just need a gcc and g++ executable that is called from distccd. I'm inside an automated build system so configure/make/make install must go through without error, or otherwise the outer build-system will exit too. Do i need a sysroot package to accomplish this? Is this possible at all? At the moment i'm trying to build the whole gcc suite as cross compiler. For now i'm only working on a ia64-hp-hpux11.23 to i686-pc-linux-gnu cross compiler, but in the final stage there should be compilers for at least the following (allways running on ia64-hp-hpux11.23): ia64-hp-hpux11.23 hppa2.0w-hp-hpux11.11 powerpc-ibm-aix5.2.0.0 powerpc-ibm-aix5.3.0.0 sparc-sun-solaris2.9 i386-pc-solaris2.10 i686-pc-linux-gnu I know this is a big project, and that there is some work to be done inside gcc ;o) The other problem is disk space. Since the host is a Blade-Server there is only little space available (about 36GB i think, or even less, but for sure not more) so unneeded stuff wouldn't be too cool. Any Help and/or Comments appreciated! Cheers, Markus Duft Markus <> wrote: > Kai Ruottu <> wrote: >> Duft Markus kirjoitti: >>> Hi! >>> >>> I'm working on getting a compiler-farm up, that can cross compile to >>> multiple platforms. It's allready almost done, but there are some >>> small problems left over. >>> >>> Since the Compiler-Farm will only compile (no preprocessing, no >>> linking, etc.) because of usage of DISTCC, i wanted to ask if there >>> is a way to build binutils/gcc in a way that there are only the >>> really necessary parts (as, gcc, g++) without support for linking >>> and other unwanted stuff. >>> >> Just leave the build when it stops! It stops when trying libgcc, >> so if you don't link, where you will need libgcc? > > You're right ;o) i don't need libgcc anyways. But i'm inside an > automated build system, which will die if there is an error. > Additionally i can't do "make install" in this state, can i? > >>> The second problem is, how to find out what to put in the sysroot >>> packages used to bootstrap the crossc ompilers for each platform. At >>> the moment this is a really annoying manual process of sorting out >>> and tar'ing together /usr/include and /usr/lib with some additional >>> softlinks. Is there a somewhat short list of files i need for this >>> purpose? >>> >> You don't need anything for the $target system... >>> The sysroot package is used only for bootstrapping gcc, since >>> everything that the cross-gcc will see is preprocessed allready. >>> >> No 'bootstrap' required either... >> >> In a nutshell: Building GCC binaries requires ONLY the $host GCC ! >> Nothing for the $target ! Producing anything for the $target WITH >> the new GCC then can require quite a lot $target stuff ! > > Oki doki.... ;o) > > Thanks, Markus From aph@redhat.com Mon Mar 19 10:45:00 2007 From: aph@redhat.com (Andrew Haley) Date: Mon, 19 Mar 2007 10:45:00 -0000 Subject: Signatures Was: where can I get gcc optimizations information In-Reply-To: <4aca3dc20703180803o3fbdc47av38fc17245cb0aeda@mail.gmail.com> References: <3B4C77997DD0254B86D3C9454476B6BC0F03EC20@lonms00812.fm.rbsgrp.net> <4aca3dc20703180803o3fbdc47av38fc17245cb0aeda@mail.gmail.com> Message-ID: <17918.25358.452637.63369@zebedee.pink> Daniel Berlin writes: > > > We're sorry, but thousands of people are not going to possibly take on > liability and risk simply because your company believes it is a good > idea to add disclaimers to mails. > > If this means you can't interact with people, maybe your company > should reconsider it's stance on attempting to foist the liability and > risk of using email onto others (which is effectively what these > disclaimers do). If they won't, we're sorry, but we're doing this to > avoid burdening thousands of people who can use the list without > having to worry about these things. > > You can, of course, argue that these disclaimers mean nothing, and are > worse than useless, but at least i'm not willing to spend the tens of > thousands of dollars it would cost in court to prove it for each > different one i receive. Thanks, Dan. I'm going to cut and keep this reply of yours for the next time this question comes up... Andrew. From aph@redhat.com Mon Mar 19 12:11:00 2007 From: aph@redhat.com (Andrew Haley) Date: Mon, 19 Mar 2007 12:11:00 -0000 Subject: gcc forgets to decrease esp after function call In-Reply-To: <45F984DB.3050201@acronis.com> References: <45F15674.9000701@acronis.com> <17905.22833.766154.45450@zebedee.pink> <45F1681A.6030307@acronis.com> <17905.28252.856544.931176@zebedee.pink> <45F180B3.50901@acronis.com> <17905.33869.537927.207102@zebedee.pink> <45F1A223.6060406@acronis.com> <17905.42424.400663.138838@zebedee.pink> <45F292DA.30804@acronis.com> <17908.16759.282405.262830@zebedee.pink> <45F653D5.8070500@acronis.com> <17910.32685.453760.827798@zebedee.pink> <45F6E269.1050201@acronis.com> <17910.58546.897282.378139@zebedee.pink> <45F80E6C.5090601@acronis.com> <17913.5853.465646.305627@zebedee.pink> <45F92EC7.2000106@acronis.com> <17913.12323.646294.479431@zebedee.pink> <45F984DB.3050201@acronis.com> Message-ID: <17918.27050.815012.142815@zebedee.pink> Vladimir Simonov writes: > Andrew Haley wrote: > > Vladimir Simonov writes: > > > Andrew Haley wrote: > > > > Vladimir Simonov writes: > > > > Fillet that, and you will have a test case that can be submitted. > > > > > > It requires a lot of mannual work - remove a peace of code, then > > > check that the test can be built, the check that the bug did not > > > disappear, etc. > > > > It's your code, so presumably you are familiar with it. I stepped > > though the code in gdb, and it seemed that not many routines were > > actually involved. > > We have tried to minimize the test but without significant success. > If we try to create simple test case from scratch we can't > reproduce the problem. I have a feeling the problem appears > if huge templated code involved into codegeneration. > > If I understand correct it is impossible to file this > bug to gcc bugzilla - it does not permit attachements. > > Do you think I need to post the problem to some another > list to get it solved? Or just leave it( and you :) ) alone? It all depends on what you need. I have this feeling that your problem may well be fixed by a more recent g++. It's hard to be sure, because your test case does not even compile with a more recent g++. This is, I suspect, becasue we have improved g++ to be closer to the real ISO C++ standard. g++ Version 4.3 reports a number of type mismatch errors in the area that may be causing problems. It is quite possible that if you fix these errors your problem will go away. In any case, a self-contained test case is a prerequiesite for filing a bug. Andrew. From eljay@adobe.com Mon Mar 19 12:30:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Mon, 19 Mar 2007 12:30:00 -0000 Subject: Error: expected expression before return In-Reply-To: Message-ID: Hi Itzhack, > Is there a way/flag I could introduce so that I could indeed step through > the statement, one expression at the time ? I'm able to step into each of the function calls, in sequence (assuming the first one succeeds), one sub-expression at a time, using gdb. HTH, --Eljay From ITZHACK@il.ibm.com Mon Mar 19 12:41:00 2007 From: ITZHACK@il.ibm.com (Itzhack Goldberg) Date: Mon, 19 Mar 2007 12:41:00 -0000 Subject: Error: expected expression before return In-Reply-To: Message-ID: Hi John, I am able too, but only by using nexti (and the listed source command is left on the screen as the first line/expression of the compound statement ...). Have you used any special flag ? The example I sent was made of only two pieces, yet conceivably there can be many expressions in such a compound statement like: (expression) && (expression) && . . . (expression) and one would like to be able to break at the particular expression/line. Is is possible to break on the third expression of such a compound statement ? - Itzhack John Love-Jensen To 19/03/07 14:11 Itzhack Goldberg/Haifa/IBM@IBMIL cc MSX to GCC Subject Re: Error: expected expression before return Hi Itzhack, > Is there a way/flag I could introduce so that I could indeed step through > the statement, one expression at the time ? I'm able to step into each of the function calls, in sequence (assuming the first one succeeds), one sub-expression at a time, using gdb. HTH, --Eljay From eljay@adobe.com Mon Mar 19 12:59:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Mon, 19 Mar 2007 12:59:00 -0000 Subject: Error: expected expression before return In-Reply-To: Message-ID: Hi Itzhack, > Have you used any special flag ? Nope. I just do the 's' (step into) which goes into the first sub-expression's function call, 'fin' (finish) to step out of that function, 's' into the second sub-expression's function call. > and one would like to be able to break at the particular expression/line. > Is is possible to break on the third expression of such a compound > statement ? You can break on an expression. You cannot break on a SUB-expression. (Although I did have a debugger that walked through sub-expressions, but that was on the Amiga.) If you want to do something like that, you might want to consider pulling your SUB-expressions out of the expression and in their own expression. It's not any slower. Trust the optimizer. And it makes the if expression more legible, which is better mojo for maintainability. int rtrn1 = open("/tmp/file1", O_RDONLY); // -1 on error if (rtrn1 != -1) { int rtrn2 = open("/tmp/file2", O_WRONLY); // -1 on error if (rtrn2 != -1) { // yada yada yada } } BTW: you did know that open returns -1 on error, correct? HTH, --Eljay From akimaki23@gmail.com Mon Mar 19 14:14:00 2007 From: akimaki23@gmail.com (Akos Rajna) Date: Mon, 19 Mar 2007 14:14:00 -0000 Subject: unicode problem Message-ID: <625cdd630703190559y6291d6f3tfc28a90e61853695@mail.gmail.com> Hi, on some distributions UTF-32 is the default and i need to change the size of wchar_t to 2 bytes. i tried to compile it with -fwide-exec-charset=UTF-16 but it didn't help. any ideas howto change it? thanks, Akos From eljay@adobe.com Mon Mar 19 16:35:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Mon, 19 Mar 2007 16:35:00 -0000 Subject: unicode problem In-Reply-To: <625cdd630703190559y6291d6f3tfc28a90e61853695@mail.gmail.com> Message-ID: Hi Akos, Have you tried -fshort-wchar flag? CAVEAT: Warning: the -fshort-wchar switch causes GCC to generate code that is not binary compatible with code generated without that switch. Use it to conform to a non-default application binary interface. Sincerely, --Eljay From Vladimir.Simonov@acronis.com Mon Mar 19 17:22:00 2007 From: Vladimir.Simonov@acronis.com (Vladimir Simonov) Date: Mon, 19 Mar 2007 17:22:00 -0000 Subject: gcc forgets to decrease esp after function call In-Reply-To: <17918.27050.815012.142815@zebedee.pink> References: <45F15674.9000701@acronis.com> <17905.22833.766154.45450@zebedee.pink> <45F1681A.6030307@acronis.com> <17905.28252.856544.931176@zebedee.pink> <45F180B3.50901@acronis.com> <17905.33869.537927.207102@zebedee.pink> <45F1A223.6060406@acronis.com> <17905.42424.400663.138838@zebedee.pink> <45F292DA.30804@acronis.com> <17908.16759.282405.262830@zebedee.pink> <45F653D5.8070500@acronis.com> <17910.32685.453760.827798@zebedee.pink> <45F6E269.1050201@acronis.com> <17910.58546.897282.378139@zebedee.pink> <45F80E6C.5090601@acronis.com> <17913.5853.465646.305627@zebedee.pink> <45F92EC7.2000106@acronis.com> <17913.12323.646294.479431@zebedee.pink> <45F984DB.3050201@acronis.com> <17918.27050.815012.142815@zebedee.pink> Message-ID: <45FEBBAD.1090604@acronis.com> Andrew Haley wrote: > Vladimir Simonov writes: > > Andrew Haley wrote: > > > Vladimir Simonov writes: > > > > Andrew Haley wrote: > > > > > Vladimir Simonov writes: > > > > > > Fillet that, and you will have a test case that can be submitted. > > > > > > > > It requires a lot of mannual work - remove a peace of code, then > > > > check that the test can be built, the check that the bug did not > > > > disappear, etc. > > > > > > It's your code, so presumably you are familiar with it. I stepped > > > though the code in gdb, and it seemed that not many routines were > > > actually involved. > > > > We have tried to minimize the test but without significant success. > > If we try to create simple test case from scratch we can't > > reproduce the problem. I have a feeling the problem appears > > if huge templated code involved into codegeneration. > > > > If I understand correct it is impossible to file this > > bug to gcc bugzilla - it does not permit attachements. > > > > Do you think I need to post the problem to some another > > list to get it solved? Or just leave it( and you :) ) alone? > > It all depends on what you need. I have this feeling that your > problem may well be fixed by a more recent g++. It's hard to be sure, > because your test case does not even compile with a more recent g++. > This is, I suspect, becasue we have improved g++ to be closer to the > real ISO C++ standard. > > g++ Version 4.3 reports a number of type mismatch errors in the area > that may be causing problems. It is quite possible that if you fix > these errors your problem will go away. Ok, thank you. We'll try to fix sources to be compatible with gcc 4.3. And check the issue. Could you advise somehow working gcc 4.3 CVS snapshot? Link to tarballs would be very helpfull. We are using 4.1.2 because it is the latest stable version. Regards Vladimir From simon.kagstrom@bth.se Mon Mar 19 17:29:00 2007 From: simon.kagstrom@bth.se (Simon Kagstrom) Date: Mon, 19 Mar 2007 17:29:00 -0000 Subject: Inline assembly problem (GCC bug?) Message-ID: <20070319182245.25821cfe@lska> Hello! I have a problem with some inline assembly, which to me looks like a GCC bug but I first wanted to check that I haven't done any obvious mistake in my implementation. I see the problem both on MIPS and IA-32. The code I have is /* Assign 1 to v0 (the MIPS register used for passing function results) */ static inline int inline_asm(void) { register unsigned long __v0 asm("$2"); __asm__ volatile ( "li %0, 1\n" : "=r" (__v0) : : "memory" ); return (int) __v0; } void problem (void) { int a = inline_asm(); int b = overwriter(); tst(a, b); } When disassembling the generated code, this generates the following MIPS assembly code, with my comments 00000000 : 0: 27bdffe8 addiu sp,sp,-24 4: afbf0010 sw ra,16(sp) 8: 24020001 li v0,1 # Result of the inline assembly piece c: 0c000000 jal overwriter # Overwrites v0 10: 00000000 nop # jal delay slot - v0 should have been saved here! 14: 00402021 move a0,v0 # GCC thinks v0 still contains the result of the inline assembly 18: 0c000000 jal tst 1c: 00402821 move a1,v0 # ... *and* the result of overwriter()! 20: 8fbf0010 lw ra,16(sp) 24: 00000000 nop 28: 03e00008 jr ra 2c: 27bd0018 addiu sp,sp,24 This bug seems to be portable - I rewrote the inline assembly part for IA-32 - just a move to %eax - and %eax was indeed overwritten as well. The versions where I have this problem is mips-linux-gnu-gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) but gcc-3.3 (IA-32) handles this just fine. So the usual question: Did I miss something in the inline assembly piece which can cause this problem or is this a proper GCC bug? (The problem was first manifested in some inline assembly for the Cibyl project, http://spel.bth.se/index.php/Cibyl, and the code is based on the Linux system calls for MIPS) -- // Simon -------------- next part -------------- A non-text attachment was scrubbed... Name: a.i Type: application/octet-stream Size: 449 bytes Desc: not available URL: From aph@redhat.com Mon Mar 19 18:08:00 2007 From: aph@redhat.com (Andrew Haley) Date: Mon, 19 Mar 2007 18:08:00 -0000 Subject: gcc forgets to decrease esp after function call In-Reply-To: <45FEBBAD.1090604@acronis.com> References: <45F15674.9000701@acronis.com> <17905.22833.766154.45450@zebedee.pink> <45F1681A.6030307@acronis.com> <17905.28252.856544.931176@zebedee.pink> <45F180B3.50901@acronis.com> <17905.33869.537927.207102@zebedee.pink> <45F1A223.6060406@acronis.com> <17905.42424.400663.138838@zebedee.pink> <45F292DA.30804@acronis.com> <17908.16759.282405.262830@zebedee.pink> <45F653D5.8070500@acronis.com> <17910.32685.453760.827798@zebedee.pink> <45F6E269.1050201@acronis.com> <17910.58546.897282.378139@zebedee.pink> <45F80E6C.5090601@acronis.com> <17913.5853.465646.305627@zebedee.pink> <45F92EC7.2000106@acronis.com> <17913.12323.646294.479431@zebedee.pink> <45F984DB.3050201@acronis.com> <17918.27050.815012.142815@zebedee.pink> <45FEBBAD.1090604@acronis.com> Message-ID: <17918.51298.795800.290992@zebedee.pink> Vladimir Simonov writes: > > > Andrew Haley wrote: > > Vladimir Simonov writes: > > > Andrew Haley wrote: > > > > Vladimir Simonov writes: > > > > > Andrew Haley wrote: > > > > > > Vladimir Simonov writes: > > > > > > > > Fillet that, and you will have a test case that can be submitted. > > > > > > > > > > It requires a lot of mannual work - remove a peace of code, then > > > > > check that the test can be built, the check that the bug did not > > > > > disappear, etc. > > > > > > > > It's your code, so presumably you are familiar with it. I stepped > > > > though the code in gdb, and it seemed that not many routines were > > > > actually involved. > > > > > > We have tried to minimize the test but without significant success. > > > If we try to create simple test case from scratch we can't > > > reproduce the problem. I have a feeling the problem appears > > > if huge templated code involved into codegeneration. > > > > > > If I understand correct it is impossible to file this > > > bug to gcc bugzilla - it does not permit attachements. > > > > > > Do you think I need to post the problem to some another > > > list to get it solved? Or just leave it( and you :) ) alone? > > > > It all depends on what you need. I have this feeling that your > > problem may well be fixed by a more recent g++. It's hard to be sure, > > because your test case does not even compile with a more recent g++. > > This is, I suspect, becasue we have improved g++ to be closer to the > > real ISO C++ standard. > > > > g++ Version 4.3 reports a number of type mismatch errors in the area > > that may be causing problems. It is quite possible that if you fix > > these errors your problem will go away. > > Ok, thank you. > We'll try to fix sources to be compatible with gcc 4.3. > And check the issue. > Could you advise somehow working gcc 4.3 CVS snapshot? > Link to tarballs would be very helpfull. http://gcc.gnu.org/snapshots.html Whether this helps or not, it will be interesting. Even if it doesn't fix things, it's much more easy to get a gcc developer to fix a bug in the development gcc than in an old version. Andrew. From iant@google.com Mon Mar 19 21:33:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Mon, 19 Mar 2007 21:33:00 -0000 Subject: Inline assembly problem (GCC bug?) In-Reply-To: <20070319182245.25821cfe@lska> References: <20070319182245.25821cfe@lska> Message-ID: Simon Kagstrom writes: > When disassembling the generated code, this generates the following > MIPS assembly code, with my comments > > 00000000 : > 0: 27bdffe8 addiu sp,sp,-24 > 4: afbf0010 sw ra,16(sp) > 8: 24020001 li v0,1 # Result of the inline assembly piece > c: 0c000000 jal overwriter # Overwrites v0 > 10: 00000000 nop # jal delay slot - v0 should have been saved here! > 14: 00402021 move a0,v0 # GCC thinks v0 still contains the result of the inline assembly > 18: 0c000000 jal tst > 1c: 00402821 move a1,v0 # ... *and* the result of overwriter()! > 20: 8fbf0010 lw ra,16(sp) > 24: 00000000 nop > 28: 03e00008 jr ra > 2c: 27bd0018 addiu sp,sp,24 This is not a bug. It is a documented restriction on local register variables: Local register variables in specific registers do not reserve the registers, except at the point where they are used as input or output operands in an asm statement and the asm statement itself is not deleted. There are several ways to avoid this problem. Simply returning the register variable doesn't help, but it should work to store the value in a different register. Or change the asm to explicitly copy the value to a variable with the "d" constraint. Ian From kernel-hacker@bennee.com Mon Mar 19 21:46:00 2007 From: kernel-hacker@bennee.com (Alex Bennee) Date: Mon, 19 Mar 2007 21:46:00 -0000 Subject: Cross Linux/x86 to Solaris2.10/x86-64 compiler build problem Message-ID: <1174339982.27206.10.camel@okra.transitives.com> Hi, I'm not sure if this is a binutils problem or something funky in my configure for gcc. gcc fails to link while building libgcc: /export/toolchain/gcc-4.1.2.git/host-i686-pc-linux-gnu/gcc/xgcc -B/export/toolchain/gcc-4.1.2.git/host-i686-pc-linux-gnu/gcc/ -B/export/toolchain/build-install/i686-sun-solaris2.10/bin/ -B/export/toolchain/build-install/i686-sun-solaris2.10/lib/ -isystem /export/toolchain/build-install/i686-sun-solaris2.10/include -isystem /export/toolchain/build-install/i686-sun-solaris2.10/sys-include -O2 -O2 -g3 -DIN_GCC -DCROSS_COMPILE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc/amd64/libgcc.map -o amd64/libgcc_s.so.1.tmp -m64 libgcc/amd64/_muldi3_s.o libgcc/amd64/_negdi2_s.o libgcc/amd64/_lshrdi3_s.o libgcc/amd64/_ashldi3_s.o libgcc/amd64/_ashrdi3_s.o libgcc/amd64/_cmpdi2_s.o libgcc/amd64/_ucmpdi2_s.o libgcc/amd64/_clear_cache_s.o libgcc/amd64/_enable_execute_stack_s.o libgcc/amd64/_trampoline_s.o libgcc/amd64/__main_s.o libgcc/amd64/_absvsi2_s.o libgcc/amd64/_absvdi2_s.o libgcc/amd64/_addvsi3_s.o libgcc/amd64/_addvdi3_s.o libgcc/amd64/_subvsi3_s.o libgcc/amd64/_subvdi3_s.o libgcc/amd64/_mulvsi3_s.o libgcc/amd64/_mulvdi3_s.o libgcc/amd64/_negvsi2_s.o libgcc/amd64/_negvdi2_s.o libgcc/amd64/_ctors_s.o libgcc/amd64/_ffssi2_s.o libgcc/amd64/_ffsdi2_s.o libgcc/amd64/_clz_s.o libgcc/amd64/_clzsi2_s.o libgcc/amd64/_clzdi2_s.o libgcc/amd64/_ctzsi2_s.o libgcc/amd64/_ctzdi2_s.o libgcc/amd64/_popcount_tab_s.o libgcc/amd64/_popcountsi2_s.o libgcc/amd64/_popcountdi2_s.o libgcc/amd64/_paritysi2_s.o libgcc/amd64/_paritydi2_s.o libgcc/amd64/_powisf2_s.o libgcc/amd64/_powidf2_s.o libgcc/amd64/_powixf2_s.o libgcc/amd64/_powitf2_s.o libgcc/amd64/_mulsc3_s.o libgcc/amd64/_muldc3_s.o libgcc/amd64/_mulxc3_s.o libgcc/amd64/_multc3_s.o libgcc/amd64/_divsc3_s.o libgcc/amd64/_divdc3_s.o libgcc/amd64/_divxc3_s.o libgcc/amd64/_divtc3_s.o libgcc/amd64/_fixunssfsi_s.o libgcc/amd64/_fixunsdfsi_s.o libgcc/amd64/_fixunsxfsi_s.o libgcc/amd64/_fixsfdi_s.o libgcc/amd64/_fixunssfdi_s.o libgcc/amd64/_floatdisf_s.o libgcc/amd64/_fixdfdi_s.o libgcc/amd64/_fixunsdfdi_s.o libgcc/amd64/_floatdidf_s.o libgcc/amd64/_fixxfdi_s.o libgcc/amd64/_fixunsxfdi_s.o libgcc/amd64/_floatdixf_s.o libgcc/amd64/_fixtfdi_s.o libgcc/amd64/_fixunstfdi_s.o libgcc/amd64/_floatditf_s.o libgcc/amd64/_divdi3_s.o libgcc/amd64/_moddi3_s.o libgcc/amd64/_udivdi3_s.o libgcc/amd64/_umoddi3_s.o libgcc/amd64/_udiv_w_sdiv_s.o libgcc/amd64/_udivmoddi4_s.o libgcc/amd64/unwind-dw2_s.o libgcc/amd64/unwind-dw2-fde_s.o libgcc/amd64/unwind-sjlj_s.o libgcc/amd64/gthr-gnat_s.o libgcc/amd64/unwind-c_s.o -lc && rm -f amd64/libgcc_s.so && if [ -f amd64/libgcc_s.so.1 ]; then mv -f amd64/libgcc_s.so.1 amd64/libgcc_s.so.1.backup; else true; fi && mv amd64/libgcc_s.so.1.tmp amd64/libgcc_s.so.1 && ln -s libgcc_s.so.1 amd64/libgcc_s.so /export/toolchain/build-install/bin/i686-sun-solaris2.10-ld: cannot find -lc collect2: ld returned 1 exit status make[3]: *** [amd64/libgcc_s.so] Error 1 make[3]: Leaving directory `/export/toolchain/gcc-4.1.2.git/host-i686-pc-linux-gnu/gcc' make[2]: *** [stmp-multilib] Error 2 make[2]: Leaving directory `/export/toolchain/gcc-4.1.2.git/host-i686-pc-linux-gnu/gcc' make[1]: *** [all-gcc] Error 2 make[1]: Leaving directory `/export/toolchain/gcc-4.1.2.git' make: *** [all] Error 2 I've configured gcc with the following: path=`pwd` crossrc="$path/.." host=i686-pc-gnu target=i686-sun-solaris2.10 prefix=$crosssrc/build-install sysroot=$crosssrc/sysroot syslibs=$sysroot/usr/lib sysincludes=$sysroot/usr/include ./configure -prefix=$prefix --target=$target --with-gnu-as --with-gnu-ld --with-libs=$syslibs --with-headers=$sysincludes --enable-languages=c,c ++ --with-cpu=opteron And I'm using the latest binutils CVS as I've been told the linker already supports this cross-compile option. strace'ing the build it seems to search a series of options before it fails: [pid 4382] open("/export/toolchain/build-install/i686-sun-solaris2.10/bin/libc.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) [pid 4382] open("/export/toolchain/build-install/i686-sun-solaris2.10/bin/libc.a", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) [pid 4382] open("/export/toolchain/build-install/i686-sun-solaris2.10/lib/amd64/libc.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) [pid 4382] open("/export/toolchain/build-install/i686-sun-solaris2.10/lib/amd64/libc.a", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) [pid 4382] open("/export/toolchain/build-install/lib/../i686-sun-solaris2.10/lib/amd64/libc.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) [pid 4382] open("/export/toolchain/build-install/lib/../i686-sun-solaris2.10/lib/amd64/libc.a", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) [pid 4382] open("/lib/64/libc.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) Are these files that should of been copied over into the build directory by binutils from the --with-libs I passed it or should they be referencing sysroot directly. binutils was configured with: path=`pwd` crossrc="$path/.." host=i686-pc-gnu target=i686-sun-solaris2.10 prefix=$crosssrc/build-install sysroot=$crosssrc/sysroot syslibs=$sysroot/usr/lib sysincludes=$sysroot/usr/include ./configure -prefix=$prefix --target=$target --with-gnu-as --with-gnu-ld --with-libs=$syslibs --with-headers=$sysincludes --enable-languages=c,c ++ --with-cpu=opteron Regards, -- Alex, homepage: http://www.bennee.com/~alex/ By doing just a little every day, you can gradually let the task completely overwhelm you. From drow@false.org Tue Mar 20 00:23:00 2007 From: drow@false.org (Daniel Jacobowitz) Date: Tue, 20 Mar 2007 00:23:00 -0000 Subject: Cross Linux/x86 to Solaris2.10/x86-64 compiler build problem In-Reply-To: <1174339982.27206.10.camel@okra.transitives.com> References: <1174339982.27206.10.camel@okra.transitives.com> Message-ID: <20070319214612.GA23973@caradoc.them.org> On Mon, Mar 19, 2007 at 09:33:01PM +0000, Alex Bennee wrote: > path=`pwd` > crossrc="$path/.." > host=i686-pc-gnu > target=i686-sun-solaris2.10 > prefix=$crosssrc/build-install > sysroot=$crosssrc/sysroot > syslibs=$sysroot/usr/lib > sysincludes=$sysroot/usr/include > > ./configure -prefix=$prefix --target=$target --with-gnu-as --with-gnu-ld > --with-libs=$syslibs --with-headers=$sysincludes --enable-languages=c,c > ++ --with-cpu=opteron I strongly recommend you use --with-sysroot instead of --with-libs / --with-headers. That should help. -- Daniel Jacobowitz CodeSourcery From crowl@google.com Tue Mar 20 07:51:00 2007 From: crowl@google.com (Lawrence Crowl) Date: Tue, 20 Mar 2007 07:51:00 -0000 Subject: Optimisation puzzle In-Reply-To: <45FBC2EC.8090900@home.se> References: <45FA852C.1090904@home.se> <45FB1566.5010605@home.se> <29bd08b70703161632t2b6e0eddn31dbd17b4207f53b@mail.gmail.com> <45FBC2EC.8090900@home.se> Message-ID: <29bd08b70703191723h6f75291drcf63f1e637d15576@mail.gmail.com> On 3/17/07, Erik wrote: > Lawrence Crowl skrev: > > On 3/16/07, Erik wrote: > >> Ian Lance Taylor skrev: > >> > Erik writes: > >> > > >> > > >> >> From man:puts I see that it is declared "int puts(const char > >> >> *)". This means that puts does not promise to leave its argument > >> >> unchanged. Therefore the caller must push the argument anew before > >> >> each call. If it had been declared "int puts(const char * const)" > >> >> instead, the push should be moved outside the loop. Unfortunately > >> this > >> >> does not seem to work. I tried with the following program: > >> >> void q(const unsigned int); > >> >> void f() {for (unsigned int x = 0; x != 10; x++) q(77);} > >> >> > >> >> and built it with "gcc -std=c99 -Os -Wall -Wextra -Werror -S": > >> >> .L2: > >> >> subl $12, %esp > >> >> incl %ebx > >> >> pushl $77 > >> >> call q > >> >> addl $16, %esp > >> >> cmpl $10, %ebx > >> >> jne .L2 > >> >> > >> >> As you can see, "pushl $77" is still inside the loop even though q > >> >> promises to not change its argument. This must be a bug. > >> > > >> > This is not a bug. const on an automatic variable in C is more > >> > advisory than anything else. You are not permitted to change a const > >> > object, but you can cast its address to a non-const pointer. > > > > The "lost optimization" in this case has nothing to do with const > > versus non-const. The issue is that the call deallocates the > > parameters. The pushl is allocating the argument. > OK, as I understand it, the pushl $77 does 2 things: > 1. Copy the value 77. > 2. Allocate space for it (by changing the stack pointer). > > And in C, allocating the space must be done in each iteration because > the called function deallocates it. But copying the value 77 in each > iteration could be optimized away. Well actually the caller deallocates it, but on the other side of the basic-block boundary. Look above for the adjustments to the stack pointer. > But what about Ada? Does it have the same calling convention? > See the Ada loop: > .L5: > pushl $77 > .LCFI3: > call _ada_q > popl %eax > decl %ebx > jns .L5 I don't know the Ada ABI, but this code indicates that it does follow the same convention. It would be a bit surprising if it did not because that would make leveraging the system more difficult. > It looks like in Ada, the caller deallocates the parameter (popl). If > this is so, it would mean that both the push and the pop should be moved > out of the loop, something like: > pushl $77 > .L5: > .LCFI3: > call _ada_q > decl %ebx > jns .L5 > popl %eax > > This would cut the loop down to only 3 instructions. Not bad compared to > the 7 instructions in the original C loop. But the C version should > probably be counted as having 8 instructions to make the comparison > accurate, since it has a hidden popl inside q, which is not in Q of the > Ada version. Is this correct? Well, close. Theoretically, the optimization can be done, at least in C++. (I'm not entirely familiar with the C rules here.) The problem is that changing the details around calls takes extra care if you want the tool (like a debugger) to be able to follow along. In this case, I think you would need to show that the savings is a significant fraction of the total cost. You might be able to do that for static code size, but you'll have a harder time for the dynamic instruction count, which is what most compilers optimize. -- Lawrence Crowl From eithan77@gmail.com Tue Mar 20 10:03:00 2007 From: eithan77@gmail.com (Eithan Eithan) Date: Tue, 20 Mar 2007 10:03:00 -0000 Subject: dump-translation-unit Message-ID: Good morning. I would like to use gcc for limited source code analysis. I am interested in description of declarations only. I found "dump-translation-unit" option very useful for this, but unfortunately it dumps only description of used declarations. I read the manuals and searched the Internet, but was not able to find flag or combination of flags that would cause gcc to dump all declarations. I am afraid such functionality is not implemented, am I right? If so can you suggest reasonable solution? P.S. Please tell me that I wrong :-) Thank you. From daniel.lohmann@informatik.uni-erlangen.de Tue Mar 20 10:59:00 2007 From: daniel.lohmann@informatik.uni-erlangen.de (Daniel Lohmann) Date: Tue, 20 Mar 2007 10:59:00 -0000 Subject: data type & sections In-Reply-To: References: Message-ID: <45FFB171.9060202@informatik.uni-erlangen.de> stefano carucci wrote: > > Hello all, > > my question is: > Is it possible to set a data type (for example, the type > "Matrix",customized by means of a struct, or a standard type, as "int") > in a certain section (defined in the linker script, as ".data") in order > for every Matrix-items (for example) to be placed in a dedicated memory? > maybe, by means of a #pragma...? Gcc supports various attributes to assign linker sections (such as __attribute__((section, ".mysection")), take a look in the manuals), which is in general a more flexible mechanism than #pragmas. Unfortunately, the section attribute can be applied only to variable/function definitions, not to type definition. Hence, it is not possible to define a "default section" for all (static) variable instances of a particular type, even though such feature would be *very* useful. If you have full control over the source code you may use a pre-processor macro as workaround, which instantiates Matrix-items with the proper attributes. Daniel From Markus.Duft@salomon.at Tue Mar 20 11:06:00 2007 From: Markus.Duft@salomon.at (Duft Markus) Date: Tue, 20 Mar 2007 11:06:00 -0000 Subject: GCC cross from ia64 to hppa-hpux Message-ID: <18597F2B47F1394A9B309945EC724112D0B7D5@servex01.wamas.com> Hi! I'm currently looking into building a cross-compiler which runs on ia64-hp-hpux11.23 and targets hppa2.0w-hp-hpux11.11. Has there been anything like it? Currently i don't even get binutils built, so any help would be really cool. Cheers, Markus From aph@redhat.com Tue Mar 20 12:15:00 2007 From: aph@redhat.com (Andrew Haley) Date: Tue, 20 Mar 2007 12:15:00 -0000 Subject: GCC cross from ia64 to hppa-hpux In-Reply-To: <18597F2B47F1394A9B309945EC724112D0B7D5@servex01.wamas.com> References: <18597F2B47F1394A9B309945EC724112D0B7D5@servex01.wamas.com> Message-ID: <17919.49174.874641.146589@zebedee.pink> Duft Markus writes: > I'm currently looking into building a cross-compiler which runs on > ia64-hp-hpux11.23 and targets hppa2.0w-hp-hpux11.11. Has there been > anything like it? > > Currently i don't even get binutils built, so any help would be really > cool. Well, obviously you'll need a full set of target libraries and cross-target binutils. Beyond that, I'm, not aware of any special problems. Just configure and go. Andrew. From Markus.Duft@salomon.at Tue Mar 20 12:18:00 2007 From: Markus.Duft@salomon.at (Duft Markus) Date: Tue, 20 Mar 2007 12:18:00 -0000 Subject: GCC cross from ia64 to hppa-hpux Message-ID: <18597F2B47F1394A9B309945EC724112D0B81E@servex01.wamas.com> Andrew Haley <> wrote: > Duft Markus writes: > > > I'm currently looking into building a cross-compiler which runs on > > ia64-hp-hpux11.23 and targets hppa2.0w-hp-hpux11.11. Has there been > > anything like it? > > > > Currently i don't even get binutils built, so any help would be > really > cool. > > Well, obviously you'll need a full set of target libraries and > cross-target binutils. Beyond that, I'm, not aware of any special > problems. Just configure and go. OK, i have the libraries, but is there a binutils how-to somewhere? I built cross-binutils for solaris9, solaris10 and linux, but HP PA HP-UX is somehow a problem..... *arg* Cheers, Markus > > Andrew. From aph@gcc.gnu.org Tue Mar 20 13:08:00 2007 From: aph@gcc.gnu.org (Andrew Haley) Date: Tue, 20 Mar 2007 13:08:00 -0000 Subject: GCC cross from ia64 to hppa-hpux In-Reply-To: <18597F2B47F1394A9B309945EC724112D0B81E@servex01.wamas.com> References: <18597F2B47F1394A9B309945EC724112D0B81E@servex01.wamas.com> Message-ID: <17919.53505.131632.412590@zebedee.pink> Duft Markus writes: > Andrew Haley <> wrote: > > Duft Markus writes: > > > > > I'm currently looking into building a cross-compiler which runs on > > > ia64-hp-hpux11.23 and targets hppa2.0w-hp-hpux11.11. Has there been > > > anything like it? > > > > > > Currently i don't even get binutils built, so any help would be > > really > cool. > > > > Well, obviously you'll need a full set of target libraries and > > cross-target binutils. Beyond that, I'm, not aware of any special > > problems. Just configure and go. > > OK, i have the libraries, but is there a binutils how-to somewhere? I > built cross-binutils for solaris9, solaris10 and linux, but HP PA HP-UX > is somehow a problem..... *arg* Everything to do with cross-HPUX always seems to be a problem. :-) If you can't figure out how to get binutils built I think you'll just have to ask the binutils list. It's certainly way off-topic here. Good luck! Andrew. From Markus.Duft@salomon.at Tue Mar 20 14:06:00 2007 From: Markus.Duft@salomon.at (Duft Markus) Date: Tue, 20 Mar 2007 14:06:00 -0000 Subject: GCC cross from ia64 to hppa-hpux Message-ID: <18597F2B47F1394A9B309945EC724112D0B85C@servex01.wamas.com> Andrew Haley wrote: > Duft Markus writes: > > Andrew Haley <> wrote: > > > Duft Markus writes: > > > > > > > I'm currently looking into building a cross-compiler which > runs on > > > ia64-hp-hpux11.23 and targets hppa2.0w-hp-hpux11.11. > Has there been > > > anything like it? > > > > > > > > Currently i don't even get binutils built, so any help would > be > > really > cool. > > > > > > Well, obviously you'll need a full set of target libraries and > > > cross-target binutils. Beyond that, I'm, not aware of any > special > > problems. Just configure and go. > > > > OK, i have the libraries, but is there a binutils how-to > somewhere? I > built cross-binutils for solaris9, solaris10 and > linux, but HP PA HP-UX > is somehow a problem..... *arg* > > Everything to do with cross-HPUX always seems to be a problem. :-) > > If you can't figure out how to get binutils built I think you'll just > have to ask the binutils list. It's certainly way off-topic here. While waiting for the mailing-list subscription @ binutils i compiled them through ;o) just copied one header to my local sources, and it worked ... *arg* hack, hack... Now gcc allready bootstraps ;o) i hope things go fine, so thanks for the quick help / comment ... For anybody interested: just copy (from the target platform, so hppa-hpux) from /usr/include/machine/reg.h to the binutils source: $src/bfd/machine/reg.h. the set CFLAGS and CXXFLAGS to include -DHOST_HPPAHPUX and binutils build fine... I have no plan if they actually *work* too ;o// Cheers, Markus > > Good luck! > > Andrew. From ranjit_kumar_b4u@yahoo.co.uk Tue Mar 20 14:43:00 2007 From: ranjit_kumar_b4u@yahoo.co.uk (ranjith kumar) Date: Tue, 20 Mar 2007 14:43:00 -0000 Subject: version of gcc and auto-vectorization Message-ID: <20070320140613.70794.qmail@web27405.mail.ukl.yahoo.com> 1) In my P.C. gcc version 4.1.2 has been installed. I have a look at http://gcc.gnu.org/. In that it is said that 4.1.2 is the "current release series", "Next release series: GCC 4.2.0" and "Active development: GCC 4.3.0" What does it mean? Has gcc 4.2.0/4.3.0 been released??? If so from where can I download 4.2/4.3????? 2)From which version "auto-vectorization" has been included? In http://gcc.gnu.org/projects/tree-ssa/vectorization.html#status4.0 it is said that gcc 4.0 also does "auto-vectorization". Deos it mean auto-vectorization cababilities of gcc4.0 and gcc4.1/4.2 are same?? 3)-ftree-vectorize is the flag that enables autovectorization. isn't it?? 4) where can I get C programs for which gcc can do autovectorization and for which it cant? 4) I know all languages are internallay converted to same representation(in the context of gcc compiler). So what is said in gcc manuals about auto-vectorization is applicable to all languages gcc supports. Isn't it? Thanks in advance. ___________________________________________________________ New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at the Yahoo! Mail Championships. Plus: play games and win prizes. http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk From iant@google.com Tue Mar 20 17:46:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Tue, 20 Mar 2007 17:46:00 -0000 Subject: version of gcc and auto-vectorization In-Reply-To: <20070320140613.70794.qmail@web27405.mail.ukl.yahoo.com> References: <20070320140613.70794.qmail@web27405.mail.ukl.yahoo.com> Message-ID: ranjith kumar writes: > 1) In my P.C. gcc version 4.1.2 has been installed. > I have a look at http://gcc.gnu.org/. > In that it is said that 4.1.2 is the "current > release series", "Next release series: GCC 4.2.0" and > "Active development: GCC 4.3.0" > > What does it mean? Has gcc 4.2.0/4.3.0 been > released??? No. It means that 4.2 is the next release. 4.3 is under active development. > > 2)From which version "auto-vectorization" has been > included? > In > http://gcc.gnu.org/projects/tree-ssa/vectorization.html#status4.0 > it is said that gcc 4.0 also does > "auto-vectorization". > Deos it mean auto-vectorization cababilities of gcc4.0 > and gcc4.1/4.2 are same?? No, it is under active development and is enhanced in each release. > 3)-ftree-vectorize is the flag that enables > autovectorization. isn't it?? Yes. > 4) where can I get C programs for which gcc can do > autovectorization and for which it cant? There are test cases in gcc/testsuite/gcc.dg/vect. > 4) I know all languages are internallay converted to > same representation(in the context of gcc compiler). > So what is said in gcc manuals about > auto-vectorization is applicable to all languages gcc > supports. Isn't it? Yes. But some languages are more amenable to vectorization than others. Ian From ranjit_kumar_b4u@yahoo.co.uk Tue Mar 20 18:54:00 2007 From: ranjit_kumar_b4u@yahoo.co.uk (ranjith kumar) Date: Tue, 20 Mar 2007 18:54:00 -0000 Subject: version of gcc and auto-vectorization In-Reply-To: Message-ID: <20070320174615.21590.qmail@web27401.mail.ukl.yahoo.com> --- Ian Lance Taylor wrote: > ranjith kumar writes: > > > 1) In my P.C. gcc version 4.1.2 has been > installed. > > I have a look at http://gcc.gnu.org/. > > In that it is said that 4.1.2 is the "current > > release series", "Next release series: GCC 4.2.0" > and > > "Active development: GCC 4.3.0" > > > > What does it mean? Has gcc 4.2.0/4.3.0 been > > released??? > > No. It means that 4.2 is the next release. 4.3 is > under active > development. > > > > 2)From which version "auto-vectorization" has been > > included? > > In > > > http://gcc.gnu.org/projects/tree-ssa/vectorization.html#status4.0 > > it is said that gcc 4.0 also does > > "auto-vectorization". > > Deos it mean auto-vectorization cababilities of > gcc4.0 > > and gcc4.1/4.2 are same?? > > No, it is under active development and is enhanced > in each release. > > > 3)-ftree-vectorize is the flag that enables > > autovectorization. isn't it?? > > Yes. > > > 4) where can I get C programs for which gcc can do > > autovectorization and for which it cant? > > There are test cases in gcc/testsuite/gcc.dg/vect. What does auto-vectorization mean?? I think it must be converting 'for' loops which does not exploit SIMD features of a processor(say Pentium 4) to 'for' loops which exploit SIMD features(of course, it could be at any intermediate representation). I have taken vect-40.c in that directory and compiled as "gcc -march=pentium4 -S -O3 -ftree-vectorize vect-40.c". I looked at the assembly code. No MMX/SSE/SSE2 instructions were there. (I have gcc-4.1.2 installed in my P.C. and my processor is Pentium4.) What can gcc do? Can it produce MMX/SSE/SSE2 instructions even if the source file(.c) does not use any functions defined in mmintrin.h/xmmintrin.h/emmintrin.h???? If so, did I miss any other option while compiling? Thanks in advance. > > > 4) I know all languages are internallay converted > to > > same representation(in the context of gcc > compiler). > > So what is said in gcc manuals about > > auto-vectorization is applicable to all languages > gcc > > supports. Isn't it? > > Yes. But some languages are more amenable to > vectorization than > others. > > Ian > ___________________________________________________________ Now you can scan emails quickly with a reading pane. Get the new Yahoo! Mail. http://uk.docs.yahoo.com/nowyoucan.html From feradz@gmail.com Tue Mar 20 19:37:00 2007 From: feradz@gmail.com (Ferad Zyulkyarov) Date: Tue, 20 Mar 2007 19:37:00 -0000 Subject: The g++ -fconserve-space flag Message-ID: Hi, I want to port an application written in C into C++. When compiling the code with the C compiler (gcc) some of the variables are compiled as common symbols that the linker treats without problems. But when I compile the code with g++ these common symbols are put in BSS section and at link time, the linker reports for multiple definitions of the same variable in different object files. Before writing here, I looked for some solution and as I understand the -fconserve-space flag is supposed to solve my problem. There is another posting in the mail grup that relates to -fconserve-space flag that it doesn't have any effect (http://gcc.gnu.org/ml/gcc-help/2004-08/threads.html#00008). The suggested solutions are to define the variables that cause the problem as either static or extern. Static definition changes the logic/semantics of the application, whereas the extern declaration will involve a lot of code refactoring :( I would welcome all the comments that would save me the huge burden of code rewriting. Thanks, Ferad -- Ferad Zyulkyarov Barcelona Supercomputing Center From iant@google.com Tue Mar 20 20:15:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Tue, 20 Mar 2007 20:15:00 -0000 Subject: version of gcc and auto-vectorization In-Reply-To: <20070320174615.21590.qmail@web27401.mail.ukl.yahoo.com> References: <20070320174615.21590.qmail@web27401.mail.ukl.yahoo.com> Message-ID: ranjith kumar writes: > What does auto-vectorization mean?? > I think it must be converting 'for' loops which does > not exploit SIMD features of a processor(say Pentium > 4) to 'for' loops which exploit SIMD features(of > course, it could be at any intermediate > representation). Yes, that is what it means. > I have taken vect-40.c in that directory and compiled > as "gcc -march=pentium4 -S -O3 -ftree-vectorize > vect-40.c". I looked at the assembly code. No > MMX/SSE/SSE2 instructions were there. > (I have gcc-4.1.2 installed in my P.C. and my > processor is Pentium4.) > > What can gcc do? Can it produce MMX/SSE/SSE2 > instructions even if the source file(.c) does not use > any functions defined in > mmintrin.h/xmmintrin.h/emmintrin.h???? Yes, it can. Here is an example which vectorizes for me with gcc 4.1.2 with -O2 -ftree-vectorize -std=c99 -march=pentium4 void foo (int n, int * restrict c, const int * restrict a, const int * restrict b) { int i; for (i = 0; i < n; ++i) c[i] = a[i] + b[i]; } Ian From eljay@adobe.com Tue Mar 20 21:05:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Tue, 20 Mar 2007 21:05:00 -0000 Subject: The g++ -fconserve-space flag In-Reply-To: Message-ID: Hi Ferad, Sounds like you have header files that are defining symbols, when what you want is for the header files to declare them (not define them). Take a look at Stroustrup's C++ Programming Language (special edition, or third edition) section B.2.2 "C Code That Is Not C++". This is valid C, but not valid C++: int foo; int foo; In C, only one foo is defined. In C++, the second foo causes an error in the translation unit. (And if the int foo is in different translation units, it causes an error at link time. Violation of ODR.) In C++, you may need to do this in your header files: extern int foo; // Declaration, not a definition. HTH, --Eljay From feradz@gmail.com Wed Mar 21 04:14:00 2007 From: feradz@gmail.com (Ferad Zyulkyarov) Date: Wed, 21 Mar 2007 04:14:00 -0000 Subject: The g++ -fconserve-space flag In-Reply-To: References: Message-ID: Thanks John, Your answer helped me to understand what the actual problem is. On 3/20/07, John Love-Jensen wrote: > Hi Ferad, > > Sounds like you have header files that are defining symbols, when what you > want is for the header files to declare them (not define them). > > Take a look at Stroustrup's C++ Programming Language (special edition, or > third edition) section B.2.2 "C Code That Is Not C++". > > This is valid C, but not valid C++: > int foo; > int foo; > > In C, only one foo is defined. > > In C++, the second foo causes an error in the translation unit. (And if the > int foo is in different translation units, it causes an error at link time. > Violation of ODR.) > > In C++, you may need to do this in your header files: > > extern int foo; // Declaration, not a definition. > > HTH, > --Eljay > > -- Ferad Zyulkyarov Barcelona Supercomputing Center From olecom@flower.upol.cz Wed Mar 21 06:57:00 2007 From: olecom@flower.upol.cz (Oleg Verych) Date: Wed, 21 Mar 2007 06:57:00 -0000 Subject: Optimisation puzzle In-Reply-To: <45FA852C.1090904@home.se> References: <45FA852C.1090904@home.se> Message-ID: > From: Erik > Newsgroups: gmane.comp.gcc.help > Subject: Re: Optimisation puzzle > Date: Fri, 16 Mar 2007 12:53:16 +0100 [] > I tried with the following program: void q(const unsigned int); void > f() {for (unsigned int x = 0; x != 10; x++) q(77);} > > and built it with "gcc -std=c99 -Os -Wall -Wextra -Werror -S": > .L2: > subl $12, %esp > incl %ebx > pushl $77 > call q > addl $16, %esp > cmpl $10, %ebx > jne .L2 > > As you can see, "pushl $77" is still inside the loop even though q > promises to not change its argument. This must be a bug. Maybe this somehow linked to the fact, that parameter by value are always copied and there's no way for caller to know about what happened to that *copy*. E.g. "void q(const unsigned int b);" means b is read-only inside q, but any caller sets up b for q, i.e it create/change it. Anyways this can be optimized. And i think, gdb will be ok with such code. That isn't working program, you've tested, is it? I tried working one, but it was little bit hard to get non-unrolled loop. See even one more instruction, that seems to be useless, unless it somehow speeds-up register access (or any other CPU's magic). Of course things are completely different with q being static. AMD64 code: ..globl q .type q, @function q: _mtune=k8_ q: _mtune=nocona_ ..LFB2: .LFB2: mov %edi, %edi *NOTE* movsd a(%rip), %xmm1 movlpd a(%rip), %xmm1 mov %edi, %edi *NOTE* cvtsi2sdq %rdi, %xmm0 cvtsi2sdq %rdi, %xmm0 sqrtsd %xmm0, %xmm0 sqrtsd %xmm0, %xmm0 addsd %xmm0, %xmm1 addsd %xmm0, %xmm1 movsd %xmm1, a(%rip) movsd %xmm1, a(%rip) ret ret ..LFE2: .LFE2: .size q, .-q ..globl f .type f, @function f: ..LFB3: pushq %rbx ..LCFI0: movl %edi, %ebx ..L7: movl $77, %edi movl $77, %edi .L7_OPERFORMANCE: call q call q decl %ebx decl %ebx jne .L7 jne .L7_OPERFORMANCE popq %rbx ret ..LFE3: .size f, .-f Code is: #include static double a; void q(const unsigned int b) { a += sqrt(b); } void f(int c) { do { q(77); } while (--c); } int main(int argc, char *argv[]) { f(argc); return 0; } Kind regards. _____ From wesley.hoke@gmail.com Wed Mar 21 07:26:00 2007 From: wesley.hoke@gmail.com (Wesley Smith) Date: Wed, 21 Mar 2007 07:26:00 -0000 Subject: Function overloading Message-ID: <1079b050703202357v2d72149fl3c03c305995202bf@mail.gmail.com> I have a question about function overloading. I'm getting alot of errors when I do the following class A { void draw(); }; class B : public A { static int draw(lua_State *L); static B * get(lua_State *L, int i); } //bad int B :: draw(lua_State *L) { B *b = get(L, 1); b->draw() //<--- produces error because it things I'm calling the static B function } //good int B :: draw(lua_State *L) { B *b = get(L, 1); b->A::draw() //<--- no errors } Shouldn't the compiler understand that I'm actually calling the superclass' draw method, especially since the class' draw method is static and I'm calling it as an instance method? thanks, wes From wesley.hoke@gmail.com Wed Mar 21 10:38:00 2007 From: wesley.hoke@gmail.com (Wesley Smith) Date: Wed, 21 Mar 2007 10:38:00 -0000 Subject: Function overloading In-Reply-To: <32380a010703210019o70bfe7d4ge45ced3c3838f412@mail.gmail.com> References: <1079b050703202357v2d72149fl3c03c305995202bf@mail.gmail.com> <32380a010703210019o70bfe7d4ge45ced3c3838f412@mail.gmail.com> Message-ID: <1079b050703210026x25d2ebeehb09fd4c9c047c806@mail.gmail.com> Wow that really clarifies things. Is there an URL for this documentation? Many thanks, wes On 3/21/07, Vadim Doroginin wrote: > On 3/21/07, Wesley Smith wrote: > > I have a question about function overloading. I'm getting alot of > > errors when I do the following > > > > class A > > { > > void draw(); > > }; > > > > > > class B : public A > > { > > static int draw(lua_State *L); > > static B * get(lua_State *L, int i); > > } > > > > //bad > > int B :: draw(lua_State *L) > > { > > B *b = get(L, 1); > > b->draw() //<--- produces error because it things I'm calling > > the static B function > > } > > > > > > //good > > int B :: draw(lua_State *L) > > { > > B *b = get(L, 1); > > b->A::draw() //<--- no errors > > } > > > > > > > > Shouldn't the compiler understand that I'm actually calling the > > superclass' draw method, especially since the class' draw method is > > static and I'm calling it as an instance method? > > > > thanks, > > wes > > > > No. > IS 13.1 says: > Certain function declarations cannot be overloaded: > ? Function declarations that differ only in the return type cannot be > overloaded. > ? Member function declarations with the same name and the same > parameter types cannot be overloaded if any of them is a static member > function declaration (9.4). Likewise, member function template > declarations with the same name, the same parameter types, and the > same template parameter lists cannot be overloaded if any of them is a > static member function template declaration. The types of the implicit > object parameters constructed for the member functions for the purpose > of overload resolution (13.3.1) are not considered when comparing > parameter types for enforcement of this rule. In contrast, if there is > no static member function declaration among a set of member function > declarations with the same name and the same parameter types, then > these member function declarations can be overloaded if they differ in > the type of their implicit object parameter. [Example: the following > illustrates this distinction: > class X { > static void f(); > void f(); // ill-formed > void f() const; // ill-formed > void f() const volatile; // ill-formed > void g(); > void g() const; // OK: no static g > void g() const volatile; // OK: no static g > }; > ?end example] > From aph@redhat.com Wed Mar 21 11:57:00 2007 From: aph@redhat.com (Andrew Haley) Date: Wed, 21 Mar 2007 11:57:00 -0000 Subject: Function overloading In-Reply-To: <1079b050703210026x25d2ebeehb09fd4c9c047c806@mail.gmail.com> References: <1079b050703202357v2d72149fl3c03c305995202bf@mail.gmail.com> <32380a010703210019o70bfe7d4ge45ced3c3838f412@mail.gmail.com> <1079b050703210026x25d2ebeehb09fd4c9c047c806@mail.gmail.com> Message-ID: <17921.2818.33778.386620@zebedee.pink> Wesley Smith writes: > Wow that really clarifies things. Is there an URL for this > documentation? http://www.open-std.org/jtc1/sc22/wg21/ Andrew. From s.kruizinga@hccnet.nl Wed Mar 21 12:21:00 2007 From: s.kruizinga@hccnet.nl (Seijo Kruizinga) Date: Wed, 21 Mar 2007 12:21:00 -0000 Subject: gfortran Message-ID: <001301c76bb0$1f002db0$0100000a@kruizinga> L.S. I recently downloaded the latest version of gfortran (4.3.0). In general it works very well. I met, however, a curious problem. When I tried to open a file twice with different unit-numbers I got an error message during running. (I try to read the files synchron with a records spacing). In f77 this was allowed. I can imagine some problems if you use then read/write. But even with status'='OLD' it was refused. I use it under Suse 10.0. Thanks for your help, Seijo Kruizinga From r.atwood@imperial.ac.uk Wed Mar 21 12:26:00 2007 From: r.atwood@imperial.ac.uk (Atwood, Robert C) Date: Wed, 21 Mar 2007 12:26:00 -0000 Subject: Function overloading In-Reply-To: <1079b050703210026x25d2ebeehb09fd4c9c047c806@mail.gmail.com> Message-ID: <2CB39EAF0E0EFF498ADEDA636B8C999F04C39621@icex1.ic.ac.uk> That does not make sense to me, in the original example the function is not what I would call 'overloaded', as I understand a function in a derived class is not in the same scope as a function in a base class, so a function with the same name _hides_ the function from the base class rather than overloading it, resulting in the behaviour observed by the original poster. I don't see how the prohibition of overloading a static function with the same parameter types applies to hiding a function with _different_ parameter types? Happy to be corrected if I'm wrong, Robert > -----Original Message----- > From: gcc-help-owner@gcc.gnu.org > [mailto:gcc-help-owner@gcc.gnu.org] On Behalf Of Wesley Smith > Sent: 21 March 2007 07:26 > To: gcc-help@gcc.gnu.org > Subject: Re: Function overloading > > Wow that really clarifies things. Is there an URL for this > documentation? > Many thanks, > wes > > On 3/21/07, Vadim Doroginin wrote: > > On 3/21/07, Wesley Smith wrote: > > > I have a question about function overloading. I'm getting alot of > > > errors when I do the following > > > > > > class A > > > { > > > void draw(); > > > }; > > > > > > > > > class B : public A > > > { > > > static int draw(lua_State *L); > > > static B * get(lua_State *L, int i); > > > } > > > > > > //bad > > > int B :: draw(lua_State *L) > > > { > > > B *b = get(L, 1); > > > b->draw() //<--- produces error because it things > I'm calling > > > the static B function > > > } > > > > > > > > > //good > > > int B :: draw(lua_State *L) > > > { > > > B *b = get(L, 1); > > > b->A::draw() //<--- no errors > > > } > > > > > > > > > > > > Shouldn't the compiler understand that I'm actually calling the > > > superclass' draw method, especially since the class' draw > method is > > > static and I'm calling it as an instance method? > > > > > > thanks, > > > wes > > > > > > > No. > > IS 13.1 says: > > Certain function declarations cannot be overloaded: > > - Function declarations that differ only in the return type > cannot be > > overloaded. > > - Member function declarations with the same name and the same > > parameter types cannot be overloaded if any of them is a > static member > > function declaration (9.4). Likewise, member function template > > declarations with the same name, the same parameter types, and the > > same template parameter lists cannot be overloaded if any > of them is a > > static member function template declaration. The types of > the implicit > > object parameters constructed for the member functions for > the purpose > > of overload resolution (13.3.1) are not considered when comparing > > parameter types for enforcement of this rule. In contrast, > if there is > > no static member function declaration among a set of member function > > declarations with the same name and the same parameter types, then > > these member function declarations can be overloaded if > they differ in > > the type of their implicit object parameter. [Example: the following > > illustrates this distinction: > > class X { > > static void f(); > > void f(); // ill-formed > > void f() const; // ill-formed > > void f() const volatile; // ill-formed > > void g(); > > void g() const; // OK: no static g > > void g() const volatile; // OK: no static g > > }; > > -end example] > > > From f.p.boomstra@gmail.com Wed Mar 21 12:35:00 2007 From: f.p.boomstra@gmail.com (Feike Boomstra) Date: Wed, 21 Mar 2007 12:35:00 -0000 Subject: _bit_scan_forward Message-ID: <8d55a8b20703210526g2a449f38g7eec3314bf10fe79@mail.gmail.com> I am new to Linux, I am using Kubuntu (AMD64) with KDevelop. I try to migrate a VC++ project to Linux. I am having problems with the built-in function _Bit_scan_forward. 1) I can't find a headerfile defining this function. 2) If I define it myself, I get a link error: unresolved reference please help Feike Boomstra From Thimo.Neubauer@cst.com Wed Mar 21 13:59:00 2007 From: Thimo.Neubauer@cst.com (Thimo.Neubauer@cst.com) Date: Wed, 21 Mar 2007 13:59:00 -0000 Subject: How do I deprecate a class? Message-ID: <4EC819A95B.05783D5CTFSNAUJM@cst.com> Hi! I'd like to mark a class as deprecated, i.e. any instantiation or method call should be warned. After reading http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Type-Attributes.html#Type-Attributes I concluded that class Foo { public: void bar(int x); } __attribute__ ((deprecated)); should do the trick. However int main() { Foo f; return 0; }; only warns about the (obviously) unused variable but nothing else: beachboys++ /tmp> make g++ -Wall foo.cc -o foo foo.cc: In function ?int main()?: foo.cc:11: warning: unused variable ?f? beachboys++ /tmp> g++ --version g++ (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Same effect with gcc 3.3 and 3.4. However a typedef Foo Quux __attribute__ ((deprecated)); with int main() { Quux f; return 0; }; does what I expected: foo.cc: In function `int main()': foo.cc:11: warning: `Quux' is deprecated (declared at foo.cc:8) foo.cc:11: warning: unused variable `Quux f' Did I understand anything wrong? Or is this a bug/feature? :-) Please CC me on reply, I'm not subscribed to gcc-help. Cheers Thimo From segher@kernel.crashing.org Wed Mar 21 14:30:00 2007 From: segher@kernel.crashing.org (Segher Boessenkool) Date: Wed, 21 Mar 2007 14:30:00 -0000 Subject: version of gcc and auto-vectorization In-Reply-To: <20070320174615.21590.qmail@web27401.mail.ukl.yahoo.com> References: <20070320174615.21590.qmail@web27401.mail.ukl.yahoo.com> Message-ID: > What does auto-vectorization mean?? > I think it must be converting 'for' loops which does > not exploit SIMD features of a processor(say Pentium > 4) to 'for' loops which exploit SIMD features(of > course, it could be at any intermediate > representation). While (indexed) loops are the most obvious case, auto vectorisation actually applies to *any* code. Loops are easier to do than generic code, and you get a better gain from them, so that's where all the action is ;-) Segher From iant@google.com Wed Mar 21 14:38:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Wed, 21 Mar 2007 14:38:00 -0000 Subject: _bit_scan_forward In-Reply-To: <8d55a8b20703210526g2a449f38g7eec3314bf10fe79@mail.gmail.com> References: <8d55a8b20703210526g2a449f38g7eec3314bf10fe79@mail.gmail.com> Message-ID: "Feike Boomstra" writes: > I am new to Linux, I am using Kubuntu (AMD64) with KDevelop. I try to > migrate a VC++ project to Linux. I am having problems with the > built-in function _Bit_scan_forward. > > 1) I can't find a headerfile defining this function. > 2) If I define it myself, I get a link error: unresolved reference If that function does what I think it does, then the Unix equivalent would be ffs. If that is the right answer, then this is not a gcc question, it is a Windows to Unix porting question. This is probably not the best mailing list to ask such questions, as we are unlikely to know the answer. Ian From iant@google.com Wed Mar 21 15:34:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Wed, 21 Mar 2007 15:34:00 -0000 Subject: How do I deprecate a class? In-Reply-To: <4EC819A95B.05783D5CTFSNAUJM@cst.com> References: <4EC819A95B.05783D5CTFSNAUJM@cst.com> Message-ID: Thimo.Neubauer@cst.com writes: > I concluded that > > class Foo { > public: > void bar(int x); > } __attribute__ ((deprecated)); > > should do the trick. However > > int main() { > Foo f; > > return 0; > }; > > only warns about the (obviously) unused variable but nothing else: Looks like a bug to me. And it's been filed already: http://gcc.gnu.org/PR16370 Interestingly, I do get a warning for this: struct Foo { int i; } __attribute__ ((deprecated)); void foo() { struct Foo f; } It matters whether I use "struct" or not. Which is bizarre. Ian From loudons@hotmail.com Wed Mar 21 17:53:00 2007 From: loudons@hotmail.com (steve_loudon) Date: Wed, 21 Mar 2007 17:53:00 -0000 Subject: Trouble Compiling GCC Message-ID: <9596458.post@talk.nabble.com> I am trying to recreate the binaries for a arm cross compiler (gcc-3.2.3) that I have on another machine. I am currently running Ubuntu 6.10 with the latest stable version of gcc installed (gcc-4.1.2). I have not built gcc before, so I thought that the easiest thing to do first is to just recompile version 4.1.2. I got the source, ran configure and make. It ended in error. I used the following configure options: ../src/gcc-4.1.2/configure --prefix=/home/loudon --disable-werror --enable-languages=c and the make bootstrap command ended with the following error: /home/loudon/gcc-build/./gcc/xgcc -B/home/loudon/gcc-build/./gcc/ -B/home/loudon/i686-pc-linux-gnu/bin/ -B/home/loudon/i686-pc-linux-gnu/lib/ -isystem /home/loudon/i686-pc-linux-gnu/include -isystem /home/loudon/i686-pc-linux-gnu/sys-include -O2 -O2 -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -I. -I. -I../../src/gcc-4.1.2/gcc -I../../src/gcc-4.1.2/gcc/. -I../../src/gcc-4.1.2/gcc/../include -I../../src/gcc-4.1.2/gcc/../libcpp/include -fexceptions -fvisibility=hidden -DHIDE_EXPORTS -c ../../src/gcc-4.1.2/gcc/unwind-dw2.c -o libgcc/./unwind-dw2.o In file included from ../../src/gcc-4.1.2/gcc/unwind-dw2.c:256: ../../src/gcc-4.1.2/gcc/config/i386/linux-unwind.h: In function ?x86_fallback_frame_state?: ../../src/gcc-4.1.2/gcc/config/i386/linux-unwind.h:152: error: ?struct sigcontext? has no member named ?esp? ../../src/gcc-4.1.2/gcc/config/i386/linux-unwind.h:159: error: ?struct sigcontext? has no member named ?eax? ../../src/gcc-4.1.2/gcc/config/i386/linux-unwind.h:161: error: ?struct sigcontext? has no member named ?ebx? ../../src/gcc-4.1.2/gcc/config/i386/linux-unwind.h:163: error: ?struct sigcontext? has no member named ?ecx? ../../src/gcc-4.1.2/gcc/config/i386/linux-unwind.h:165: error: ?struct sigcontext? has no member named ?edx? ../../src/gcc-4.1.2/gcc/config/i386/linux-unwind.h:167: error: ?struct sigcontext? has no member named ?esi? ../../src/gcc-4.1.2/gcc/config/i386/linux-unwind.h:169: error: ?struct sigcontext? has no member named ?edi? ../../src/gcc-4.1.2/gcc/config/i386/linux-unwind.h:171: error: ?struct sigcontext? has no member named ?ebp? ../../src/gcc-4.1.2/gcc/config/i386/linux-unwind.h:173: error: ?struct sigcontext? has no member named ?eip? make[4]: *** [libgcc/./unwind-dw2.o] Error 1 make[4]: Leaving directory `/home/loudon/gcc-build/gcc' make[3]: *** [libgcc.a] Error 2 make[3]: Leaving directory `/home/loudon/gcc-build/gcc' make[2]: *** [all-stage1-gcc] Error 2 make[2]: Leaving directory `/home/loudon/gcc-build' make[1]: *** [stage1-bubble] Error 2 make[1]: Leaving directory `/home/loudon/gcc-build' make: *** [all] Error 2 Don't know where to go from here. When I looked through the .h files that should have defined sigcontext, the structure members should be defined. Thanks for any suggestions, Steve -- View this message in context: http://www.nabble.com/Trouble-Compiling-GCC-tf3441530.html#a9596458 Sent from the gcc - Help mailing list archive at Nabble.com. From essu_n21@yahoo.co.in Wed Mar 21 18:16:00 2007 From: essu_n21@yahoo.co.in (Eswari Natrajan) Date: Wed, 21 Mar 2007 18:16:00 -0000 Subject: how to execute c script file Message-ID: <277087.69264.qm@web8914.mail.in.yahoo.com> Hi, I am using Linux and installed GCC in my PC. I want to compile C script file. Can u tell me steps to execute? Thanking you __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/ From stangmechanic@gmail.com Wed Mar 21 18:44:00 2007 From: stangmechanic@gmail.com (Blake Huff) Date: Wed, 21 Mar 2007 18:44:00 -0000 Subject: Nested functions with GCC in OS X Message-ID: <48C6BF09-DF77-44E3-AC85-A19A6ABCEF3E@gmail.com> Hi All: Hopefully this is the right list for this question. Does anyone have any experience building nested functions into dynamically linked library files (.so) on Mac OS X 10.4.9, with gcc 4.0.1. I am confused on several points by this. Here's an example of the problem with the associated errors: gcc -dynamiclib calc_mean.c -o libmean.so -fnested-functions /usr/bin/libtool: unknown option character `l' in: -allow_stack_execute Usage: /usr/bin/libtool -static [-] file [...] [-filelist listfile [,dirname]] [-arch_only arch] [-sacLT] Usage: /usr/bin/libtool -dynamic [-] file [...] [-filelist listfile [,dirname]] [-arch_only arch] [-o output] [-install_name name] [- compatibility_version #] [-current_version #] [-seg1addr 0x#] [- segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table ] [-seg_addr_table_filename ] [-all_load] [-noall_load] Obviously libtool doesn't know what -allow_stack_execute is because - allow_stack_execute is an option for ld, not libtool. Any ideas how to get the right flag from the compiler to ld? In another project with nested functions, the '-fnested-functions' is never specified during the compile process, yet at runtime the program fails with an error message: /usr/bin/ld: -allow_stack_execute can only be used when output file type is MH_EXECUTE collect2: ld returned 1 exit status This is unusual, because neither '-fnested-functions' nor '- allow_stack_execute' were specified. I'm assuming that ld is sensing the need for an executable stack, and producing an error because their isn't one. This error seems to indicate to me that you cannot have nested functions inside a dynamically linked library, as such a library will never have the type of MH_EXECUTE. Does anyone have any experience with nested functions, ideas about what's going on? Thanks in advance for any suggestions. "Hats and mittens you kittens!" Blake Huff stangmechanic@gmail.com From eljay@adobe.com Wed Mar 21 21:41:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Wed, 21 Mar 2007 21:41:00 -0000 Subject: how to execute c script file In-Reply-To: <277087.69264.qm@web8914.mail.in.yahoo.com> Message-ID: Hi Eswari, Assuming your C source code is called Foo.c and you want the executable to be called Foo, you'd do this: gcc -o Foo Foo.c To run the program Foo, you'd do this from the directory it was compile/linked in: ./Foo HTH, --Eljay From karel.miklav@siol.net Thu Mar 22 03:15:00 2007 From: karel.miklav@siol.net (Karel Miklav) Date: Thu, 22 Mar 2007 03:15:00 -0000 Subject: Minimizing a bootstrap compiler Message-ID: <4601A68F.1050406@siol.net> I've made a bootstrap compiler for GNAT-GCC Ada compiler from GCC 4.1. The resulting package is around 11 Mb. I tried to cut some Mb's off, by extracting files not used during bootstrap. The result of this shaky method gave a package of 8 Mb. Is there another way I can strip something off? -- Regards, Karel miklav From bdavis9659@sbcglobal.net Thu Mar 22 10:01:00 2007 From: bdavis9659@sbcglobal.net (Bud Davis) Date: Thu, 22 Mar 2007 10:01:00 -0000 Subject: gfortran In-Reply-To: <001301c76bb0$1f002db0$0100000a@kruizinga> Message-ID: <162234.69774.qm@web81213.mail.mud.yahoo.com> --- Seijo Kruizinga wrote: > L.S. > > I recently downloaded the latest version of gfortran > (4.3.0). In general it > works very well. I met, however, a curious problem. > When I tried to open a > file twice with different unit-numbers I got an > error message during > running. (I try to read the files synchron with a > records spacing). In f77 > this was allowed. I can imagine some problems if you > use then read/write. > But even with status'='OLD' it was refused. I use it > under Suse 10.0. > > Thanks for your help, > > Seijo Kruizinga > > is this an example of your problem: $ cat b.f open(unit=20,file='b.f') open(unit=30,file='b.f') print*,'ok' end $ g77 b.f $ ./a.out ok $ gfortran -static b.f $ ./a.out At line 2 of file b.f Fortran runtime error: File already opened in another unit --bud From brendon@christian.net Thu Mar 22 11:22:00 2007 From: brendon@christian.net (Brendon Costa) Date: Thu, 22 Mar 2007 11:22:00 -0000 Subject: Two versions of GCC Message-ID: <460253D0.3050205@christian.net> Hi All, I have installed on my system two different versions of GCC. I am finding that while compiling + linking an autotools based example project using the "new" GCC version, it seems to compile using the headers for libstdc++ (new version) but tries to link with the libstdc++ (old version). See end for example linker command line that looks correct to me... The two versions of GCC are: One that comes with NetBSD: Version: 3.3.3 Prefix: /usr And one i have been modifying as part of a C++ exception source analysis tool i am writing: Version: 4.0.1 (patched with my modifications) Prefix: /home/bcosta/build/install/edoc_gcc Now the problem i have is that i get undefined symbols while linking when i compile trying to use the modified GCC. The undefined symbols belong to libstdc++ and exist in the 4.0.1 GCC version of libstdc++ but those symbols do NOT exist in the 3.3.3 GCC version of libstdc++ So for some reason i assume it is linking using the /usr/lib/libstdc++.so file instead of the /home/bcosta/build/install/edoc_gcc/lib/libstdc++.so In order to setup my environment to use the modified GCC (4.0.1) i do the following: export LD_LIBRARY_PATH="/home/bcosta/build/install/edoc_gcc/lib:$LD_LIBRARY_PATH" export PATH="/home/bcosta/build/install/edoc_gcc/bin:$PATH" Is there something else i should be doing in order to set my build environment to use the new GCC version (without un-installing the old one)? Thanks, Brendon. The link errors i get look like: rm -f .libs/library_user.nm .libs/library_user.nmS .libs/library_user.nmT creating .libs/library_userS.c extracting global C symbols from `../../../src/plugins/myplugin/.libs/myplugin.a' extracting global C symbols from `/home/bcosta/build/example/src/libs/mystatic/.libs/libmystatic.a' extracting global C symbols from `/home/bcosta/build/install/edoc_gcc/lib/libstdc++.a' (cd .libs && gcc -c -fno-builtin "library_userS.c") rm -f .libs/library_userS.c .libs/library_user.nm .libs/library_user.nmS .libs/library_user.nmT g++ -g -O2 -o .libs/library_user library_user-main.o .libs/library_userS.o -L/home/bcosta/build/edoc/gcc-4.0.1/i386-unknown-netbsdelf3.0/libstdc++-v3/src -L/home/bcosta/build/edoc/gcc-4.0.1/i386-unknown-netbsdelf3.0/libstdc++-v3/src/.libs -L/home/bcosta/build/edoc/gcc-4.0.1/gcc ../../../src/plugins/myplugin/.libs/myplugin.a /home/bcosta/build/example/src/libs/mystatic/.libs/libmystatic.a -lm ../../../src/libs/myshared/.libs/libmyshared.so ../../../src/libs/mystatic/.libs/libmystatic.a /home/bcosta/build/install/edoc_gcc/lib/libstdc++.so ../../../libltdl/.libs/libltdlc.a -Wl,--rpath -Wl,/home/bcosta/build/install_example/lib -Wl,--rpath -Wl,/home/bcosta/build/install/edoc_gcc/lib .libs/library_userS.o(.rodata+0x8414): undefined reference to `__gnu_internal::palloc_init_mutex' .libs/library_userS.o(.rodata+0x841c): undefined reference to `__gnu_cxx::__pool_alloc_base::_S_end_free' .libs/library_userS.o(.rodata+0x842c): undefined reference to `__gnu_cxx::__pool_alloc_base::_S_free_list' .libs/library_userS.o(.rodata+0x8434): undefined reference to `__gnu_cxx::__pool_alloc_base::_S_heap_size' .libs/library_userS.o(.rodata+0x843c): undefined reference to `__gnu_cxx::__pool_alloc_base::_S_start_free' .libs/library_userS.o(.rodata+0x844c): undefined reference to `__gnu_cxx::__pool_alloc_base::_M_allocate_chunk(unsigned int, int&)' ... From sumit.jain@nokia.com Thu Mar 22 11:32:00 2007 From: sumit.jain@nokia.com (sumit.jain@nokia.com) Date: Thu, 22 Mar 2007 11:32:00 -0000 Subject: Help with gcc Message-ID: <12C8F1FF38CEC643BCFF624810AB986F4E00AB@siebe101.NOE.Nokia.com> Hi, I have some query regarding the way gcc resolves the search directory for standard libraries like libc. When I run command "gcc -v test.c" i get the following output Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux Thread model: posix gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/cc1 -lang-c -v -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=2 -D__GXX_ABI_VERSION=102 -D__ELF__ -Dunix -D__gnu_linux__ -Dlinux -D__ELF__ -D__unix__ -D__gnu_linux__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i386__ test.c -quiet -dumpbase test.c -version -o /tmp/ccAc9Ljz.s GNU CPP version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) (cpplib) (i386 Linux/ELF) GNU C version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) (i386-redhat-linux) compiled by GNU C version 3.2.2 20030222 (Red Hat Linux 3.2.2-5). ignoring nonexistent directory "/usr/i386-redhat-linux/include" #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include /usr/include End of search list. as -V -Qy -o /tmp/cc8Ge9kX.o /tmp/ccAc9Ljz.s GNU assembler version 2.13.90.0.18 (i386-redhat-linux) using BFD version 2.13.90.0.18 20030206 /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/collect2 --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../crt1.o /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../crti.o /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/crtbegin.o -L/usr/lib/gcc-lib/i386-redhat-linux/3.2.2 -L/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../.. /tmp/cc8Ge9kX.o -lgcc -lgcc_eh -lc -lgcc -lgcc_eh /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/crtend.o /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../crtn.o As the last section of the output illustrated that the location that the linker looks for libraries like libc etc is "-L/usr/lib/gcc-lib/i386-redhat-linux/3.2.2" and "-L/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../.." Is there anyway i can change the default search location. I believe that by passing my own spec file to gcc as gcc -specs= test.c, i can change the default include path and also the path to look for for crt0.o etc. Regards, Sumit Kumar Jain From aph@redhat.com Thu Mar 22 12:05:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 22 Mar 2007 12:05:00 -0000 Subject: Help with gcc In-Reply-To: <12C8F1FF38CEC643BCFF624810AB986F4E00AB@siebe101.NOE.Nokia.com> References: <12C8F1FF38CEC643BCFF624810AB986F4E00AB@siebe101.NOE.Nokia.com> Message-ID: <17922.26802.216433.101943@zebedee.pink> sumit.jain@nokia.com writes: > > I have some query regarding the way gcc resolves the search directory > for standard libraries like libc. When I run command "gcc -v test.c" i > get the following output > As the last section of the output illustrated that the location that the > linker looks for libraries like libc etc is > "-L/usr/lib/gcc-lib/i386-redhat-linux/3.2.2" and > "-L/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../.." > Is there anyway i can change the default search location. > > I believe that by passing my own spec file to gcc as gcc > -specs= test.c, i can change the default include path and also > the path to look for for crt0.o etc. OK, so you believe this. So what happened when you tried it? IMO, that's the wrong way to do it. If you *really* need to use nonstandard paths we provide args like -Isystem and -nostdlib. But generally gcc is configured for a particular target environment and things will go wrong if you try to change things under its feet. If the libraries and include paths are very similar, you might get way with it. Andrew. From f.p.boomstra@gmail.com Thu Mar 22 12:51:00 2007 From: f.p.boomstra@gmail.com (Feike Boomstra) Date: Thu, 22 Mar 2007 12:51:00 -0000 Subject: _bit_scan_forward In-Reply-To: References: <8d55a8b20703210526g2a449f38g7eec3314bf10fe79@mail.gmail.com> Message-ID: <8d55a8b20703220505v61219077y9c8006f14e2bc047@mail.gmail.com> Sorry Ian, it is not the right answer. This function is in the libstc++ library, so I supposed I just could use it. I found the library on my system. 21 Mar 2007 07:29:43 -0700, Ian Lance Taylor : > "Feike Boomstra" writes: > > > I am new to Linux, I am using Kubuntu (AMD64) with KDevelop. I try to > > migrate a VC++ project to Linux. I am having problems with the > > built-in function _Bit_scan_forward. > > > > 1) I can't find a headerfile defining this function. > > 2) If I define it myself, I get a link error: unresolved reference > > If that function does what I think it does, then the Unix equivalent > would be ffs. > > If that is the right answer, then this is not a gcc question, it is a > Windows to Unix porting question. This is probably not the best > mailing list to ask such questions, as we are unlikely to know the > answer. > > Ian > From dreams_arpit@yahoo.co.in Thu Mar 22 12:56:00 2007 From: dreams_arpit@yahoo.co.in (arpit jain) Date: Thu, 22 Mar 2007 12:56:00 -0000 Subject: gdb on HP-UX Message-ID: <858395.54517.qm@web8407.mail.in.yahoo.com> Hiiiii Can anyone plz tell me where I can found rpm packages (binaries) for GDB-6.3 and GDB-6.4 for HP-UX 11?? Thanks & Regards Arpit __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/ From aph@redhat.com Thu Mar 22 15:18:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 22 Mar 2007 15:18:00 -0000 Subject: gdb on HP-UX In-Reply-To: <858395.54517.qm@web8407.mail.in.yahoo.com> References: <858395.54517.qm@web8407.mail.in.yahoo.com> Message-ID: <17922.31974.765884.352273@zebedee.pink> arpit jain writes: > Can anyone plz tell me where I can found rpm packages > (binaries) for GDB-6.3 and GDB-6.4 for HP-UX 11?? I'm sure they can, but not on this list. This is for help using gcc. I'd just download gdb from http://sources.redhat.com/gdb/ and install it. Andrew. From dberlin@dberlin.org Thu Mar 22 16:06:00 2007 From: dberlin@dberlin.org (Daniel Berlin) Date: Thu, 22 Mar 2007 16:06:00 -0000 Subject: Is there a way to pretty-print output for templates errors In-Reply-To: References: <1174489576.4073.8.camel@localhost.localdomain> Message-ID: <4aca3dc20703220818l18fcf41eq9a31a5cd6eb74b3f@mail.gmail.com> On 21 Mar 2007 08:17:41 -0700, Ian Lance Taylor wrote: > Stephen Torri writes: > > > I have a hard time reading the template errors I get from GCC. I was > > wondering if there is a flag for the compiler so that instead of getting > > output like below. I know I failed to present this snapshot in a > > preformatted output. This was deliberate to show how hard is to read > > this on a terminal window. > > Question about compiler options are appropriate for the mailing list > gcc-help@gcc.gnu.org, not for gcc@gcc.gnu.org. Thanks. > > Unfortunately there is no such option. > BTW, i think the real readability improvement (besides obviously trying to use magic to make them shorter but understandable) would be had from making it visually clear where the word " to non-scalar type" starts. At least for me, half the time I spend trying to interpret the error is going through the 80 lines it spewed trying to find where the template it's complaining about ends and where the error it's actually complaining about begins. > Some people find the STLFilt program to be helpful: > http://www.bdsoft.com/tools/stlfilt.html > > Ian > From us15@os.inf.tu-dresden.de Thu Mar 22 16:38:00 2007 From: us15@os.inf.tu-dresden.de (Udo A. Steinberg) Date: Thu, 22 Mar 2007 16:38:00 -0000 Subject: Output section of string literal in initializer Message-ID: <20070322170705.09e976c3@laptop.hypervisor.org> Hello, In the example below I would like the string literals "foo", "bar" and "baz" to reside in .mysection. This works when using a pointer variable ptr as shown for "baz". Is there any way to specify the output section of string literals in an initializer (e.g., "foo" and "bar") without using using a pointer variable? I'm looking for something like { "foo" MYSECTION, 1 }. #define MYSECTION __attribute__((section (".mysection"))) char const *const ptr MYSECTION = "baz"; struct { char const *string; unsigned number; } x[] MYSECTION = { { "foo", 1 }, { "bar", 2 }, { ptr, 3 }, }; Cheers, - Udo From ranjit_kumar_b4u@yahoo.co.uk Thu Mar 22 16:46:00 2007 From: ranjit_kumar_b4u@yahoo.co.uk (ranjith kumar) Date: Thu, 22 Mar 2007 16:46:00 -0000 Subject: gcc source code Message-ID: <972742.11283.qm@web27410.mail.ukl.yahoo.com> I want to install gcc 4.1.2. Where can I get source file? I tried to follow some links in gcc.gnu.org. But I could not locate. Thanks in advance. ___________________________________________________________ New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at the Yahoo! Mail Championships. Plus: play games and win prizes. http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk From ranjit_kumar_b4u@yahoo.co.uk Thu Mar 22 16:48:00 2007 From: ranjit_kumar_b4u@yahoo.co.uk (ranjith kumar) Date: Thu, 22 Mar 2007 16:48:00 -0000 Subject: tree-ssa optimizations Message-ID: <864473.59107.qm@web27402.mail.ukl.yahoo.com> 1) I know that auto-vectorization is done on GIMPLE. I think I need to understand entire syntax GIMPLE to understand internal files of gcc which does auto-vectorization like tree-vectorizer.c. Isn't it? 2)Where can I get complete syntax of GIMPLE? 3) Is it possible to compile a .gimple/.ssa/.rtl file? Actually I want to modify above representations of a .c program and compile the modified file. If it is possible tell me how to do? Thanks in advance. ___________________________________________________________ Inbox full of unwanted email? Get leading protection and 1GB storage with All New Yahoo! Mail. http://uk.docs.yahoo.com/nowyoucan.html From iant@google.com Thu Mar 22 16:49:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Thu, 22 Mar 2007 16:49:00 -0000 Subject: _bit_scan_forward In-Reply-To: <8d55a8b20703220505v61219077y9c8006f14e2bc047@mail.gmail.com> References: <8d55a8b20703210526g2a449f38g7eec3314bf10fe79@mail.gmail.com> <8d55a8b20703220505v61219077y9c8006f14e2bc047@mail.gmail.com> Message-ID: "Feike Boomstra" writes: > it is not the right answer. > This function is in the libstc++ library, so I supposed I just could use it. > I found the library on my system. You can't simply call every function you may see in the libstdc++ sources. The library provides a documented stable interface. Ian From eljay@adobe.com Thu Mar 22 17:01:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Thu, 22 Mar 2007 17:01:00 -0000 Subject: gcc source code In-Reply-To: <972742.11283.qm@web27410.mail.ukl.yahoo.com> Message-ID: Hi ranjith, Try this UK mirror: ftp://ftp.mcc.ac.uk/pub/gnu/gcc/gcc-4.1.2/ HTH, --Eljay From aph@redhat.com Thu Mar 22 17:19:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 22 Mar 2007 17:19:00 -0000 Subject: tree-ssa optimizations In-Reply-To: <864473.59107.qm@web27402.mail.ukl.yahoo.com> References: <864473.59107.qm@web27402.mail.ukl.yahoo.com> Message-ID: <17922.46674.998692.167622@zebedee.pink> ranjith kumar writes: > 1) I know that auto-vectorization is done on GIMPLE. > I think I need to understand entire syntax GIMPLE to > understand internal files of gcc which does > auto-vectorization like tree-vectorizer.c. > Isn't it? > 2)Where can I get complete syntax of GIMPLE? gcc/tree.def > 3) Is it possible to compile a .gimple/.ssa/.rtl file? No. > Actually I want to modify above representations of > a .c program and compile the modified file. > If it is possible tell me how to do? It is not possible. Andrew. From ranjit_kumar_b4u@yahoo.co.uk Thu Mar 22 18:22:00 2007 From: ranjit_kumar_b4u@yahoo.co.uk (ranjith kumar) Date: Thu, 22 Mar 2007 18:22:00 -0000 Subject: gcc source code In-Reply-To: Message-ID: <841077.31638.qm@web27404.mail.ukl.yahoo.com> I got the following error. I am in India(I hope this information may help). Would you please send some other link. ******************************************************* ERROR The requested URL could not be retrieved An FTP protocol error occurred while trying to retrieve the URL: ftp://ftp.mcc.ac.uk/pub/gnu/gcc/ Squid sent the following FTP command: Connect to server and then received this reply Your cache administrator is webmaster. Generated Thu, 22 Mar 2007 17:15:10 GMT by netmon.iitb.ac.in (squid/2.6.STABLE11) ****************************************************** --- John Love-Jensen wrote: > Hi ranjith, > > Try this UK mirror: > ftp://ftp.mcc.ac.uk/pub/gnu/gcc/gcc-4.1.2/ > > HTH, > --Eljay > > ___________________________________________________________ The all-new Yahoo! Mail goes wherever you go - free your email address from your Internet provider. http://uk.docs.yahoo.com/nowyoucan.html From monoid@ispras.ru Thu Mar 22 18:51:00 2007 From: monoid@ispras.ru (Alexander Monakov) Date: Thu, 22 Mar 2007 18:51:00 -0000 Subject: Optimizing sequential memory access in loops Message-ID: Hi, I have noticed that in examples like these: void test1(int N, double *a) { int i; for (i=0; i References: <8d55a8b20703210526g2a449f38g7eec3314bf10fe79@mail.gmail.com> <8d55a8b20703220505v61219077y9c8006f14e2bc047@mail.gmail.com> <8d55a8b20703221139t1e05c010xd4f13ad1ee001c0a@mail.gmail.com> Message-ID: "Feike Boomstra" writes: > I didn't get it from the source code. I found it here: > http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespace____gnu__cxx.html > and that looked to me as an interface description. > > The build-in bit_scan_forward function implements the bsf instruction of the > X386 instructionset. It is in the intel c-compiler and the ms c-compiler. This is a reason that I personally don't like doxygen documentation. It isn't clearly separated into interface functions and internal functions. Take my word for it: don't call that function. Now, if you look at the definition of the function, you will see that it is this: inline size_t _Bit_scan_forward(size_t __num) { return static_cast(__builtin_ctzl(__num)); } So how about just calling __builtin_ctzl instead? That is documented here: http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Other-Builtins.html Ian From rattan@cps.cmich.edu Thu Mar 22 19:17:00 2007 From: rattan@cps.cmich.edu (ISHWAR RATTAN) Date: Thu, 22 Mar 2007 19:17:00 -0000 Subject: Strange execution behavior.. Message-ID: I was asked by a colleague about the code given below. I compiles and runs as: 1. No errors on: AMD64 based Solaris-10 (g++: 3.4.3) 2. Buserror on SPARC based Solaris-10 (g++: 3.4.4) after printing the results.. 3. Segmentation fault on Linux (g++: 4.1.2) after printing the results.. Any pointers will be appreciated. -ishwar -------- ///////////////////////////////////////////////////////// // // sptr.cc // // A. Ugur, March 20, 2007 // // to compile: g++ sptr.cc -o sptr // ///////////////////////////////////////////////////////// #include //#include class Node { public: int x, y; // alignment coordinates public: Node(); Node(int i, int j); }; Node::Node() // default constructor { x = -1; y = -1; } Node::Node(int i, int j) // parameterized constructor { x = i; y = j; } template class smartPtr { T* p; public: smartPtr(); smartPtr(T& n); T* operator->(); }; template smartPtr::smartPtr() // default constructor { *p = T(); } template smartPtr::smartPtr(T& n) // parameterized constructor { p = &n; } template T* smartPtr::operator->() // overloaded operator->() { return p; } // function to use smartpointer to Node object void f(smartPtr p, int i, int j) { p->x = i; p->y = j; } // test driver for smartpointer main(int argc, char* argv[]) { Node n1, n2, n3(3, 3); smartPtr p; printf("n1: after constructor: (%d,%d)\n", n1.x, n1.y); printf("n2: after constructor: (%d,%d)\n", n2.x, n2.y); printf("n3: after constructor: (%d,%d)\n", n3.x, n3.y); p = smartPtr(n3); f(p, 5, 5); printf("n3: after f applied: (%d,%d)\n", n3.x, n3.y); } --- From aph@redhat.com Thu Mar 22 19:56:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 22 Mar 2007 19:56:00 -0000 Subject: Strange execution behavior.. In-Reply-To: References: Message-ID: <17922.54833.318885.777259@zebedee.pink> ISHWAR RATTAN writes: > I was asked by a colleague about the code given below. > I compiles and runs as: > 1. No errors on: AMD64 based Solaris-10 (g++: 3.4.3) > 2. Buserror on SPARC based Solaris-10 (g++: 3.4.4) > after printing the results.. > 3. Segmentation fault on Linux (g++: 4.1.2) after > printing the results.. > > Any pointers will be appreciated. Your default constructor is broken. > template > smartPtr::smartPtr() > // default constructor > { > *p = T(); > } What does p point to? Andrew. From Michael.Young@paetec.com Thu Mar 22 20:08:00 2007 From: Michael.Young@paetec.com (Young, Michael) Date: Thu, 22 Mar 2007 20:08:00 -0000 Subject: _bit_scan_forward In-Reply-To: Message-ID: > This is a reason that I personally don't like doxygen documentation. > It isn't clearly separated into interface functions and internal > functions. Do you know of a better tool? If so, I'm interested, because I have "issues" with Doxygen, too - IMHO, it does have some "warts". However... AFAICT, the problem really isn't with Doxygen. How does C or C++ really specify that a function is an "interface" vs. "internal"? They don't... one could argue that the C++ access specifiers on member functions are the same thing, but, it reality, they're not quite. (In most cases they're synonymous, but what members are/are not intended for use by a "friend"? That's why there's the Client/Attorney "pattern"...) [On a related note : access specifiers aren't there for encapsulation, either - that's why there's a "pimpl" (handle/body) idiom.] In C, there's really truly nothing for this... Anyway, the languages lack a formal way to specify interface vs. internal implementation. Note that even if there's a way to do this, then the question becomes, "Which interface is appropriate to use for which application / code layer?" So the real answer is that the developer should explicitly "identify" the function as internal/interface, along with the interface name/category, (easily done using preprocessor definitions and conditionals) when the documentation is created. (There may be other ways to deal with this, too - probably best to ask the Doxygen team for ideas.) Of course, even if you manage to identify the files/sections/functions appropriate for each audience, you must then typically generate "multiple sets" of docs - one for internal developers and one for 3rd parties, for example. [Side note : I've often wondered if I could generate a single doc set that can present only the views "accessible" by an identified user, but I've never really invetigated/pursued this...] Alternatively, you can choose to not create "pretty" docs for the internal stuff - but if you have to learn the tool / tags to create the interface docs anyway, the tool is easy to use, and the doc is useful for the next maintainer (you know - that homicidal maniac who knows where you live, or, in my case, that ADHD developer who can't remember anything and lives where I live), why not??? Finally, there's the "brute force" approach that just creates a description line that explicitly states into which "camp" the function falls; this leaves the "enforcement" up to the client developer and hides nothing, but it is generally the simplest approach to implement, too. I understand that it's difficult to "reverse engineer" and document functions properly "after the fact" (i.e., usually much later than the code creation, and often after the original developer is no longer available for consultation). There isn't a perfect solution for that situation, at least not until Vulcan mind-melds and collective cognition come along! But I think Doxygen provides a reasonable approach - it allows you to document "what is" relatively quickly, and that hopefully makes the code base easier to "grok". This is a little off-topic, but gripes about tools that are not being fully utilized or understood is something the GCC community has a vested interest in dispelling! In all fairness, the issue here may be with how GCC developers are documenting code, rather than a real problem with the tool! ;-) - Mike BTW - I am not a Doxygen contributor, and I have not ever used it at a paid job, but I do use it for my own "projects" (currently, my masters thesis project). From eljay@adobe.com Thu Mar 22 20:16:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Thu, 22 Mar 2007 20:16:00 -0000 Subject: gcc source code In-Reply-To: <841077.31638.qm@web27404.mail.ukl.yahoo.com> Message-ID: Hi ranjith, You can find the closest GNU or Mirror site to you here: http://gcc.gnu.org/gcc-4.1/ HTH, --Eljay From iant@google.com Fri Mar 23 03:44:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Fri, 23 Mar 2007 03:44:00 -0000 Subject: _bit_scan_forward In-Reply-To: References: Message-ID: "Young, Michael" writes: > > This is a reason that I personally don't like doxygen documentation. > > It isn't clearly separated into interface functions and internal > > functions. > > Do you know of a better tool? If so, I'm interested, because I have > "issues" with Doxygen, too - IMHO, it does have some "warts". However... > > AFAICT, the problem really isn't with Doxygen. How does C or C++ really > specify that a function is an "interface" vs. "internal"? Yes. The problem is that Doxygen doesn't force you to consider this. Writing documentation does. That is, my problem with Doxygen is a conceptual one: I don't think that annotating code is the right way to write documentation. Doxygen certainly has its uses. For example, it's useful within a project for people working on that project to see what functions are available and what they do. But it's not the same as documentation. For that purpose, at its best it's a tool which can be used to create the first version of the documentation. Ian From fang@csl.cornell.edu Fri Mar 23 05:42:00 2007 From: fang@csl.cornell.edu (David Fang) Date: Fri, 23 Mar 2007 05:42:00 -0000 Subject: Is there a way to pretty-print output for templates errors In-Reply-To: <4aca3dc20703220818l18fcf41eq9a31a5cd6eb74b3f@mail.gmail.com> Message-ID: <20070322223321.B48706-200000@shannon.csl.cornell.edu> > > Stephen Torri writes: > > > > > I have a hard time reading the template errors I get from GCC. I was > > > wondering if there is a flag for the compiler so that instead of getting > > > output like below. I know I failed to present this snapshot in a > > > preformatted output. This was deliberate to show how hard is to read > > > this on a terminal window. > > > > Unfortunately there is no such option. > > BTW, i think the real readability improvement (besides obviously > trying to use magic to make them shorter but understandable) would be > had from making it visually clear where the word " to non-scalar type" > starts. > > At least for me, half the time I spend trying to interpret the error > is going through the 80 lines it spewed trying to find where the > template it's complaining about ends and where the error it's actually > complaining about begins. > > Some people find the STLFilt program to be helpful: > > http://www.bdsoft.com/tools/stlfilt.html Hi all, Years ago, I had similar gripes about reading template errors arising from deeply nested templates and long chains of instantiations. I put awk to work and wrote the attached makeshift filter [balance_indent.awk] that expands templates arguments with tree-like indenting and line-breaking. To use it, pipe the stderr of gcc/g++ through "awk -f ". It's probably far from perfect, but it sure took strain off of my eyes in identifying the precise problem. You can customize the matching pattern at the end of the script. To be honest, I haven't used the script in years, and the format of the error messages may have changed slightly over the years. After practice, one just sees through the falling glyphs... Hope it helps some. Fang -------------- next part -------------- #!/usr/bin/awk -f # "balance_indent.awk" # $Id: balance_indent.awk,v 1.1 2005/09/04 22:13:48 fang Exp $ # for all those unreadable template error messages in the C++ standard library BEGIN { level = 0; indent = " "; # or "\t" width = 80; # terminal width, overrideable } # note beware of operators < and > function auto_indent(lvl, i) { ret = ""; i=0; # local var for ( ; i", "\n>", str); # split them apart numlines = split(str, arr, "\\n"); i=1; for ( ; i<=numlines; i++) { if (match(arr[i], "^\\)") || match(arr[i], "^>") || match(arr[i], "^\\]")) { level--; } # prepend indent ilevel[i] = level; if (match(arr[i], "\\($") || match(arr[i], "<$") || match(arr[i], "\\[$")) { level++; } # else no change in level } # glue back together # any intelligence about short balances? # joinlines = smart_join(arr, ilevel, 0, numlines-1); str = arr[1]; i = 2; for ( ; i<=numlines; i++) { if (length(arr[i])) str = str "\n" auto_indent(ilevel[i]) arr[i]; # else skip blank lines } return str; } # intelligently joins lines, recursively function smart_join(arr, ilevel, startindex, endindex, # returned arrays (by reference) subarr, subilevel, subnumlines, # local variables i, is_nested, curlevel, linelength) { # so we know this is passed by reference subnumlines[0] = 0; is_nested = 0; curlevel = ilevel[startindex]; # phase 0: scan and see if this sub-array has nested levels for (i=startindex+1; i<=endindex && !is_nested; i++) { if (ilevel[i] > curlevel) is_nested = 1; } if (is_nested) { # phase 1: partition into sections by level # what is one *item* in this level? for (i = startindex; i<=endindex; i++) { } } else { # we're in deepest level, no need to recurse # we have uniformly indented subarray of lines # see what we can combine... # no partial joining, just all or none # compute total line length (until width exceeded) linelength = length(auto_indent(curlevel)); for (i=startindex; i<=endindex && linelength < width; i++) { linelength += length(arr[i]); } if (linelength < width) { # join them all # don't prefix with indent yet. subilevel[startindex] = ilevel[startindex]; for (i=startindex; i<=endindex; i++) { subarray[startindex] = \ subarray[startindex] arr[i]; } subnumlines[0] = 1; } else { # don't join any, just copy back for (i=startindex; i<=endindex; i++) { subarray[i] = arr[i]; subilevel[i] = ilevel[i]; } subnumlines[0] = startindex -endindex +1; } } } # for almost all lines: { # exceptions if (match($0, "^g?make") || match($0, "^distcc")) print; else print balance_indent($0); } From rbaverst@engmail.uwaterloo.ca Fri Mar 23 06:34:00 2007 From: rbaverst@engmail.uwaterloo.ca (Richard Baverstock) Date: Fri, 23 Mar 2007 06:34:00 -0000 Subject: Forcing use of move instead of movem on M68k (5200/5307) Message-ID: <9D2873BB-D515-48E4-8DE5-69C17EB89470@engmail.uwaterloo.ca> Hi, We're having an issue with movem on the coldfire boards we are compiling a program for, and wondering if we can force the m68k gcc compiler to use move instead of movem. movem does not appear to be working on whatever chip variant we have, which severely affects returning from functions. Using the coldfire 5307, tried compiling with -m5200 and -m5307, both use movem. Thanks, Richard From dreams_arpit@yahoo.co.in Fri Mar 23 07:28:00 2007 From: dreams_arpit@yahoo.co.in (arpit jain) Date: Fri, 23 Mar 2007 07:28:00 -0000 Subject: Linker Directive Language Message-ID: <597907.76520.qm@web8405.mail.in.yahoo.com> Hiiiii 1.Can anyone plz tell me which is the latest version of Linker Directive Language (LD)? 2. What is the version of LD used by Latest release of GCC? Thanks & Regards Arpit __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/ From ita-garpaljo@itacyl.es Fri Mar 23 07:51:00 2007 From: ita-garpaljo@itacyl.es (=?iso-8859-1?Q?Jose_Luis_Garc=EDa_Pallero?=) Date: Fri, 23 Mar 2007 07:51:00 -0000 Subject: Installing gcc in a local directory Message-ID: Hello, First of all I should say that I'm a newbie GNU/Linux user. I need to install gcc/gfortran 4.2.0 in my computer. I would like to install it in a local directory, no the standard /usr/local. I configured the package with the options: ./configure --prefix=/home/user/gcc-4.2.0 --enable-languages=c,fortran --with-mpfr=/home/user/mpfr-2.2.1 --with-gmp=/home/user/gmp-4.2.1 and when it was compiled I put in .bash_profile the lines: PATH="/home/user/gcc- 4.2.0/bin:$PATH" export PATH I don't know if it is the only PATH that I should be defined. Should I define any other LIBPATH or INCLUDEPATH? Thanks From Markus.Duft@salomon.at Fri Mar 23 08:40:00 2007 From: Markus.Duft@salomon.at (Duft Markus) Date: Fri, 23 Mar 2007 08:40:00 -0000 Subject: Is it a Bug? (void*) Message-ID: <18597F2B47F1394A9B309945EC724112D3FC02@servex01.wamas.com> Hi I'm porting lots of stuff to windows (i know, *arg*...) and while doing so i found something interesting in a C Source file: void* myptr = (void*)otherptr + 1; Which doesn't compile with the microsoft compiler (error: void*: unknown size). Now i think, that microsoft is right in that case, and that void really has an unknown size. Since the "+ 1" should add something like "one times sizeof type" to the pointer, what should the compiler add when void is encountered? I think the above is wrong and dangerous. Should the compiler catch this? With C++ gcc prints an error and exits, but because of type conversions, not because of the addition. I attached a small test program, which demonstrates this (maybe bug... ;o)). Should i officially report this issue? Cheers, Markus -------------- next part -------------- A non-text attachment was scrubbed... Name: test.c Type: application/octet-stream Size: 472 bytes Desc: test.c URL: From annapoorna.r@subexazure.com Fri Mar 23 08:54:00 2007 From: annapoorna.r@subexazure.com (Annapoorna R) Date: Fri, 23 Mar 2007 08:54:00 -0000 Subject: installing gcc4.1.2 Message-ID: <46039218.7020504@subexazure.com> Hi, i was istalling the GCC4.1.2 vesrion on solaris10. i dowloaded core and the java vesrion tar.gz from the site to GCC4.1 folder. when i extracted core and java. both got extracted to /gcc4.1/gcc-4.1.2 folder. java into libjava. i read the instalation details in the install info, and got confused in between. .-- should i do configure for both core and java seperately? -- does this version(GCC) supports java 1.5 features (generics, autoboxing etc) -- confused with srcdir and objdir what you have mentioned. - does objdir means the dir where i want to install it? and srcdir is the dir where it got extracted. - i found that classpath-0.92-generics.tar.gz which supports generics. should i extract this to classpath folder created? Kindly give me details. -- Regards, Annapoorna.R This e-mail is bound by the terms and conditions described at http://www.subexazure.com/mail-disclaimer.html From daniel.lohmann@informatik.uni-erlangen.de Fri Mar 23 10:15:00 2007 From: daniel.lohmann@informatik.uni-erlangen.de (Daniel Lohmann) Date: Fri, 23 Mar 2007 10:15:00 -0000 Subject: Is it a Bug? (void*) In-Reply-To: <18597F2B47F1394A9B309945EC724112D3FC02@servex01.wamas.com> References: <18597F2B47F1394A9B309945EC724112D3FC02@servex01.wamas.com> Message-ID: <460395BD.1030307@informatik.uni-erlangen.de> It is not a bug, it's a feature :-) http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Pointer-Arith.html#Pointer-Arith >>> 5.17 Arithmetic on void- and Function-Pointers In GNU C, addition and subtraction operations are supported on pointers to void and on pointers to functions. This is done by treating the size of a void or of a function as 1. A consequence of this is that sizeof is also allowed on void and on function types, and returns 1. The option -Wpointer-arith requests a warning if these extensions are used. <<< Daniel Duft Markus wrote: > Hi > > I'm porting lots of stuff to windows (i know, *arg*...) and while doing > so i found something interesting in a C Source file: > > void* myptr = (void*)otherptr + 1; > > Which doesn't compile with the microsoft compiler (error: void*: unknown > size). Now i think, that microsoft is right in that case, and that void > really has an unknown size. > > Since the "+ 1" should add something like "one times sizeof type" to the > pointer, what should the compiler add when void is encountered? I think > the above is wrong and dangerous. Should the compiler catch this? With > C++ gcc prints an error and exits, but because of type conversions, not > because of the addition. > > I attached a small test program, which demonstrates this (maybe bug... > ;o)). > > Should i officially report this issue? > > Cheers, Markus From aph@redhat.com Fri Mar 23 10:46:00 2007 From: aph@redhat.com (Andrew Haley) Date: Fri, 23 Mar 2007 10:46:00 -0000 Subject: gcj install failed In-Reply-To: <46036AC2.7070108@subexazure.com> References: <46036AC2.7070108@subexazure.com> Message-ID: <17923.43199.886420.76004@zebedee.pink> Annapoorna R writes: > Hi, > > am trying to istall the GCJ 4.1.2 version on my SUNOs. > > steps i followed: > > 1. downloaded GCJ4.1.2 core and java tar from GNU site. and extracted it > to GCC4.1 > > after extracting folder GCC-4.1.2 is created(automatically while > extracting). > > the frontend part (java tar) was extraced to /gcc-4.1.2/libjava. > > Did ./configure from libjava folder.--successful > > did make from libjava. giving compilation errors. > > Please let me know am i wrong in the steps followed? Do the configure from the top directory. Andrew. From annapoorna.r@subexazure.com Fri Mar 23 11:06:00 2007 From: annapoorna.r@subexazure.com (Annapoorna R) Date: Fri, 23 Mar 2007 11:06:00 -0000 Subject: gcj install failed In-Reply-To: <17923.43199.886420.76004@zebedee.pink> References: <46036AC2.7070108@subexazure.com> <17923.43199.886420.76004@zebedee.pink> Message-ID: <4603AFA2.6000101@subexazure.com> Hi, Thanks for the info. I did configure from top directory. now its giving error here /disk1/certo/gcc4.1/gcc-4.1.2/libjava/classpath /bin/sh ./gen-classlist.sh test: Unknown operator -ef . Does it depend on the whether its running on sh/ksh/bash. Kindly help me. now its giving error here /disk1/certo/gcc4.1/gcc-4.1.2/libjava/classpath /bin/sh ./gen-classlist.sh Andrew Haley wrote: > Annapoorna R writes: > > Hi, > > > > am trying to istall the GCJ 4.1.2 version on my SUNOs. > > > > steps i followed: > > > > 1. downloaded GCJ4.1.2 core and java tar from GNU site. and extracted it > > to GCC4.1 > > > > after extracting folder GCC-4.1.2 is created(automatically while > > extracting). > > > > the frontend part (java tar) was extraced to /gcc-4.1.2/libjava. > > > > Did ./configure from libjava folder.--successful > > > > did make from libjava. giving compilation errors. > > > > Please let me know am i wrong in the steps followed? > > Do the configure from the top directory. > > Andrew. > > > > -- Regards, Annapoorna.R This e-mail is bound by the terms and conditions described at http://www.subexazure.com/mail-disclaimer.html From aph@redhat.com Fri Mar 23 11:58:00 2007 From: aph@redhat.com (Andrew Haley) Date: Fri, 23 Mar 2007 11:58:00 -0000 Subject: gcj install failed In-Reply-To: <4603AFA2.6000101@subexazure.com> References: <46036AC2.7070108@subexazure.com> <17923.43199.886420.76004@zebedee.pink> <4603AFA2.6000101@subexazure.com> Message-ID: <17923.46230.699404.72263@zebedee.pink> Please don't top-post. Annapoorna R writes: > Hi, > > Thanks for the info. I did configure from top directory. > > now its giving error here > > /disk1/certo/gcc4.1/gcc-4.1.2/libjava/classpath /bin/sh ./gen-classlist.sh > > test: Unknown operator -ef . > > Does it depend on the whether its running on sh/ksh/bash. You have to look at the man page for test on your system and find out why 'test -ef' doesn't work. Andrew. From glen.beane@jax.org Fri Mar 23 12:58:00 2007 From: glen.beane@jax.org (Glen Beane) Date: Fri, 23 Mar 2007 12:58:00 -0000 Subject: Is it a Bug? (void*) In-Reply-To: <18597F2B47F1394A9B309945EC724112D3FC02@servex01.wamas.com> References: <18597F2B47F1394A9B309945EC724112D3FC02@servex01.wamas.com> Message-ID: <4603C0BE.5090004@jax.org> Duft Markus wrote: > Hi > > I'm porting lots of stuff to windows (i know, *arg*...) and while doing > so i found something interesting in a C Source file: > > void* myptr = (void*)otherptr + 1; what about doing the conversion after incrementing the pointer? void *myptr = (void*)(otherptr + 1); -- Glen L. Beane Software Engineer II The Jackson Laboratory Phone (207) 288-6153 From tprince@myrealbox.com Fri Mar 23 13:13:00 2007 From: tprince@myrealbox.com (Timothy C Prince) Date: Fri, 23 Mar 2007 13:13:00 -0000 Subject: Installing gcc in a local directory Message-ID: <1174654719.c7c8925ctprince@myrealbox.com> -----Original Message----- From: Jose Luis Garc?a Pallero To: Date: Fri, 23 Mar 2007 08:28:41 +0100 Subject: Installing gcc in a local directory Hello, First of all I should say that I'm a newbie GNU/Linux user. I need to install gcc/gfortran 4.2.0 in my computer. I would like to install it in a local directory, no the standard /usr/local. I configured the package with the options: ../configure --prefix=/home/user/gcc-4.2.0 --enable-languages=c,fortran --with-mpfr=/home/user/mpfr-2.2.1 --with-gmp=/home/user/gmp-4.2.1 and when it was compiled I put in .bash_profile the lines: PATH="/home/user/gcc- 4.2.0/bin:$PATH" export PATH I don't know if it is the only PATH that I should be defined. Should I define any other LIBPATH or INCLUDEPATH? Thanks ________________________________________- After completion of make and make install, to use the compiler you have made, you would also need LD_LIBRARY_PATH=/home/user/gcc-4.2.0/lib:$LD_LIBRARY_PATH (no spaces in either path) Tim Prince From klaus-fried@gmx.net Fri Mar 23 13:15:00 2007 From: klaus-fried@gmx.net (Klaus Friedrich) Date: Fri, 23 Mar 2007 13:15:00 -0000 Subject: need help for GCC--RTL Message-ID: <4603D278.8050205@gmx.net> Hallo, my name is Klaus Friedrich. For my diploma thesis, i will work with the gcc4.1 internals. I would like to extract information about the RTL language. I search for a description of the virtual machine/virtual processor on the RTL instruction set and for example the register management/alignment. I can't find exakt information about the meaning for the RTL constructs. For Example the meaning for this reg expression [D.1281] in (reg:SI 58 [D.1281]) or the meaning for virtual-stack-vars in (reg/f:SI 54 virtual-stack-vars). I also information about the (clobber (reg:CC 17 flags)) expr. What do the clobber function with the reg 17 ? Thank You very much!!! Klaus Friedrich From ita-garpaljo@itacyl.es Fri Mar 23 13:38:00 2007 From: ita-garpaljo@itacyl.es (=?iso-8859-1?Q?Jose_Luis_Garc=EDa_Pallero?=) Date: Fri, 23 Mar 2007 13:38:00 -0000 Subject: Installing gcc in a local directory Message-ID: Hi, Only LD_LIBRARY_PATH=/home/user/gcc-4.2.0/lib:$LD_LIBRARY_PATH? What about include files? For example, if I want to compile a tipycal hello world program in C, what stdio.h use the compiler, the new 4.2.0 or the old 4.1.2? If I want to compile a program with gcc-4.1.2 instead of 4.2.0, what about the new LD_LIBRARY_PATH=/home/user/gcc-4.2.0/lib:$LD_LIBRARY_PATH order? Need add LD_LIBRARY_PATH=/home/user/gcc-4.2.0/lib:$LD_LIBRARY_PATH order if I compile, for example, gcc/g77 too? -----Original Message----- From: Jose Luis Garc?a Pallero To: Date: Fri, 23 Mar 2007 08:28:41 +0100 Subject: Installing gcc in a local directory Hello, First of all I should say that I'm a newbie GNU/Linux user. I need to install gcc/gfortran 4.2.0 in my computer. I would like to install it in a local directory, no the standard /usr/local. I configured the package with the options: ../configure --prefix=/home/user/gcc-4.2.0 --enable-languages=c,fortran --with-mpfr=/home/user/mpfr-2.2.1 --with-gmp=/home/user/gmp-4.2.1 and when it was compiled I put in .bash_profile the lines: PATH="/home/user/gcc- 4.2.0/bin:$PATH" export PATH I don't know if it is the only PATH that I should be defined. Should I define any other LIBPATH or INCLUDEPATH? Thanks ________________________________________- After completion of make and make install, to use the compiler you have made, you would also need LD_LIBRARY_PATH=/home/user/gcc-4.2.0/lib:$LD_LIBRARY_PATH (no spaces in either path) Tim Prince From kkxkkx@gmail.com Fri Mar 23 14:33:00 2007 From: kkxkkx@gmail.com (John) Date: Fri, 23 Mar 2007 14:33:00 -0000 Subject: How to modify GCC so to insert some code for debug? Message-ID: <2311f6f10703230638g3e1c12c9rf5526f86146eaa@mail.gmail.com> Hi, I use GCC to compile the code that runs in a very resouse-limited embed system, so I can't use the usual debug tools, such as GDB. And there are thousands of lagacy code already, in which there is no debug code, sth like PRINT(__FILE__, __LINE__). So I want to modify the GCC to meet the requirement below: 1. In each funtion entry and exit, print out some info, such as the funtion name, time, etc. 2. Before each loop(for/while/until) and branch selection, print out the condition info. For exmaple: for(i = ...) while(j < ...), if(i > ...), print out the value of i. 3. More advanced, when a variable is accessed, its value is printed. Like the watch command in GDB. Could some gurus give me some suggestions? Such as is there a project aimed at this? How long/difficult does it take if I make it from scratch? Thanks, John From kpfleming@starnetworks.us Fri Mar 23 14:35:00 2007 From: kpfleming@starnetworks.us (Kevin P. Fleming) Date: Fri, 23 Mar 2007 14:35:00 -0000 Subject: Is it a Bug? (void*) In-Reply-To: <4603C0BE.5090004@jax.org> References: <18597F2B47F1394A9B309945EC724112D3FC02@servex01.wamas.com> <4603C0BE.5090004@jax.org> Message-ID: <4603E534.6070705@starnetworks.us> Glen Beane wrote: > what about doing the conversion after incrementing the pointer? > > void *myptr = (void*)(otherptr + 1); Then the pointer will be incremented by sizeof(*otherptr), which could be anything and is likely to not be '1 byte'. From hooksbetty@sbcglobal.net Fri Mar 23 15:07:00 2007 From: hooksbetty@sbcglobal.net (RLB) Date: Fri, 23 Mar 2007 15:07:00 -0000 Subject: Starting programs How? Message-ID: <002301c76d58$8cbec290$4a4adf45@fastamd> Have been using VisualStudio ( 6 & 8) for several years. I am not satisfied with the stuff that comes out of MSFT. I have tried for several years (occassionally) to get into a different area -- and I have not discovered the secret to beginning. At present I have Boost; gcc compiler; cygwin; gimp; STAF; STAX; VS6; and VS8; in the hdd that runs WinXP. I am unable to find a place to start any of the programs, projects, or whatever, except the VS6 and VS8. I have the manuals from gcc. Hundreds of pages, many not be relevant. And nowhere does it tell how to institute any of the programs. For example: How do you get the gcc-4.1.2 to do anything? Is there a program editor here anywhere? If so how do you call it up? (Other than the VS6 or 8) How do I get any of this stuff to work together with any of the other stuff? Basically I have a workable program that XP will not run. Is there a way to move all the files from the VS6 and rework it somewhere else? Bear in mind that the program I have involves some 40 odd files. Can anyone give me anything that will help -- even the way to institute any of these outfits. I can probably figure how to make the program work if there is a starting place. Thanks, Bob Bailey hooksbetty@sbcglobal.net From Markus.Duft@salomon.at Fri Mar 23 15:10:00 2007 From: Markus.Duft@salomon.at (Duft Markus) Date: Fri, 23 Mar 2007 15:10:00 -0000 Subject: Is it a Bug? (void*) Message-ID: <18597F2B47F1394A9B309945EC724112D3FE3A@servex01.wamas.com> Kevin P. Fleming <> wrote: > Glen Beane wrote: >> what about doing the conversion after incrementing the pointer? >> >> void *myptr = (void*)(otherptr + 1); > > Then the pointer will be incremented by sizeof(*otherptr), which could > be anything and is likely to not be '1 byte'. Yes, correctly... The thing is, i can cast to char*, but thats not the point. I just wanted to know if it's wanted that void=1byte with gcc -> it's not necessarily with other compilers. (it's not with microsoft's cl which i'm porting to ;o)) Cheers, Markus From eljay@adobe.com Fri Mar 23 15:47:00 2007 From: eljay@adobe.com (John (Eljay) Love-Jensen) Date: Fri, 23 Mar 2007 15:47:00 -0000 Subject: Starting programs How? References: <002301c76d58$8cbec290$4a4adf45@fastamd> Message-ID: Hi Bob, Here's my recommendation. Download the Cygwin SETUP.EXE (www.cygwin.com). Run the SETUP.EXE and make sure you install GCC (whichever languages you want). If you want to target Windows, install the MinGW facilities. If you want to target the Unix-like Cygwin environment, you don't need MinGW. I use Vim for my editor, and GNU Make for my projects. If you prefer an IDE type of environment, there are several available, but I'm not familiar with them. HTH, --Eljay From aph@redhat.com Fri Mar 23 16:15:00 2007 From: aph@redhat.com (Andrew Haley) Date: Fri, 23 Mar 2007 16:15:00 -0000 Subject: Is it a Bug? (void*) In-Reply-To: <18597F2B47F1394A9B309945EC724112D3FE3A@servex01.wamas.com> References: <18597F2B47F1394A9B309945EC724112D3FE3A@servex01.wamas.com> Message-ID: <17923.63085.933389.961068@zebedee.pink> Duft Markus writes: > Kevin P. Fleming <> wrote: > > Glen Beane wrote: > >> what about doing the conversion after incrementing the pointer? > >> > >> void *myptr = (void*)(otherptr + 1); > > > > Then the pointer will be incremented by sizeof(*otherptr), which could > > be anything and is likely to not be '1 byte'. > > Yes, correctly... > > The thing is, i can cast to char*, but thats not the point. I just > wanted to know if it's wanted that void=1byte with gcc -> it's not > necessarily with other compilers. (it's not with microsoft's cl which > i'm porting to ;o)) 5.17 Arithmetic on `void'- and Function-Pointers ================================================ In GNU C, addition and subtraction operations are supported on pointers to `void' and on pointers to functions. This is done by treating the size of a `void' or of a function as 1. A consequence of this is that `sizeof' is also allowed on `void' and on function types, and returns 1. The option `-Wpointer-arith' requests a warning if these extensions are used. From iant@google.com Fri Mar 23 16:16:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Fri, 23 Mar 2007 16:16:00 -0000 Subject: Forcing use of move instead of movem on M68k (5200/5307) In-Reply-To: <9D2873BB-D515-48E4-8DE5-69C17EB89470@engmail.uwaterloo.ca> References: <9D2873BB-D515-48E4-8DE5-69C17EB89470@engmail.uwaterloo.ca> Message-ID: Richard Baverstock writes: > We're having an issue with movem on the coldfire boards we are > compiling a program for, and wondering if we can force the m68k gcc > compiler to use move instead of movem. movem does not appear to be > working on whatever chip variant we have, which severely affects > returning from functions. Using the coldfire 5307, tried compiling > with -m5200 and -m5307, both use movem. Unfortunately there is no option to disable movem. You would have to change the compiler source code. The ColdFire does support movem, although it doesn't support all variants. You didn't mention which version of gcc you are using. There have been improvements to the ColdFire support in recent releases. Ian From mailinglists@blueSpirit.la Fri Mar 23 16:17:00 2007 From: mailinglists@blueSpirit.la (Karl Krach) Date: Fri, 23 Mar 2007 16:17:00 -0000 Subject: wrong GCC-configuration? (./specs: Is a directory) Message-ID: <4603FD3F.5000600@blueSpirit.la> Hi! I'm a Gentoo user and tried to emerge k3b and got stuck while installing the necessary app-cdr/cdrdao-1.2.1-r1 package: [...] checking for x86_64-pc-linux-gnu-gcc... x86_64-pc-linux-gnu-gcc checking for C compiler default output file name... configure: error: *C compiler cannot create executables* See `config.log' for more details. [...] !!! ERROR: app-cdr/cdrdao-1.2.1-r1 failed. In the config.log the interesting part is configure:2357: x86_64-pc-linux-gnu-gcc -v &5 Reading specs from ./specs x86_64-pc-linux-gnu-gcc: *./specs: Is a directory* configure:2360: $? = 1 configure:2362: x86_64-pc-linux-gnu-gcc -V &5 x86_64-pc-linux-gnu-gcc: '-V' option must have argument configure:2365: $? = 1 configure:2388: checking for C compiler default output file name configure:2391: x86_64-pc-linux-gnu-gcc -march=k8 -pipe -O2 -fno-inline conftest.c >&5 x86_64-pc-linux-gnu-gcc: *./specs: Is a directory* configure:2394: $? = 1 [...] configure:2433: error: C compiler cannot create executables What I figured out: My problem is that my GCC reads the specs from the current directory (if available). To demonstrate this: bluespirit tmp # ls bluespirit tmp # gcc -v *Reading specs from /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/specs* Target: x86_64-pc-linux-gnu [...] gcc version 4.1.1 (Gentoo 4.1.1-r3) bluespirit tmp # touch specs bluespirit tmp # gcc -v *Reading specs from ./specs* gcc: unrecognized option '-v' gcc: unrecognized option '-mtune=k8' Target: x86_64-pc-linux-gnu [...] gcc version 4.1.1 (Gentoo 4.1.1-r3) bluespirit tmp # rm specs bluespirit tmp # mkdir specs bluespirit tmp # gcc -v *Reading specs from ./specs* gcc: ./specs: Is a directory bluespirit tmp # unset GCC_SPECS bluespirit tmp # gcc -v *Reading specs from ./specs* gcc: ./specs: Is a directory bluespirit tmp # How can I teach my GCC to use ONLY the given specs - and ignore the directory specs (which exists in the cdrdao-folder). In my opinion, I use the Gentoo settings for the GCC - so I'm wondering, why this error is so rarely documented in the web. Thanks in advance, Charly -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: gcc.v.txt URL: From iant@google.com Fri Mar 23 16:21:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Fri, 23 Mar 2007 16:21:00 -0000 Subject: Linker Directive Language In-Reply-To: <597907.76520.qm@web8405.mail.in.yahoo.com> References: <597907.76520.qm@web8405.mail.in.yahoo.com> Message-ID: arpit jain writes: > 1.Can anyone plz tell me which is the latest version > of Linker Directive Language (LD)? > > 2. What is the version of LD used by Latest release of > GCC? GCC uses whatever linker you have installed. On GNU/Linux systems the linker is part of the GNU binutils. See http://sourceware.org/binutils/ for more information. Ian From iant@google.com Fri Mar 23 16:27:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Fri, 23 Mar 2007 16:27:00 -0000 Subject: How to modify GCC so to insert some code for debug? In-Reply-To: <2311f6f10703230638g3e1c12c9rf5526f86146eaa@mail.gmail.com> References: <2311f6f10703230638g3e1c12c9rf5526f86146eaa@mail.gmail.com> Message-ID: John writes: > I use GCC to compile the code that runs in a very resouse-limited embed system, > so I can't use the usual debug tools, such as GDB. And there are thousands of > lagacy code already, in which there is no debug code, sth like > PRINT(__FILE__, __LINE__). > > So I want to modify the GCC to meet the requirement below: > 1. In each funtion entry and exit, print out some info, such as the > funtion name, time, etc. Look at the profiling support enabled by -pg, which does something similar at function entry. It inserts a call to _mcount. > 2. Before each loop(for/while/until) and branch selection, print out > the condition info. > For exmaple: > for(i = ...) while(j < ...), if(i > ...), print out the value of i. Painful but possible. > 3. More advanced, when a variable is accessed, its value is printed. > Like the watch command in GDB. Look at the -fmudflap support. > Could some gurus give me some suggestions? Such as is there a project > aimed at this? How long/difficult > does it take if I make it from scratch? I don't know of anybody trying these ideas, because the result is going to run quite slowly. You might want to look into setting up a gdb stub as described in the gdb manual, and using the remote protocol. I've successfully used gdb on resource constrainted embedded systems that way. It's not easy to set up, but it's much much simpler than changing the compiler as you propose. Ian From iant@google.com Fri Mar 23 16:53:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Fri, 23 Mar 2007 16:53:00 -0000 Subject: need help for GCC--RTL In-Reply-To: <4603D278.8050205@gmx.net> References: <4603D278.8050205@gmx.net> Message-ID: Klaus Friedrich writes: > For my diploma thesis, i will work with the gcc4.1 internals. I would > like to extract information about the RTL > language. I search for a description of the virtual machine/virtual > processor on the RTL instruction set and for example the register > management/alignment. > > I can't find exakt information about the meaning for the RTL > constructs. For Example the meaning for this reg expression [D.1281] in > (reg:SI 58 [D.1281]) or the meaning for virtual-stack-vars in > (reg/f:SI 54 virtual-stack-vars). The [D.1281] refers to the variable associated with that register. In this case I can tell by the name that it is a GIMPLE temporary register. If you use -fdump-tree-final_cleanup and look in the dump file you will see the last GIMPLE code before the expansion into RTL. You should see D.1281 in that code. virtual-stack-vars is a pseudo register which points to the first local variable on the stack frame. It is only used for a little while, and is eliminated by pass_instantiate_virtual_regs. > I also information about the (clobber (reg:CC 17 flags)) expr. What do > the clobber function with the reg 17 ? What can I say: it clobbers it. See the RTL documentation. Ian From rodgexu@yahoo.com Fri Mar 23 16:58:00 2007 From: rodgexu@yahoo.com (Zhiyong Xu) Date: Fri, 23 Mar 2007 16:58:00 -0000 Subject: what's wrong with it? Message-ID: <249651.91455.qm@web31509.mail.mud.yahoo.com> t.c /* * Evaluate a function at three points, displaying results. */ void evaluate(double f(double f_arg), double pt1, double pt2, double pt3) { printf("f(%.5f) = %.5f\n", pt1, f(pt1)); printf("f(%.5f) = %.5f\n", pt2, f(pt2)); printf("f(%.5f) = %.5f\n", pt3, f(pt3)); } compile: $gcc -lm ex.c t.c $./a.out f(2.00000) = 0.90930 f(3.00000) = 0.14112 f(4.00000) = -0.75680 f(2.00000) = 1.41421 f(3.00000) = 1.73205 f(4.00000) = 2.00000 if change ex.c, add the prototype of function evaluate ex.c #include #include void evaluate(double f(double f_arg), double pt1, double pt2, double pt3); int main(void) { evaluate(sin, 2,3,4); evaluate(sqrt,2,3,4); return(0); } compile: $gcc -lm ex.c t.c $./a.out f(2.00000) = 0.90930 f(3.00000) = 0.14112 f(4.00000) = -0.75680 f(2.00000) = 1.41421 f(3.00000) = 1.73205 f(4.00000) = 2.00000 here's the description: 1. I have a function evaluate defined in t.c 2. in ex.c, I call function evaluate without prototype defined. using gcc -lm ex.c t.c, I can generate the executable file a.out, when executing, the result is wrong 3. if I modify ex.c, add the prototype definition, the result is correct. Anything wrong with the first case? ____________________________________________________________________________________ 8:00? 8:25? 8:40? Find a flick in no time with the Yahoo! Search movie showtime shortcut. http://tools.search.yahoo.com/shortcuts/#news From jeffreyholle@bellsouth.net Fri Mar 23 17:01:00 2007 From: jeffreyholle@bellsouth.net (Jeffrey Holle) Date: Fri, 23 Mar 2007 17:01:00 -0000 Subject: Starting programs How? In-Reply-To: <002301c76d58$8cbec290$4a4adf45@fastamd> References: <002301c76d58$8cbec290$4a4adf45@fastamd> Message-ID: RLB wrote: > Have been using VisualStudio ( 6 & 8) for several years. I > am not satisfied with the stuff that comes out of MSFT. > Boost; gcc compiler; cygwin; gimp; STAF; I recommend that you use bjam, the build system of boost. While I only use bjam on linux, I find it much more productive to use that a GUI. I too have spent years using Microsoft's Visual Studio products and found they were always a maintenance problem. Bjam is a make replacement that allows the programmer to operate at a higher level of abstraction than both make and Visual Studio. This hopefully will allow you to remain blissfully ignorant of your "cross compiler" tool chain. Look for example Jamfile in the boost directories. There is a separate mail list for bjam users, (gmane.comp.lib.boost.build) As for editors, I recommend investing in good one. Personally, I like the Visual Slick Editor. From iant@google.com Fri Mar 23 17:10:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Fri, 23 Mar 2007 17:10:00 -0000 Subject: wrong GCC-configuration? (./specs: Is a directory) In-Reply-To: <4603FD3F.5000600@blueSpirit.la> References: <4603FD3F.5000600@blueSpirit.la> Message-ID: Karl Krach writes: > What I figured out: My problem is that my GCC reads the specs from the > current directory (if available). This is not normal behaviour. There is something odd about your GCC. Or you've done something like set the environment variable GCC_EXEC_PREFIX to ".". Ian From aph@redhat.com Fri Mar 23 18:25:00 2007 From: aph@redhat.com (Andrew Haley) Date: Fri, 23 Mar 2007 18:25:00 -0000 Subject: what's wrong with it? In-Reply-To: <249651.91455.qm@web31509.mail.mud.yahoo.com> References: <249651.91455.qm@web31509.mail.mud.yahoo.com> Message-ID: <17924.2530.20574.526806@zebedee.pink> Zhiyong Xu writes: > > here's the description: > 1. I have a function evaluate defined in t.c > 2. in ex.c, I call function evaluate without prototype > defined. > using gcc -lm ex.c t.c, I can generate the executable > file a.out, > when executing, the result is wrong > 3. if I modify ex.c, add the prototype definition, the > result is correct. > > Anything wrong with the first case? Yes: int main(void) { evaluate(sin, 2.0,3.0,4.0); evaluate(sqrt,2.0,3.0,4.0); return(0); } But working without ptototypes is stupid and pointless. Don't do it. Andrew. From david@carter-hitchin.clara.co.uk Fri Mar 23 18:36:00 2007 From: david@carter-hitchin.clara.co.uk (DCH) Date: Fri, 23 Mar 2007 18:36:00 -0000 Subject: -fdump-tree-all documentation. In-Reply-To: <17911.51534.977035.359224@zebedee.pink> References: <3B4C77997DD0254B86D3C9454476B6BC0F03EC1D@lonms00812.fm.rbsgrp.net> <200703122349.l2CNnjOg000953@mx1.redhat.com> <17910.26477.347058.814071@zebedee.pink> <200703132042.l2DKg4P5026776@mx1.redhat.com> <17911.51534.977035.359224@zebedee.pink> Message-ID: Hi Andrew, >Oh, you mean the front end dump. Most of the dumps look like this: Ok... I had a look at the other dumps and can see things more clearly here. Each one of these is a tree node, and links are replaced by numbers of >the form @N. After that, it's just tree nodes. Most of the meaning >of these nodes is documented in gcc/tree.def, but a few nodes are >language-specific and are documented in the language front ends. Cheers, David. From david@carter-hitchin.clara.co.uk Fri Mar 23 18:47:00 2007 From: david@carter-hitchin.clara.co.uk (DCH) Date: Fri, 23 Mar 2007 18:47:00 -0000 Subject: Is there a way to pretty-print output for templates errors In-Reply-To: <20070322223321.B48706-200000@shannon.csl.cornell.edu> References: <4aca3dc20703220818l18fcf41eq9a31a5cd6eb74b3f@mail.gmail.com> <20070322223321.B48706-200000@shannon.csl.cornell.edu> Message-ID: STLfilt is pretty handy: http://www.bdsoft.com/tools/stlfilt.html I have to say that I found this amazing when I first started using the STL, but after a while I can just look at a long message and quite quickly get out of it the information I need to fix my code, without reaching for something like STLfilt. I'd only use it now, if I had absolutely no clue what was wrong with my code. Cheers, David At 03:44 23/03/2007, David Fang wrote: > > > Stephen Torri writes: > > > > > > > I have a hard time reading the template errors I get from GCC. I was > > > > wondering if there is a flag for the compiler so that instead > of getting > > > > output like below. I know I failed to present this snapshot in a > > > > preformatted output. This was deliberate to show how hard is to read > > > > this on a terminal window. > > > > > > Unfortunately there is no such option. > > > > BTW, i think the real readability improvement (besides obviously > > trying to use magic to make them shorter but understandable) would be > > had from making it visually clear where the word " to non-scalar type" > > starts. > > > > At least for me, half the time I spend trying to interpret the error > > is going through the 80 lines it spewed trying to find where the > > template it's complaining about ends and where the error it's actually > > complaining about begins. > > > > Some people find the STLFilt program to be helpful: > > > http://www.bdsoft.com/tools/stlfilt.html > >Hi all, > Years ago, I had similar gripes about reading template errors >arising from deeply nested templates and long chains of instantiations. >I put awk to work and wrote the attached makeshift filter >[balance_indent.awk] that expands templates arguments with tree-like >indenting and line-breaking. To use it, pipe the stderr of gcc/g++ >through "awk -f ". It's probably far from perfect, but it >sure took strain off of my eyes in identifying the precise problem. You >can customize the matching pattern at the end of the script. > To be honest, I haven't used the script in years, and the format >of the error messages may have changed slightly over the years. After >practice, one just sees through the falling glyphs... > >Hope it helps some. > >Fang > From rodgexu@yahoo.com Fri Mar 23 18:52:00 2007 From: rodgexu@yahoo.com (Zhiyong Xu) Date: Fri, 23 Mar 2007 18:52:00 -0000 Subject: what's wrong with it? In-Reply-To: <17924.2530.20574.526806@zebedee.pink> Message-ID: <471446.26019.qm@web31503.mail.mud.yahoo.com> I knew if I put real number parameters, it will work fine. I just want to know if I did not put function prototype, how system will deal with it, and why it generate this error. Could you please tell me? Thanks, --- Andrew Haley wrote: > Zhiyong Xu writes: > > > > > here's the description: > > 1. I have a function evaluate defined in t.c > > 2. in ex.c, I call function evaluate without > prototype > > defined. > > using gcc -lm ex.c t.c, I can generate the > executable > > file a.out, > > when executing, the result is wrong > > 3. if I modify ex.c, add the prototype > definition, the > > result is correct. > > > > Anything wrong with the first case? > > Yes: > > int main(void) > { > evaluate(sin, 2.0,3.0,4.0); > evaluate(sqrt,2.0,3.0,4.0); > > return(0); > } > > But working without ptototypes is stupid and > pointless. Don't do it. > > Andrew. > ____________________________________________________________________________________ Sucker-punch spam with award-winning protection. Try the free Yahoo! Mail Beta. http://advision.webevents.yahoo.com/mailbeta/features_spam.html From storri@torri.org Fri Mar 23 18:55:00 2007 From: storri@torri.org (Stephen Torri) Date: Fri, 23 Mar 2007 18:55:00 -0000 Subject: Is there a way to pretty-print output for templates errors In-Reply-To: <1174675003.3604.7.camel@localhost.localdomain> References: <4aca3dc20703220818l18fcf41eq9a31a5cd6eb74b3f@mail.gmail.com> <20070322223321.B48706-200000@shannon.csl.cornell.edu> <1174675003.3604.7.camel@localhost.localdomain> Message-ID: <1174675911.3604.8.camel@localhost.localdomain> On Fri, 2007-03-23 at 18:36 +0000, DCH wrote: > STLfilt is pretty handy: > > http://www.bdsoft.com/tools/stlfilt.html When I checked the faq it said that GCC 4.0 support was not implemented. Do you have different information? Stephen From aph@redhat.com Fri Mar 23 19:01:00 2007 From: aph@redhat.com (Andrew Haley) Date: Fri, 23 Mar 2007 19:01:00 -0000 Subject: what's wrong with it? In-Reply-To: <471446.26019.qm@web31503.mail.mud.yahoo.com> References: <17924.2530.20574.526806@zebedee.pink> <471446.26019.qm@web31503.mail.mud.yahoo.com> Message-ID: <17924.8827.817929.401614@zebedee.pink> Zhiyong Xu writes: > I knew if I put real number parameters, it will work fine. So you knew the answer already. > I just want to know if I did not put function prototype, how system > will deal with it, and why it generate this error. Because in the absence of a prototype, an int is passed to a function expecting a double. In the presence of a prototype, the ints are converted to doubles before being passed. > > But working without prototypes is stupid and > > pointless. Don't do it. Andrew. From david@carter-hitchin.clara.co.uk Fri Mar 23 20:23:00 2007 From: david@carter-hitchin.clara.co.uk (DCH) Date: Fri, 23 Mar 2007 20:23:00 -0000 Subject: Is there a way to pretty-print output for templates errors In-Reply-To: <1174675911.3604.8.camel@localhost.localdomain> References: <4aca3dc20703220818l18fcf41eq9a31a5cd6eb74b3f@mail.gmail.com> <20070322223321.B48706-200000@shannon.csl.cornell.edu> <1174675003.3604.7.camel@localhost.localdomain> <1174675911.3604.8.camel@localhost.localdomain> Message-ID: At 18:51 23/03/2007, Stephen Torri wrote: >On Fri, 2007-03-23 at 18:36 +0000, DCH wrote: > > STLfilt is pretty handy: > > > > http://www.bdsoft.com/tools/stlfilt.html > >When I checked the faq it said that GCC 4.0 support was not implemented. >Do you have different information? > >Stephen Apologies, I hadn't realised that time had moved on. IIRC it's written in perl which is pretty easy to understand and modify to suit ones needs. It's also a small script so it shouldn't take you too long to work through. There are also quite a few versions of it floating about - if you google enough, you might even find that someone has done the job for you. Cheers, David. From mailinglists@blueSpirit.la Fri Mar 23 20:28:00 2007 From: mailinglists@blueSpirit.la (Karl Krach) Date: Fri, 23 Mar 2007 20:28:00 -0000 Subject: wrong GCC-configuration? (./specs: Is a directory) In-Reply-To: References: <4603FD3F.5000600@blueSpirit.la> Message-ID: <46043721.7070705@blueSpirit.la> Ian Lance Taylor wrote: > Karl Krach writes: > >> What I figured out: My problem is that my GCC reads the specs from the >> current directory (if available). > > This is not normal behaviour. There is something odd about your GCC. > Or you've done something like set the environment variable > GCC_EXEC_PREFIX to ".". I've already checked all environment variables. There is only $GCC_SPECS and it's empty. But this variable (if empty) has no effect to GCC's behavior. > > Ian > And yes, I'm also sure that it's not the normal behavior. But I've no idea which parameters to change. Thanks, Charly From tprince@myrealbox.com Fri Mar 23 20:29:00 2007 From: tprince@myrealbox.com (Timothy C Prince) Date: Fri, 23 Mar 2007 20:29:00 -0000 Subject: Installing gcc in a local directory Message-ID: <1174681727.c7de34bctprince@myrealbox.com> -----Original Message----- From: Jose Luis Garc?a Pallero To: Date: Fri, 23 Mar 2007 14:15:15 +0100 Subject: Installing gcc in a local directory Hi, Only LD_LIBRARY_PATH=/home/user/gcc-4.2.0/lib:$LD_LIBRARY_PATH? What about include files? For example, if I want to compile a tipycal hello world program in C, what stdio.h use the compiler, the new 4.2.0 or the old 4.1.2? If I want to compile a program with gcc-4.1.2 instead of 4.2.0, what about the new LD_LIBRARY_PATH=/home/user/gcc-4.2.0/lib:$LD_LIBRARY_PATH order? Need add LD_LIBRARY_PATH=/home/user/gcc-4.2.0/lib:$LD_LIBRARY_PATH order if I compile, for example, gcc/g77 too? ___________________________________________ You can check by gcc -v and gcc -print-search-dirs to see that the compiler is correctly using its own paths for its include files. Tim Prince From brendon@christian.net Fri Mar 23 20:31:00 2007 From: brendon@christian.net (Brendon Costa) Date: Fri, 23 Mar 2007 20:31:00 -0000 Subject: Installing gcc in a local directory In-Reply-To: References: Message-ID: <46043885.8030509@christian.net> Jose Luis Garc??a Pallero wrote: > Hi, > Only LD_LIBRARY_PATH=/home/user/gcc-4.2.0/lib:$LD_LIBRARY_PATH? > What about include files? For example, if I want to compile a tipycal hello world program in C, what stdio.h use the compiler, the new 4.2.0 or the old 4.1.2? If I want to compile a program with gcc-4.1.2 instead of 4.2.0, what about the new LD_LIBRARY_PATH=/home/user/gcc-4.2.0/lib:$LD_LIBRARY_PATH order? > Need add LD_LIBRARY_PATH=/home/user/gcc-4.2.0/lib:$LD_LIBRARY_PATH order if I compile, for example, gcc/g77 too? > I just asked almost the same question in another thread: "Two Versions of GCC" I am doing the PATH export and the LD_LIBRARY_PATH export, however upon linking some things i get link errors because it is trying to link using the old system installed GCC libstdc++ libraries, not the ones in my home directory. I dont see why thought because the link command looks like: g++ -g -O2 -o .libs/library_user library_user-main.o .libs/library_userS.o -L/home/bcosta/build/edoc/gcc-4.0.1/i386-unknown-netbsdelf3.0/libstdc++-v3/src -L/home/bcosta/build/edoc/gcc-4.0.1/i386-unknown-netbsdelf3.0/libstdc++-v3/src/.libs -L/home/bcosta/build/edoc/gcc-4.0.1/gcc ../../../src/plugins/myplugin/.libs/myplugin.a /home/bcosta/build/example/src/libs/mystatic/.libs/libmystatic.a -lm ../../../src/libs/myshared/.libs/libmyshared.so ../../../src/libs/mystatic/.libs/libmystatic.a /home/bcosta/build/install/edoc_gcc/lib/libstdc++.so ../../../libltdl/.libs/libltdlc.a -Wl,--rpath -Wl,/home/bcosta/build/install_example/lib -Wl,--rpath -Wl,/home/bcosta/build/install/edoc_gcc/lib Notice the: /home/bcosta/build/install/edoc_gcc/lib/libstdc++.so line which says its linking the libstdc++ from the home directory NOT the user one. For some reason, libstdc++ from /usr/lib is being used instead... Or so it seems. The other thread has more details. Any thoughts? Just as an additional note to the original question, i dont know if it is necessary but my configuration options include: --with-local-prefix=/home/user/gcc-4.2.0 as well as the standard --prefix. I dont remember where i got this from as i have been doing it for a while now. Brendon. From iant@google.com Fri Mar 23 20:46:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Fri, 23 Mar 2007 20:46:00 -0000 Subject: wrong GCC-configuration? (./specs: Is a directory) In-Reply-To: <46043721.7070705@blueSpirit.la> References: <4603FD3F.5000600@blueSpirit.la> <46043721.7070705@blueSpirit.la> Message-ID: Karl Krach writes: > Ian Lance Taylor wrote: > > Karl Krach writes: > > > >> What I figured out: My problem is that my GCC reads the specs from the > >> current directory (if available). > > This is not normal behaviour. There is something odd about your GCC. > > Or you've done something like set the environment variable > > GCC_EXEC_PREFIX to ".". > > I've already checked all environment variables. There is only > $GCC_SPECS and it's empty. But this variable (if empty) has no effect > to GCC's behavior. GCC_SPECS does nothing with standard gcc. > And yes, I'm also sure that it's not the normal behavior. But I've no > idea which parameters to change. I think you must be using patched source code. I have no other way of explaining what you are seeing. Well, maybe you configured gcc with "--prefix=." but that would probably cause other problems. Ian From mohsen@pahlevanzadeh.org Fri Mar 23 21:06:00 2007 From: mohsen@pahlevanzadeh.org (Mohsen Pahlevanzadeh) Date: Fri, 23 Mar 2007 21:06:00 -0000 Subject: pthread & its bug Message-ID: <46046D9B.7030607@pahlevanzadeh.org> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Dear all, I'm newbie in multithread programming.I'm practicing that.Now i have written following code : My code : #include #include #include int g1=0; int g2=0; void task1(int *counter); void task2(int *counter); int main(int argc,char *argv[]) { pthread_t *thr1,*thr2; int ret; if ((ret = pthread_create(&thr1,NULL,(void *)task1,(void *)&g1))) { perror("pthread_create : task1"); exit(EXIT_FAILURE); } if ((ret = pthread_create(&thr2,NULL,(void *)task2,(void *)&g2))) { perror("pthread_create : task2"); exit(EXIT_FAILURE); } pthread_join(thr2,NULL); pthread_join(thr1,NULL); cleanup(g1,g2); exit(EXIT_SUCCESS); }//end of main program void task1(int *counter) { while(*counter < 5 ){ printf("task1 count: %d\n",*counter); (*counter)++; }//end of while }//end of task1 function void task2(int *counter) { while(*counter < 5 ){ printf("task2 count: %d\n",*counter); (*counter)++; }//end of while }//end of task1 function void cleanup(int counter1,int counter2) { printf("Total iterations: %d\n",counter1+counter2); }//end of cleanup function ///////////////////////////END OF CODE//////////////////////////////////////////////////////// Now when i compile it, I receive following errors: mohsen@debian:~/test/learning/pthread$ make gcc -c test.c In file included from test.c:3: /usr/include/pthread.h:285: error: conflicting types for ???pthread_t??? /usr/include/bits/pthreadtypes.h:152: error: previous declaration of ???pthread_t??? was here /usr/include/pthread.h:286: error: conflicting types for ???pthread_attr_t??? /usr/include/bits/pthreadtypes.h:54: error: previous declaration of ???pthread_attr_t??? was here /usr/include/pthread.h:287: error: conflicting types for ???pthread_key_t??? /usr/include/bits/pthreadtypes.h:82: error: previous declaration of ???pthread_key_t??? was here /usr/include/pthread.h:289: error: conflicting types for ???pthread_mutexattr_t??? /usr/include/bits/pthreadtypes.h:102: error: previous declaration of ???pthread_mutexattr_t??? was here /usr/include/pthread.h:290: error: conflicting types for ???pthread_mutex_t??? /usr/include/bits/pthreadtypes.h:95: error: previous declaration of ???pthread_mutex_t??? was here /usr/include/pthread.h:291: error: conflicting types for ???pthread_condattr_t??? /usr/include/bits/pthreadtypes.h:79: error: previous declaration of ???pthread_condattr_t??? was here /usr/include/pthread.h:292: error: conflicting types for ???pthread_cond_t??? /usr/include/bits/pthreadtypes.h:72: error: previous declaration of ???pthread_cond_t??? was here test.c: In function ???main???: test.c:13: warning: passing argument 1 of ???pthread_create??? from incompatible pointer type test.c:19: warning: passing argument 1 of ???pthread_create??? from incompatible pointer type test.c:26: warning: passing argument 1 of ???pthread_join??? from incompatible pointer type test.c:27: warning: passing argument 1 of ???pthread_join??? from incompatible pointer type test.c: At top level: test.c:48: warning: conflicting types for ???cleanup??? test.c:29: warning: previous implicit declaration of ???cleanup??? was here make: *** [main.o] Error 1 mohsen@debian:~/test/learning/pthread$ ////////////////////////////////////// I have retrieved libdir & includedir with pthread_config command. Please help me ..... Yours,Mohsen -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGBG2a/ZBAvBh9bHIRArwvAJ429vihIW7mqsNq4U76vrzCHi7zcwCbBpC3 O07y29P5zpUjfirZOV1vbBk= =5N0e -----END PGP SIGNATURE----- From eljay@adobe.com Fri Mar 23 21:21:00 2007 From: eljay@adobe.com (John (Eljay) Love-Jensen) Date: Fri, 23 Mar 2007 21:21:00 -0000 Subject: pthread & its bug References: <46046D9B.7030607@pahlevanzadeh.org> Message-ID: Hi Mohsen, Your inquiry is off topic for this forum. I do not say this to chastize you. I say it because you may get better / faster / more accurate information from a more appropriate forum that is pthread savvy. There are a whole bunch of errors in your test source code. For example, the pthread_create's third parameter takes a function pointer to a function that looks like: void* task(void* ptr); You are passing in a function pointer to a function that looks like: void task(int* counter); And you are casting the function pointer to a data pointer: (void*)task1 That doesn't fit. Another example, pthread_create's first parameter takes a pointer to a pthread_t. You are passing in a poiter to a pointer to a pthread_t. (And that pointer-to-a-pointer has not been allocated anywhere.) That doesn't fit. Work through all the mismatched data types, and then see where things end up. GCC helps you, by emitting a lot of warnings and errors. Heed them. Don't forget to: gcc test.c -lpthread HTH, --Eljay From bjensen@fastmail.fm Fri Mar 23 22:57:00 2007 From: bjensen@fastmail.fm (bjorn rohde jensen) Date: Fri, 23 Mar 2007 22:57:00 -0000 Subject: pthread & its bug In-Reply-To: References: <46046D9B.7030607@pahlevanzadeh.org> Message-ID: <460444B8.4020003@fastmail.fm> John (Eljay) Love-Jensen wrote: > Hi Mohsen, > > Your inquiry is off topic for this forum. I do not say this to chastize you. I say it because you may get better / faster / more accurate information from a more appropriate forum that is pthread savvy. > > There are a whole bunch of errors in your test source code. > > For example, the pthread_create's third parameter takes a function pointer to a function that looks like: > > void* task(void* ptr); > > You are passing in a function pointer to a function that looks like: > > void task(int* counter); > > And you are casting the function pointer to a data pointer: > > (void*)task1 > > That doesn't fit. > > Another example, pthread_create's first parameter takes a pointer to a pthread_t. You are passing in a poiter to a pointer to a pthread_t. (And that pointer-to-a-pointer has not been allocated anywhere.) > > That doesn't fit. > > Work through all the mismatched data types, and then see where things end up. GCC helps you, by emitting a lot of warnings and errors. Heed them. > > Don't forget to: > > gcc test.c -lpthread > > HTH, > --Eljay You might want to define your task functions to have the type expected by phtread_create instead of casting them, something like; void *task1(void *p) { int *counter=(int *)p; while(*counter < 5 ){ printf("task1 count: %d\n",*counter); (*counter)++; } return NULL; } The type system is there to help you, dont cast things unless you really need to. From rbaverst@engmail.uwaterloo.ca Fri Mar 23 23:01:00 2007 From: rbaverst@engmail.uwaterloo.ca (Richard Baverstock) Date: Fri, 23 Mar 2007 23:01:00 -0000 Subject: Forcing use of move instead of movem on M68k (5200/5307) In-Reply-To: References: <9D2873BB-D515-48E4-8DE5-69C17EB89470@engmail.uwaterloo.ca> Message-ID: <5333517B-B1DB-4C16-8831-19B245B26426@engmail.uwaterloo.ca> We're using 2.95.3 and 3.4.6 (tried both versions), so nothing really recent. Trying the most recent one (4.1.2) would be a better idea? Or would a more recent version of the 3.x series be better? Thanks, Richard On Mar 23, 2007, at 12:15 PM, Ian Lance Taylor wrote: > Richard Baverstock writes: > >> We're having an issue with movem on the coldfire boards we are >> compiling a program for, and wondering if we can force the m68k gcc >> compiler to use move instead of movem. movem does not appear to be >> working on whatever chip variant we have, which severely affects >> returning from functions. Using the coldfire 5307, tried compiling >> with -m5200 and -m5307, both use movem. > > Unfortunately there is no option to disable movem. You would have to > change the compiler source code. > > The ColdFire does support movem, although it doesn't support all > variants. You didn't mention which version of gcc you are using. > There have been improvements to the ColdFire support in recent > releases. > > Ian From iant@google.com Sat Mar 24 08:30:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Sat, 24 Mar 2007 08:30:00 -0000 Subject: Forcing use of move instead of movem on M68k (5200/5307) In-Reply-To: <5333517B-B1DB-4C16-8831-19B245B26426@engmail.uwaterloo.ca> References: <9D2873BB-D515-48E4-8DE5-69C17EB89470@engmail.uwaterloo.ca> <5333517B-B1DB-4C16-8831-19B245B26426@engmail.uwaterloo.ca> Message-ID: Richard Baverstock writes: > We're using 2.95.3 and 3.4.6 (tried both versions), so nothing really > recent. > > Trying the most recent one (4.1.2) would be a better idea? Or would a > more recent version of the 3.x series be better? Certainly the support for ColdFire has improved in 4.1.2. I don't know whether this specific problem has been fixed. Ian From olecom@flower.upol.cz Sat Mar 24 09:51:00 2007 From: olecom@flower.upol.cz (Oleg Verych) Date: Sat, 24 Mar 2007 09:51:00 -0000 Subject: Optimisation puzzle References: <45FA852C.1090904@home.se> Message-ID: > From: me > Newsgroups: gmane.comp.gcc.help > Subject: Re: Optimisation puzzle > Date: Wed, 21 Mar 2007 05:24:15 +0100 [] > Maybe this somehow linked to the fact, that parameter by value are always > copied and there's no way for caller to know about what happened to that > *copy*. E.g. "void q(const unsigned int b);" means b is read-only inside q, > but any caller sets up b for q, i.e it create/change it. Similar to semantics, described here: > q: _mtune=k8_ q: _mtune=nocona_ > ..LFB2: .LFB2: > mov %edi, %edi *NOTE* movsd a(%rip), %xmm1 > movlpd a(%rip), %xmm1 mov %edi, %edi *NOTE* This ones are still a puzzle (or need rtfm :)... _____ From lynx.abraxas@freenet.de Sat Mar 24 11:12:00 2007 From: lynx.abraxas@freenet.de (lynx.abraxas@freenet.de) Date: Sat, 24 Mar 2007 11:12:00 -0000 Subject: inline asm: How to push PIC reg before seven input operands get loaded? Message-ID: <20070324095148.GB1837@drago.uni-regensburg.de> Hallo! I got a bit further with my problem. Now I'm stuck on how to save the register used when -fPIC is enabled to the stack before my seven input operands, needing all registers, get loaded. Is that somehow possible? I couldn't find any examples on the net. It seems not to be necessary in the original code for MSC. Also I wonder which -f option that comes with -O2 makes gcc stop reporting: error: can't find a register in class 'LEGACY_REGS' while reloading 'asm' Thanks. Lynx From aph@redhat.com Sat Mar 24 12:23:00 2007 From: aph@redhat.com (Andrew Haley) Date: Sat, 24 Mar 2007 12:23:00 -0000 Subject: inline asm: How to push PIC reg before seven input operands get loaded? In-Reply-To: <20070324095148.GB1837@drago.uni-regensburg.de> References: <20070324095148.GB1837@drago.uni-regensburg.de> Message-ID: <17925.1912.101064.171511@zebedee.pink> lynx.abraxas@freenet.de writes: > > I got a bit further with my problem. Now I'm stuck on how to save > the register used when -fPIC is enabled to the stack before my > seven input operands, needing all registers, get loaded. Is that > somehow possible? I couldn't find any examples on the net. It seems > not to be necessary in the original code for MSC. I doubt very much thath is possible. > Also I wonder which -f option that comes with -O2 makes gcc stop reporting: > error: can't find a register in class 'LEGACY_REGS' while reloading 'asm' I guess this is a joke. Andrew. From lynx.abraxas@freenet.de Sat Mar 24 14:58:00 2007 From: lynx.abraxas@freenet.de (lynx.abraxas@freenet.de) Date: Sat, 24 Mar 2007 14:58:00 -0000 Subject: inline asm: How to push PIC reg before seven input operands get loaded? In-Reply-To: <17925.1912.101064.171511@zebedee.pink> References: <20070324095148.GB1837@drago.uni-regensburg.de> <17925.1912.101064.171511@zebedee.pink> Message-ID: <20070324122324.GA3154@drago.uni-regensburg.de> On 24/03/07 11:11:52, Andrew Haley wrote: > > I got a bit further with my problem. Now I'm stuck on how to save > > the register used when -fPIC is enabled to the stack before my > > seven input operands, needing all registers, get loaded. Is that > > somehow possible? I couldn't find any examples on the net. It seems > > not to be necessary in the original code for MSC. > > I doubt very much thath is possible. Thanks for Your answer. I then wonder why gcc doesn't let me load the registers from the memory myself. If I do eg: Pixel16 *tileData[4]; uint16 *pDestPixel; Pixel16 *dataPtr, *transDataPtr; sint32 startX, endX; __asm__ __volatile__ ( "push %%ebx \n\t" // save reg for PIC! //code here using %1 but now reg can be rused: "movl %5, %1 \n\t" //no reg left for %5 when gcc should handel it //but now gcc says: //error: memory input 5 is not directly addressable "movl (%1,%%ebx,4), %1 \n\t" //instead of "movl (%5,%%ebx,4), %1 \n\t" //because m for %5 didn't work here //more code using also ebx and ebp "pop %%ebx \n\t" // restore reg for PIC! : : "D" (pDestPixel), "d" (endX), "c" (startX), "a" (transDataPtr), "S" (dataPtr), "m" (tileData) : "cc" //don't tell gcc about what was done to ebx because of PIC!!! ); gcc complains about: error: memory input 5 is not directly addressable Why is that? How else should I load the tileData pointer from memory into a register? > > Also I wonder which -f option that comes with -O2 makes gcc stop reporting: > > error: can't find a register in class 'LEGACY_REGS' while reloading 'asm' > > I guess this is a joke. No, it isn't. I wouldn't have asked else wise... Is it the combination of all -f options in -O2? I coudn't find a single obviouse one in the manpage. Is it a rule then to include -O2 or higher if inline asm is used??? > > Andrew. Thanks Andrew. Lynx From tprince@myrealbox.com Sat Mar 24 18:17:00 2007 From: tprince@myrealbox.com (Timothy C Prince) Date: Sat, 24 Mar 2007 18:17:00 -0000 Subject: installing gcc4.1.2 Message-ID: <1174748293.c7c91b9ctprince@myrealbox.com> -----Original Message----- From: "Annapoorna R" To: gcc-help@gcc.gnu.org Date: Fri, 23 Mar 2007 14:08:48 +0530 Subject: installing gcc4.1.2 ..-- should i do configure for both core and java seperately? ______________________________________ configure flag ---enable-languages='c,java' should accomplish it _____________________________________ -- confused with srcdir and objdir what you have mentioned. - does objdir means the dir where i want to install it? and srcdir is the dir where it got extracted. _____________________________________________ You must configure and build in a directory (objdir) separate from the source and install paths. Tim Prince From aph@redhat.com Sat Mar 24 19:21:00 2007 From: aph@redhat.com (Andrew Haley) Date: Sat, 24 Mar 2007 19:21:00 -0000 Subject: inline asm: How to push PIC reg before seven input operands get loaded? In-Reply-To: <20070324122324.GA3154@drago.uni-regensburg.de> References: <20070324095148.GB1837@drago.uni-regensburg.de> <17925.1912.101064.171511@zebedee.pink> <20070324122324.GA3154@drago.uni-regensburg.de> Message-ID: <17925.27411.531144.236075@zebedee.pink> lynx.abraxas@freenet.de writes: > On 24/03/07 11:11:52, Andrew Haley wrote: > > > I got a bit further with my problem. Now I'm stuck on how to save > > > the register used when -fPIC is enabled to the stack before my > > > seven input operands, needing all registers, get loaded. Is that > > > somehow possible? I couldn't find any examples on the net. It seems > > > not to be necessary in the original code for MSC. > > > > I doubt very much thath is possible. > > Thanks for Your answer. I then wonder why gcc doesn't let me load > the registers from the memory myself. > If I do eg: > > Pixel16 *tileData[4]; uint16 *pDestPixel; Pixel16 *dataPtr, *transDataPtr; > sint32 startX, endX; > __asm__ __volatile__ ( > "push %%ebx \n\t" // save reg for PIC! > //code here using %1 but now reg can be rused: > > "movl %5, %1 \n\t" //no reg left for %5 when gcc should handel it > //but now gcc says: > //error: memory input 5 is not directly addressable > "movl (%1,%%ebx,4), %1 \n\t" //instead of "movl (%5,%%ebx,4), %1 \n\t" > //because m for %5 didn't work here > > //more code using also ebx and ebp > "pop %%ebx \n\t" // restore reg for PIC! > : > : "D" (pDestPixel), "d" (endX), "c" (startX), "a" (transDataPtr), "S" (dataPtr), "m" (tileData) > : "cc" //don't tell gcc about what was done to ebx because of PIC!!! > ); > > gcc complains about: error: memory input 5 is not directly addressable > Why is that? How else should I load the tileData pointer from > memory into a register? I wouldn't be using the "m" constraint for this. Pass in the pointer as an operand using constraint "r" or "g". Something like "g"(&tileData); Can you post some small sample code? Make it the shortest possible programs that shows your problem. Make sure all the types it needs are defined. > > > Also I wonder which -f option that comes with -O2 makes gcc stop reporting: > > > error: can't find a register in class 'LEGACY_REGS' while reloading 'asm' > > > > I guess this is a joke. > > No, it isn't. I wouldn't have asked else wise... Reload has run out of registers. It's telling you that it needs another one. A -f option is not going to give reload another register. > Is it the combination of all -f options in -O2? I coudn't find a > single obviouse one in the manpage. Is it a rule then to include > -O2 or higher if inline asm is used??? No, there's no such rule. You've run out of registers. gcc needs one or two spare registers to work with. The x86 has eight, some of which are used for special purposes. You are using five in your asm. This is a very tight situation. Andrew. From lynx.abraxas@freenet.de Sat Mar 24 20:28:00 2007 From: lynx.abraxas@freenet.de (lynx.abraxas@freenet.de) Date: Sat, 24 Mar 2007 20:28:00 -0000 Subject: inline asm: How to push PIC reg before seven input operands get loaded? In-Reply-To: <17925.27411.531144.236075@zebedee.pink> References: <20070324095148.GB1837@drago.uni-regensburg.de> <17925.1912.101064.171511@zebedee.pink> <20070324122324.GA3154@drago.uni-regensburg.de> <17925.27411.531144.236075@zebedee.pink> Message-ID: <20070324192056.GA1938@drago.uni-regensburg.de> On 24/03/07 18:16:51, Andrew Haley wrote: > > If I do eg: > > > > Pixel16 *tileData[4]; uint16 *pDestPixel; Pixel16 *dataPtr, *transDataPtr; > > sint32 startX, endX; > > __asm__ __volatile__ ( > > "push %%ebx \n\t" // save reg for PIC! > > //code here using %1 but now reg can be rused: > > > > "movl %5, %1 \n\t" //no reg left for %5 when gcc should handel it > > //but now gcc says: > > //error: memory input 5 is not directly addressable > > "movl (%1,%%ebx,4), %1 \n\t" //instead of "movl (%5,%%ebx,4), %1 \n\t" > > //because m for %5 didn't work here > > > > //more code using also ebx and ebp > > "pop %%ebx \n\t" // restore reg for PIC! > > : > > : "D" (pDestPixel), "d" (endX), "c" (startX), "a" (transDataPtr), "S" (dataPtr), "m" (tileData) > > > : "cc" //don't tell gcc about what was done to ebx because of PIC!!! > > ); > > > > gcc complains about: error: memory input 5 is not directly addressable > > > Why is that? How else should I load the tileData pointer from > > memory into a register? > > I wouldn't be using the "m" constraint for this. Pass in the pointer > as an operand using constraint "r" or "g". Something like "g"(&tileData); > > Can you post some small sample code? Make it the shortest possible > programs that shows your problem. Make sure all the types it needs > are defined. This is a problem. My task is to tranlate this inline asm written for MSC to gcc. It's from a big game (Call to Power II, CTP2). I've attached a file with the function that contains the code. But it won't compile withou a lot modifications outside the source tree. At L131 my translation starts. It has the constrains I got it to compile with but segfaults then. I noticed that using any other var than tileData works with "m". Could it be a problem for gcc to use the double pointer here: Pixel16 **tileData ? > > > > > Also I wonder which -f option that comes with -O2 makes gcc stop reporting: > > > > error: can't find a register in class 'LEGACY_REGS' while reloading 'asm' > > > > > > I guess this is a joke. > > > > No, it isn't. I wouldn't have asked else wise... > > Reload has run out of registers. It's telling you that it needs > another one. A -f option is not going to give reload another > register. The point is, if I just add -O2 to the g++ cammand, this error disappears without having changed anything in the code or the number of register the part uses. It seems that an option in -O2 or above lets g++ be able to cope with the registers I have left it (ebx and ebp, esp). I found this solution quite often on the net. > > > Is it the combination of all -f options in -O2? I coudn't find a > > single obviouse one in the manpage. Is it a rule then to include > > -O2 or higher if inline asm is used??? > > No, there's no such rule. You've run out of registers. > > gcc needs one or two spare registers to work with. The x86 has eight, > some of which are used for special purposes. You are using five in > your asm. This is a very tight situation. Compiling all this with -fomit-frame-pointer: Can gcc not push all registers, and give me all seven without esp? I also tryed to use "R" instead of "m" for tileData. It compiled without errors even when I had specified -fPIC. -fPIC seems to use ebx so I pushed and poped that in my asm code. But when looking at the disassembly I had to see gcc used ebx for tileData and not ebp. But if I specified "b" it complains about: error: PIC register %ebx clobbered in asm Is this a bug in gcc??? Is there a constraint just for ebp so I don't have to use "R" and hope it gets into ebp? > > Andrew. Thanks Andrew Lynx -------------- next part -------------- compiled with: g++ -DHAVE_CONFIG_H -I. -I. -I../../../ctp2_code/os/include -I../../../ctp2_code/os/nowin32 -I../../../ctp2_code -I../../.. -I../../../ctp2_code/os/include -I../../../ctp2_code/ctp -I../../../ctp2_code/ctp/ctp2_utils -I../../../ctp2_code/ctp/ctp2_rsrc -I../../../ctp2_code/ctp/debugtools -I../../../ctp2_code/ui/interface -I../../../ctp2_code/ui/netshell -I../../../ctp2_code/robot/utility -I../../../ctp2_code/robot/pathing -I../../../ctp2_code/robot/aibackdoor -I../../../ctp2_code/gfx/spritesys -I../../../ctp2_code/gfx/tilesys -I../../../ctp2_code/gfx/gfx_utils -I../../../ctp2_code/gs/database -I../../../ctp2_code/gs/fileio -I../../../ctp2_code/gs/gameobj -I../../../ctp2_code/gs/utility -I../../../ctp2_code/gs/world -I../../../ctp2_code/net/io -I../../../ctp2_code/net/general -I../../../ctp2_code/ui/aui_utils -I../../../ctp2_code/ui/aui_sdl -I../../../ctp2_code/ui/aui_directx -I../../../ctp2_code/ui/aui_ctp2 -I../../../ctp2_code/ui/aui_common -I../../../ctp2_code/libs/anet/h -I../../../ctp2_code/mm -I../../../ctp2_code/robotcom/backdoor -I../../../ctp2_code/gs/slic -I../../../ctp2_code/gs/slic -I../../../ctp2_code/gfx/layers -I../../../ctp2_code/mapgen -I../../../ctp2_code/ui/freetype -I../../../ctp2_code/sound -I../../../ctp2_code/GameWatch/gamewatch -I../../../ctp2_code/GameWatch/gwciv -I../../../ctp2_code/ctp/fingerprint -I../../../ctp2_code/ui/slic_debug -I../../../ctp2_code/gs/outcom -I../../../ctp2_code/ctp -I../../../ctp2_code/ui/aui_common -I../../../ctp2_code/ui/ldl -I../../../ctp2_code/ui/ldl -I../../../ctp2_code/gs/events -I../../../ctp2_code/gs/newdb -I../../../ctp2_code/gs/newdb -I../../../ctp2_code/ai/diplomacy -I../../../ctp2_code/ai/mapanalysis -I../../../ctp2_code/ai/strategy/scheduler -I../../../ctp2_code/ai/strategy/agents -I../../../ctp2_code/ai/strategy/goals -I../../../ctp2_code/ai/strategy/squads -I../../../ctp2_code/ai -I../../../ctp2_code/ai/CityManagement -I/usr/local/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/X11R6/include -Wall -Wno-unused-variable -fms-extensions -fmessage-length=0 -frtti -fexceptions -g -O2 -fomit-frame-pointer -MT tiledraw.lo -MD -MP -MF .deps/tiledraw.Tpo -c tiledraw.cpp -fPIC -DPIC -fleading-underscore -o .libs/tiledraw.o void TiledMap::DrawTransitionTileScaled(aui_Surface *surface, const MapPoint &pos, sint32 x, sint32 y, sint32 destWidth, sint32 destHeight) { Pixel16 *dataPtr; sint32 x, y; sint32 startX, endX; TileInfo *tileInfo; BaseTile *baseTile, *transitionBuffer; uint16 index; Pixel16 *transData, *transDataPtr; static Pixel16 defaultPixel[4] = {0xf800, 0x07e0, 0x001f, 0xf81f}; if (!surface) surface = m_surface; ypos+=k_TILE_PIXEL_HEADROOM; if (xpos < 0) return; if (xpos > surface->Width() - k_TILE_PIXEL_WIDTH) return; if (ypos < 0) return; if (ypos > surface->Height() - k_TILE_PIXEL_HEIGHT) return; tileInfo = GetTileInfo(pos); Assert(tileInfo != NULL); if (tileInfo == NULL) return; index = tileInfo->GetTileNum(); baseTile = m_tileSet->GetBaseTile(index); if (baseTile == NULL) return; Pixel16 *data = baseTile->GetTileData(); Pixel16 *tileData[4]; sint32 tilesetIndex = g_theTerrainDB->Get(tileInfo->GetTerrainType())->GetTilesetIndex(); uint16 tilesetIndex_short = (uint16) tilesetIndex; #ifdef _DEBUG Assert(tilesetIndex == ((sint32) tilesetIndex_short)); #endif tileData[0] = m_tileSet->GetTransitionData(tilesetIndex_short, tileInfo->GetTransition(0), 0); tileData[1] = m_tileSet->GetTransitionData(tilesetIndex_short, tileInfo->GetTransition(1), 1); tileData[2] = m_tileSet->GetTransitionData(tilesetIndex_short, tileInfo->GetTransition(2), 2); tileData[3] = m_tileSet->GetTransitionData(tilesetIndex_short, tileInfo->GetTransition(3), 3); transitionBuffer = m_tileSet->GetBaseTile(static_cast((tilesetIndex * 100) + 99)); if(transitionBuffer) { transData = transitionBuffer->GetTileData(); transDataPtr = transData; } else { transData = NULL; transDataPtr = NULL; } dataPtr = data; uint8 *pSurfBase; pSurfBase = m_surfBase; sint32 surfWidth = m_surfWidth; sint32 surfHeight = m_surfHeight; sint32 surfPitch = m_surfPitch; Pixel16 srcPixel, transPixel = 0; uint16 *pDestPixel = (Pixel16 *)(pSurfBase + ypos * surfPitch + 2 * xpos); { for (y=0; y>1); } } } From tprince@myrealbox.com Sat Mar 24 20:42:00 2007 From: tprince@myrealbox.com (Timothy C Prince) Date: Sat, 24 Mar 2007 20:42:00 -0000 Subject: inline asm: How to push PIC reg before seven input operands get loaded? Message-ID: <1174768131.c7c2e05ctprince@myrealbox.com> -----Original Message----- From: lynx.abraxas@freenet.de To: gcc-help@gcc.gnu.org, Andrew Haley Date: Sat, 24 Mar 2007 20:20:56 +0100 Subject: Re: inline asm: How to push PIC reg before seven input operands get loaded? This is a problem. My task is to tranlate this inline asm written for MSC to gcc. It's from a big game (Call to Power II, CTP2). I've attached a file with the function that contains the code. But it won't compile withou a lot modifications outside the source tree. ________________________________________ Commercial compilers, including icc, have options to accept MS asm and compile for linux. If you're going to spend time on source translation, you'd likely get better results with C. Tim Prince From aph@redhat.com Sat Mar 24 22:15:00 2007 From: aph@redhat.com (Andrew Haley) Date: Sat, 24 Mar 2007 22:15:00 -0000 Subject: inline asm: How to push PIC reg before seven input operands get loaded? In-Reply-To: <20070324192056.GA1938@drago.uni-regensburg.de> References: <20070324095148.GB1837@drago.uni-regensburg.de> <17925.1912.101064.171511@zebedee.pink> <20070324122324.GA3154@drago.uni-regensburg.de> <17925.27411.531144.236075@zebedee.pink> <20070324192056.GA1938@drago.uni-regensburg.de> Message-ID: <17925.36122.323917.231376@zebedee.pink> lynx.abraxas@freenet.de writes: > On 24/03/07 18:16:51, Andrew Haley wrote: > > > If I do eg: > > > > > > Pixel16 *tileData[4]; uint16 *pDestPixel; Pixel16 *dataPtr, *transDataPtr; > > > sint32 startX, endX; > > > __asm__ __volatile__ ( > > > "push %%ebx \n\t" // save reg for PIC! > > > //code here using %1 but now reg can be rused: > > > > > > "movl %5, %1 \n\t" //no reg left for %5 when gcc should handel it > > > //but now gcc says: > > > //error: memory input 5 is not directly addressable > > > "movl (%1,%%ebx,4), %1 \n\t" //instead of "movl (%5,%%ebx,4), %1 \n\t" > > > //because m for %5 didn't work here > > > > > > //more code using also ebx and ebp > > > "pop %%ebx \n\t" // restore reg for PIC! > > > : > > > : "D" (pDestPixel), "d" (endX), "c" (startX), "a" (transDataPtr), "S" (dataPtr), "m" (tileData) > > > > > : "cc" //don't tell gcc about what was done to ebx because of PIC!!! > > > ); > > > > > > gcc complains about: error: memory input 5 is not directly addressable > > > > > Why is that? How else should I load the tileData pointer from > > > memory into a register? > > > > I wouldn't be using the "m" constraint for this. Pass in the pointer > > as an operand using constraint "r" or "g". Something like "g"(&tileData); > > > > Can you post some small sample code? Make it the shortest possible > > programs that shows your problem. Make sure all the types it needs > > are defined. > > This is a problem. My task is to tranlate this inline asm written for MSC to > gcc. It's from a big game (Call to Power II, CTP2). I've attached a file with > the function that contains the code. But it won't compile withou a lot > modifications outside the source tree. And you can't figure out how to provide the typedefs it needs... > At L131 my translation starts. It has the constrains I got it to compile with > but segfaults then. I noticed that using any other var than tileData works > with "m". Could it be a problem for gcc to use the double pointer here: > Pixel16 **tileData ? > > > > > Also I wonder which -f option that comes with -O2 makes gcc stop > reporting: > > > > > error: can't find a register in class 'LEGACY_REGS' while reloading > 'asm' > > > > > > > > I guess this is a joke. > > > > > > No, it isn't. I wouldn't have asked else wise... > > > > Reload has run out of registers. It's telling you that it needs > > another one. A -f option is not going to give reload another > > register. > > The point is, if I just add -O2 to the g++ cammand, this error disappears > without having changed anything in the code or the number of register the part > uses. Sure, because gcc is optimizing, and thus it uses fewer registers. > It seems that an option in -O2 or above lets g++ be able to cope with the > registers I have left it (ebx and ebp, esp). I found this solution quite often > on the net. > > > Is it the combination of all -f options in -O2? I coudn't find a > > > single obviouse one in the manpage. Is it a rule then to include > > > -O2 or higher if inline asm is used??? > > > > No, there's no such rule. You've run out of registers. > > > > gcc needs one or two spare registers to work with. The x86 has eight, > > some of which are used for special purposes. You are using five in > > your asm. This is a very tight situation. > > Compiling all this with -fomit-frame-pointer: > > Can gcc not push all registers, and give me all seven without esp? > > I also tryed to use "R" instead of "m" for tileData. It compiled > without errors even when I had specified -fPIC. Excellent. That one is solved, then. > -fPIC seems to use ebx so I pushed and poped that in my asm > code. But when looking at the disassembly I had to see gcc used ebx > for tileData and not ebp. OK. > But if I specified "b" it complains about: error: PIC register > %ebx clobbered in asm > > Is this a bug in gcc??? Is there a constraint just for ebp so I > don't have to use "R" and hope it gets into ebp? Why do you care that it is in ebp? Why do you not allow gcc to choose the register? You seem to want to use explicit registers in your asm, but I can't see any reason why you want to do that. gcc usually works better when you let gcc choose the registers. Andrew. From lynx.abraxas@freenet.de Sun Mar 25 01:08:00 2007 From: lynx.abraxas@freenet.de (lynx.abraxas@freenet.de) Date: Sun, 25 Mar 2007 01:08:00 -0000 Subject: inline asm: How to push PIC reg before seven input operands get loaded? In-Reply-To: <17925.36122.323917.231376@zebedee.pink> References: <20070324095148.GB1837@drago.uni-regensburg.de> <17925.1912.101064.171511@zebedee.pink> <20070324122324.GA3154@drago.uni-regensburg.de> <17925.27411.531144.236075@zebedee.pink> <20070324192056.GA1938@drago.uni-regensburg.de> <17925.36122.323917.231376@zebedee.pink> Message-ID: <20070324221539.GA5159@drago.uni-regensburg.de> On 24/03/07 20:42:02, Andrew Haley wrote: > > This is a problem. My task is to tranlate this inline asm written for MSC to > > gcc. It's from a big game (Call to Power II, CTP2). I've attached a file with > > the function that contains the code. But it won't compile withou a lot > > modifications outside the source tree. > > And you can't figure out how to provide the typedefs it needs... > > > At L131 my translation starts. It has the constrains I got it to compile with > > but segfaults then. I noticed that using any other var than tileData works > > with "m". Could it be a problem for gcc to use the double pointer here: > > Pixel16 **tileData ? > > > > The point is, if I just add -O2 to the g++ cammand, this error disappears > > without having changed anything in the code or the number of register the part > > uses. > > Sure, because gcc is optimizing, and thus it uses fewer registers. Is there then an option to gcc that lets gcc push all registers before asm so that I can use what I need without having to hope gcc lets me use all registers? > > Compiling all this with -fomit-frame-pointer: > > > > Can gcc not push all registers, and give me all seven without esp? > > > > I also tryed to use "R" instead of "m" for tileData. It compiled > > without errors even when I had specified -fPIC. > > Excellent. That one is solved, then. > > > -fPIC seems to use ebx so I pushed and poped that in my asm > > code. But when looking at the disassembly I had to see gcc used ebx > > for tileData and not ebp. > > OK. No, because it makes me a hard night to get ebx stay unclobbered and then it just uses it itself! Why can't it use ebp which I left empty for gcc because I can't directly assign it to a variable. > > > But if I specified "b" it complains about: error: PIC register > > %ebx clobbered in asm > > > > Is this a bug in gcc??? Is there a constraint just for ebp so I > > don't have to use "R" and hope it gets into ebp? > > Why do you care that it is in ebp? Why do you not allow gcc to choose > the register? You seem to want to use explicit registers in your asm, > but I can't see any reason why you want to do that. gcc usually works > better when you let gcc choose the registers. > I tried with just "r". But then gcc complains about not enough registers as it seems not wanting to use ebp and it still doesn't want to give up on ebx for PIC. Another reason is I don't know how to specify a register in the asm code that is still empty. Like in my problem I need at least one empty register apart the six preloaded ones. I use ebx there, so I can circumvent the PIC problem. Is there a way to specify an empty register without a direct name? And %dx I use because there is no way mentioned in the docs how to reduce the size when using eg %3. Lynx From mohsen@pahlevanzadeh.org Sun Mar 25 14:18:00 2007 From: mohsen@pahlevanzadeh.org (Mohsen Pahlevanzadeh) Date: Sun, 25 Mar 2007 14:18:00 -0000 Subject: mean of an error Message-ID: <46063514.4070501@pahlevanzadeh.org> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Dear all, I wanna know when i receive "Conflicting types for 'x'" (x is a variable that it's mentioned to a data type),What does mean that error? Yours,Mohsen -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGBjUU/ZBAvBh9bHIRAl+DAJ9YhbzLoff9o/IBUEeyeh/fgq3N6gCcD8Cg j/QsKpS5jFgVSv3fmqIooCE= =NEPI -----END PGP SIGNATURE----- From rattan@cps.cmich.edu Sun Mar 25 15:37:00 2007 From: rattan@cps.cmich.edu (ISHWAR RATTAN) Date: Sun, 25 Mar 2007 15:37:00 -0000 Subject: mean of an error In-Reply-To: <46063514.4070501@pahlevanzadeh.org> References: <46063514.4070501@pahlevanzadeh.org> Message-ID: It means that there is data type conflict between usage and declaration. Correct data type for a function etc (from library/system call) are explicitly listed in the man page, and you must use/declare/define exactly like that. -ishwar On Sun, 25 Mar 2007, Mohsen Pahlevanzadeh wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Dear all, > I wanna know when i receive "Conflicting types for 'x'" (x is a > variable that it's mentioned to a data type),What does mean that error? > Yours,Mohsen > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.6 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iD8DBQFGBjUU/ZBAvBh9bHIRAl+DAJ9YhbzLoff9o/IBUEeyeh/fgq3N6gCcD8Cg > j/QsKpS5jFgVSv3fmqIooCE= > =NEPI > -----END PGP SIGNATURE----- > From aph@redhat.com Sun Mar 25 17:45:00 2007 From: aph@redhat.com (Andrew Haley) Date: Sun, 25 Mar 2007 17:45:00 -0000 Subject: inline asm: How to push PIC reg before seven input operands get loaded? In-Reply-To: <20070324221539.GA5159@drago.uni-regensburg.de> References: <20070324095148.GB1837@drago.uni-regensburg.de> <17925.1912.101064.171511@zebedee.pink> <20070324122324.GA3154@drago.uni-regensburg.de> <17925.27411.531144.236075@zebedee.pink> <20070324192056.GA1938@drago.uni-regensburg.de> <17925.36122.323917.231376@zebedee.pink> <20070324221539.GA5159@drago.uni-regensburg.de> Message-ID: <17926.38646.862945.296058@zebedee.pink> lynx.abraxas@freenet.de writes: > On 24/03/07 20:42:02, Andrew Haley wrote: > > Is there then an option to gcc that lets gcc push all registers before asm so > that I can use what I need without having to hope gcc lets me use all > registers? No. > > > But if I specified "b" it complains about: error: PIC register > > > %ebx clobbered in asm > > > > > > Is this a bug in gcc??? Is there a constraint just for ebp so I > > > don't have to use "R" and hope it gets into ebp? > > > > Why do you care that it is in ebp? Why do you not allow gcc to choose > > the register? You seem to want to use explicit registers in your asm, > > but I can't see any reason why you want to do that. gcc usually works > > better when you let gcc choose the registers. > > I tried with just "r". But then gcc complains about not enough > registers as it seems not wanting to use ebp and it still doesn't > want to give up on ebx for PIC. Please, give us a test case. > Another reason is I don't know how to specify a register in the asm > code that is still empty. Like in my problem I need at least one > empty register apart the six preloaded ones. I use ebx there, so I > can circumvent the PIC problem. Is there a way to specify an empty > register without a direct name? Sure, you just need to use an input/ouput register operand. It's in the docs. > And %dx I use because there is no way mentioned in the docs how to > reduce the size when using eg %3. How to reduce the size of what? This doesn't make any sense to me. Please, give us a test case. Andrew. From bazil@agenstvo.com Sun Mar 25 17:53:00 2007 From: bazil@agenstvo.com (Dmitriy Gorbenko) Date: Sun, 25 Mar 2007 17:53:00 -0000 Subject: Finding source files - No such file or directory Message-ID: <4606DF78.8050203@agenstvo.com> Hi. I have an trouble: some day under root user I compile program in /tmp/a directory. Next, I remove /tmp/a, logout from root into regular user, and tries to compile again same program, but now in my own home directory (from clean source code - no ojbect files, no libtool dependencies - only .cpp files). Then I started GDB, and tries to debug my program. I was confused: ---------------8<---------------------------------------------- Breakpoint 1, main (argc=2, argv=0x7fffdf192608) at cgateway.cpp:120 120 TAgent::postAgent(cmd, channel.c_str(), data, size); (gdb) step TAgent::postAgent (cmd=111, channel=0x50c3a8 "acm", retchannel=0x0, data=0x0, size=0, bAutoRemove=true, tid=0, safeData=0x0, safeDataSize=0) at Agent.cpp:132 132 Agent.cpp: No such file or directory in Agent.cpp (gdb) ---------------8<---------------------------------------------- When I restore /tmp/a directory, put where source code and start again GDB: ---------------8<---------------------------------------------- Breakpoint 1, main (argc=2, argv=0x7fffdb2aa728) at cgateway.cpp:120 120 TAgent::postAgent(cmd, channel.c_str(), data, size); (gdb) step TAgent::postAgent (cmd=111, channel=0x50c3a8 "acm", retchannel=0x0, data=0x0, size=0, bAutoRemove=true, tid=0, safeData=0x0, safeDataSize=0) at Agent.cpp:132 132 bool TAgent::postAgent(unsigned int cmd, const char* channel, const char* retchannel, void* data, size_t size, bool bAutoRemove, const pthread_t tid, void* safeData, size_t safeDataSize) (gdb) ---------------8<---------------------------------------------- I tries to get some info from GDB: (gdb) show directories Source directories searched: $cdir:$cwd (gdb) But no one hint to find /tmp/a directory. Could you tell me, how GDB knows about /tmp/a directory? Thanks. From aph@redhat.com Sun Mar 25 18:26:00 2007 From: aph@redhat.com (Andrew Haley) Date: Sun, 25 Mar 2007 18:26:00 -0000 Subject: Finding source files - No such file or directory In-Reply-To: <4606DF78.8050203@agenstvo.com> References: <4606DF78.8050203@agenstvo.com> Message-ID: <17926.46846.96819.570630@zebedee.pink> Dmitriy Gorbenko writes: > > But no one hint to find /tmp/a directory. > > Could you tell me, how GDB knows about /tmp/a directory? readelf --debug Look for the Directory Table entry. Andrew. From bazil@agenstvo.com Sun Mar 25 22:40:00 2007 From: bazil@agenstvo.com (Dmitriy Gorbenko) Date: Sun, 25 Mar 2007 22:40:00 -0000 Subject: Finding source files - No such file or directory In-Reply-To: <17926.46846.96819.570630@zebedee.pink> References: <4606DF78.8050203@agenstvo.com> <17926.46846.96819.570630@zebedee.pink> Message-ID: <4606E90E.1090803@agenstvo.com> Andrew Haley writes: > Dmitriy Gorbenko writes: > > > > But no one hint to find /tmp/a directory. > > > > Could you tell me, how GDB knows about /tmp/a directory? > > readelf --debug > > Look for the Directory Table entry. > > Andrew. > I resolve the problem by myself - I make a great mistake: I forgot type 'make install' - the program uses some libraries, and that libraries uses source files from /tmp/a directory. Stupid mistake. But thanks for `readelf` hint. From dima.sorkin@gmail.com Mon Mar 26 10:57:00 2007 From: dima.sorkin@gmail.com (Dima Sorkin) Date: Mon, 26 Mar 2007 10:57:00 -0000 Subject: member class Message-ID: Hi. It _seems_ that g++ -pedantic -Wall (any version) allows the nested member classes to access the private types of an enclosing class. Should it be this way? It is contrary to B.Stroustrup "The C++ prog lang" C.11.3 Regards, Dima. From aph@redhat.com Mon Mar 26 11:42:00 2007 From: aph@redhat.com (Andrew Haley) Date: Mon, 26 Mar 2007 11:42:00 -0000 Subject: member class In-Reply-To: References: Message-ID: <17927.42779.869626.882742@zebedee.pink> Dima Sorkin writes: > Hi. > It _seems_ that g++ -pedantic -Wall (any version) allows > the nested member classes to access the private types of > an enclosing class. > > Should it be this way? It is contrary to > B.Stroustrup "The C++ prog lang" C.11.3 It's a bit more complicated than that. Before you post a bug, have a look at 11.8, Nested Classes, in ISO/IEC 14882, Programming languages: C++. Andrew. From aph@redhat.com Mon Mar 26 11:48:00 2007 From: aph@redhat.com (Andrew Haley) Date: Mon, 26 Mar 2007 11:48:00 -0000 Subject: Where is ld.so and libdl.so built from In-Reply-To: <76EBE649FB0E0E4DA883B5840459059F143A4C2252@AA-EXMSG-C412.southpacific.corp.microsoft.com> References: <76EBE649FB0E0E4DA883B5840459059F143A4C2252@AA-EXMSG-C412.southpacific.corp.microsoft.com> Message-ID: <17927.45456.892788.31302@zebedee.pink> Mayank Kumar writes: > In gcc packages, I could not find ld.so and libdl.so > Binutils only contains ld. Redirected to gcc-help@gcc.gnu.org. Please don't ask user questions on the gcc mailing list. > Where can I find the gnu source code for libdl.so and ld.so In glibc. Andrew. From mayank@microsoft.com Mon Mar 26 17:28:00 2007 From: mayank@microsoft.com (Mayank Kumar) Date: Mon, 26 Mar 2007 17:28:00 -0000 Subject: Where is ld.so and libdl.so built from In-Reply-To: <17927.45456.892788.31302@zebedee.pink> References: <76EBE649FB0E0E4DA883B5840459059F143A4C2252@AA-EXMSG-C412.southpacific.corp.microsoft.com> <17927.45456.892788.31302@zebedee.pink> Message-ID: <76EBE649FB0E0E4DA883B5840459059F143A4C2255@AA-EXMSG-C412.southpacific.corp.microsoft.com> Thanks for your help, I will take care of this. Thanks Mayank -----Original Message----- From: Andrew Haley [mailto:aph@redhat.com] Sent: Monday, March 26, 2007 5:12 PM To: Mayank Kumar Cc: gcc-help@gcc.gnu.org Subject: Re: Where is ld.so and libdl.so built from Mayank Kumar writes: > In gcc packages, I could not find ld.so and libdl.so > Binutils only contains ld. Redirected to gcc-help@gcc.gnu.org. Please don't ask user questions on the gcc mailing list. > Where can I find the gnu source code for libdl.so and ld.so In glibc. Andrew. From kourama@teksavvy.com Mon Mar 26 18:09:00 2007 From: kourama@teksavvy.com (kourama) Date: Mon, 26 Mar 2007 18:09:00 -0000 Subject: "char *" diff in header & func arg list? Message-ID: <9677694.post@talk.nabble.com> I have noticed something that seems wrong to me, and I'd like to know if anyone can confirm the bug or explain the seemingly strange behaviour. Attached is a set of files which demonstrates the problem: http://www.nabble.com/file/7426/a.c a.c http://www.nabble.com/file/7427/b.c b.c http://www.nabble.com/file/7428/Makefile Makefile When the aa function in a.c declares "char *arg" in it's argument list, it gets a pointer, which means that "char *arg" is equivalent to "char arg[]" in the argument list. However, in the file b.c, the declaration "extern char *myarray" is treated differently from "extern char myarray[]" It seems to me that, based on the context, the two should be equivalent, but GCC doesn't treat them that way. So, is this a bug, legacy behaviour or is this just another wrinkle in the sharpei puppy that is C? Many thanks. -- View this message in context: http://www.nabble.com/%22char-*%22-diff-in-header---func-arg-list--tf3468423.html#a9677694 Sent from the gcc - Help mailing list archive at Nabble.com. From eljay@adobe.com Mon Mar 26 18:26:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Mon, 26 Mar 2007 18:26:00 -0000 Subject: "char *" diff in header & func arg list? In-Reply-To: <9677694.post@talk.nabble.com> Message-ID: Hi kourama, These two things are mostly interchangeable for most purposes as a parameter: char array[]; char* pointer; On the caller's side, arg1 degenerates into something that almost is the same as: char* const arg1; C proponents would say this is a good thing. I've been working in C++ long enough to consider it a bit of a wart (but C++ has far more atrocious warts than this to worry about), as part of the C legacy. However, this is an outright mismatch: extern char array[]; extern char* pointer; char array[] = "good"; char pointer[] = "bad"; Why? Because an array of characters is not a pointer to an array of characters. The declaration does not match the definition. > So, is this a bug, legacy behaviour or is this just another wrinkle in the sharpei puppy that is C? In this case, not a wrinkle, not a "legacy C" issue. It is a PEBKAC bug. HTH, --Eljay From kourama@teksavvy.com Mon Mar 26 23:40:00 2007 From: kourama@teksavvy.com (kourama) Date: Mon, 26 Mar 2007 23:40:00 -0000 Subject: "char *" diff in header & func arg list? In-Reply-To: References: <9677694.post@talk.nabble.com> Message-ID: <9678711.post@talk.nabble.com> John Love-Jensen wrote: > > Why? Because an array of characters is not a pointer to an array of > characters. The declaration does not match the definition. > Ah, of course. I was effectly casting the array to a pointer type in the extern declaration. Thanks. Honestly, am I dim or is that a subtle "gotcha"? eh...don't answer that. -- View this message in context: http://www.nabble.com/%22char-*%22-diff-in-header---func-arg-list--tf3468423.html#a9678711 Sent from the gcc - Help mailing list archive at Nabble.com. From viet@horslimites.org Mon Mar 26 23:49:00 2007 From: viet@horslimites.org (viet@horslimites.org) Date: Mon, 26 Mar 2007 23:49:00 -0000 Subject: _ZTV vs _ZTI Message-ID: <39242.198.73.165.1.1174952441.squirrel@courrier.horslimites.org> Hi, I have an archive file, when I do a nm on it, I can see. 00000000 V _ZTV13VLH_Container the compile option to create the objects for the archive (.a) is gcc -c -Wno-ctor-dtor-privacy -fno-rtti -MMD -pthread -Wno-deprecated -Wall -O2 I have an .so that link with the above archive, when I do an nm on it, I can see: U _ZTI13VLH_Container the compile option to creates objects for the .so is g++ -pipe -Wall -fPIC -rdynamic -g I'm guessing that the problem for the undefined symbol is a compile option. What is the difference between _ZTV and _ZTI? When linking my so, I put the archive at the end. Any idea? Regards, VLH From iant@google.com Tue Mar 27 01:17:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Tue, 27 Mar 2007 01:17:00 -0000 Subject: _ZTV vs _ZTI In-Reply-To: <39242.198.73.165.1.1174952441.squirrel@courrier.horslimites.org> References: <39242.198.73.165.1.1174952441.squirrel@courrier.horslimites.org> Message-ID: viet@horslimites.org writes: > I'm guessing that the problem for the undefined symbol is a compile > option. What is the difference between _ZTV and _ZTI? _ZTV is a virtual table. _ZTI is a typeinfo table (for RTTI). I don't know why you are seeing the undefined symbol in the .so. Ian From storri@torri.org Tue Mar 27 09:51:00 2007 From: storri@torri.org (Stephen Torri) Date: Tue, 27 Mar 2007 09:51:00 -0000 Subject: Command flags for debugging template code Message-ID: <1174958247.3599.15.camel@localhost.localdomain> I have a C++ project that uses the boost graph library. Now the reason I am emailing here is that I was wondering for general C++ code that uses templates what flags should I use to enable gdb to stop in a template function? For example if I had a header file that had: class Fruit { public: template void print_Contents ( Basket* container_ptr ) { std::cout << container_ptr->dump() << std::endl; } }; Assuming that I had a class that supported the function dump() I could then use this function. Well as I understand it the definition in the header for the function dump() will be inlined anywhere it is used in the code. Is that correct? If it is then unless I keep careful management of print_Contents I may not know its called. In the boost graph library there are a lot of ways certain functions are used but require a indepth understanding of which are called explicitly or implicitly. I would like such that if I used flags X, Y and Z with the g++ compiler I can call gdb to stop in function print_Contents. Do I make sense? Stephen From aph@redhat.com Tue Mar 27 11:43:00 2007 From: aph@redhat.com (Andrew Haley) Date: Tue, 27 Mar 2007 11:43:00 -0000 Subject: _ZTV vs _ZTI In-Reply-To: <39242.198.73.165.1.1174952441.squirrel@courrier.horslimites.org> References: <39242.198.73.165.1.1174952441.squirrel@courrier.horslimites.org> Message-ID: <17928.59652.476218.739876@zebedee.pink> viet@horslimites.org writes: > > I have an archive file, when I do a nm on it, I can see. > > 00000000 V _ZTV13VLH_Container vtable for VLH_Container > the compile option to create the objects for the archive (.a) is > > gcc -c -Wno-ctor-dtor-privacy -fno-rtti -MMD -pthread -Wno-deprecated > -Wall -O2 > > I have an .so that link with the above archive, when I do an nm on it, I > can see: > U _ZTI13VLH_Container typeinfo for VLH_Container > the compile option to creates objects for the .so is > > g++ -pipe -Wall -fPIC -rdynamic -g > > I'm guessing that the problem for the undefined symbol is a compile > option. What is the difference between _ZTV and _ZTI? They're totally different things. Andrew. From eljay@adobe.com Tue Mar 27 11:58:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Tue, 27 Mar 2007 11:58:00 -0000 Subject: Command flags for debugging template code In-Reply-To: <1174958247.3599.15.camel@localhost.localdomain> Message-ID: Hi Stephen, One of the problems with debugging (depending on the debugger and environment) is break points with inline functions. To give me a debug-able spot I can drop a breakpoint on, I've done this before: // --- Fruit.h --- void EljayBreakpoint(); class Fruit { public: template void print_Contents(Basket* container_ptr) { EljayBreakpoint(); std::cout << container_ptr->dump() << std::endl; } }; // --- Fruit.cpp --- #include "Fruit.h" void EljayBreakpoint() { std::cerr << "EljayBreakpoint: you are here\n"; } And then I set the breakpoint inside EljayBreakpoint. I now realize I haven't needed to do this trick in many years. So either the debuggers are better on the platforms I'm using and can sensically step into inline functions, or I'm making less boo-boos. HTH, --Eljay From jfranzoy@yahoo.com.ar Tue Mar 27 13:12:00 2007 From: jfranzoy@yahoo.com.ar (Juan Carlos Franzoy) Date: Tue, 27 Mar 2007 13:12:00 -0000 Subject: can __exchange_and_add be used from outside? Message-ID: <3426.14943.qm@web32709.mail.mud.yahoo.com> Hello. I write because I was wondering if __exchange_and_add can be used from user code or it's an internal detail of libstdc++. I have to implement a library with AtomicSet and AtomicAdd. The library must be portable across solaris/sparc, linux/x86 and hpux11/parisc. If the answer is no, do anybody know how to do it? Thanks. ------------------------------------------------------------ Juan Carlos Franzoy Proyect Leader mailto:jfranzoy@yahoo.com.ar ------------------------------------------------------------ __________________________________________________ Pregunt?. Respond?. Descubr?. Todo lo que quer?as saber, y lo que ni imaginabas, est? en Yahoo! Respuestas (Beta). ?Probalo ya! http://www.yahoo.com.ar/respuestas From iant@google.com Tue Mar 27 14:02:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Tue, 27 Mar 2007 14:02:00 -0000 Subject: can __exchange_and_add be used from outside? In-Reply-To: <3426.14943.qm@web32709.mail.mud.yahoo.com> References: <3426.14943.qm@web32709.mail.mud.yahoo.com> Message-ID: Juan Carlos Franzoy writes: > Hello. I write because I was wondering if __exchange_and_add can be used from user code or it's an internal detail of libstdc++. > > I have to implement a library with AtomicSet and AtomicAdd. The library must be portable across solaris/sparc, linux/x86 and hpux11/parisc. > > If the answer is no, do anybody know how to do it? gcc provides these calls as extensions: http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html Ian From rajesh.pethe@gmail.com Tue Mar 27 14:06:00 2007 From: rajesh.pethe@gmail.com (Rajesh Pethe) Date: Tue, 27 Mar 2007 14:06:00 -0000 Subject: Compiling gcc 3.3.2 on AIX 64 bit platform Message-ID: <6cf874de0703270702j5c41a92fq1cf49adfd3503535@mail.gmail.com> Hi All, I need to install gcc compiler on AIX ( powerpc-ibm-aix5.2.0.0 ) but there is no working C compiler available on host. Is building a native C compiler a solution for this? I tried doing that using 'sh configure --enable-bootstrap --prefix...' and it is still looking for a working compiler. Error - Assembler: /tmp/ccuFE7td.s: line 10: 1252-191 Only .llong should be used for relocatable expressions. *** The command 'gcc -o conftest -O2 conftest.c' failed. *** You must set the environment variable CC to a working compiler. I have already tried setting OBJECT_MODE environment variable. I have no idea why the C compiler is not working. Any inputs, links will be much appreciated. Regards Rajesh From storri@torri.org Tue Mar 27 14:17:00 2007 From: storri@torri.org (Stephen Torri) Date: Tue, 27 Mar 2007 14:17:00 -0000 Subject: Command flags for debugging template code In-Reply-To: References: Message-ID: <1175004353.3908.0.camel@localhost.localdomain> Thanks for the programming idea. That is certainly an easy way of doing what I want. Stephen On Tue, 2007-03-27 at 06:43 -0500, John Love-Jensen wrote: > Hi Stephen, > > One of the problems with debugging (depending on the debugger and > environment) is break points with inline functions. > > To give me a debug-able spot I can drop a breakpoint on, I've done this > before: > > // --- Fruit.h --- > void EljayBreakpoint(); > > class Fruit > { > public: > > template > void print_Contents(Basket* container_ptr) > { > EljayBreakpoint(); > std::cout << container_ptr->dump() << std::endl; > } > }; > > // --- Fruit.cpp --- > #include "Fruit.h" > void EljayBreakpoint() > { > std::cerr << "EljayBreakpoint: you are here\n"; > } > > And then I set the breakpoint inside EljayBreakpoint. > > I now realize I haven't needed to do this trick in many years. So either > the debuggers are better on the platforms I'm using and can sensically step > into inline functions, or I'm making less boo-boos. > > HTH, > --Eljay > From rqooptometrist@greencore.ie Tue Mar 27 15:35:00 2007 From: rqooptometrist@greencore.ie (MMarian Damon) Date: Tue, 27 Mar 2007 15:35:00 -0000 Subject: bucknell matthews Message-ID: <068a01c77005$3ddf04f0$5157f5a0@vexecutivej> We told you yesterday this would make a move up 10% in 1 Day and its just the 1st day, Imagine Check this company out CRITICAL Care N E W Sym-CCTI Extremely b ullish at 22 Cents Short or long, this one cant go wrong up 10% in 1 Day and its just the 1st day, Imagine where it will be in 5 days Get in this gem tomorrow, Catch an easy doubler!! D'Antoni said. ''We're in a little bit of a funk right now. Discombobulated. We exhaustion. ''We're still feeling it,'' Steve Nash said. ''It was a big win. got 25 points from Leandro Barbosa , never led in this one and fell behind by championships and we haven't been close to doing either in a lot of ways." ----- Original Message ----- From: "MMarian Damon" To: Sent: Thursday, March 22, 2007 8:27 PM Subject: bucknell matthews > Check this company out > CRITICAL Care N E W > Sym-CCTI > Extremely b ullish at 22 Cents > Short or long, this one cant go wrong From jbousch@altran-tech.net Tue Mar 27 15:43:00 2007 From: jbousch@altran-tech.net (jbousch@altran-tech.net) Date: Tue, 27 Mar 2007 15:43:00 -0000 Subject: Embedded arm-elf-gcc Message-ID: <34437.81.255.205.37.1175009719.squirrel@81.255.205.37> Hi everybody, I'm currently working in a company, as embedded developper, which use gnu tools. I have a good experience about non gnu compiler tools and i need help because the most disavantage of gcc compiler is the almost unexistant support for developper. I work on an embedded software for an ARM7TDMI target processor (Phillips LPC 2214) and i have to locate the software in the target. So here comes the link command file (arm.ln) with wich i am supposed to set the memory map. The thing is that i can't find any tutorial about link comand file so i don't know how to write it manually. If anybody knows something about link comand file or any book or web site reference i would apreciate it a lot. Thanks in advance From iant@google.com Tue Mar 27 15:52:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Tue, 27 Mar 2007 15:52:00 -0000 Subject: Embedded arm-elf-gcc In-Reply-To: <34437.81.255.205.37.1175009719.squirrel@81.255.205.37> References: <34437.81.255.205.37.1175009719.squirrel@81.255.205.37> Message-ID: jbousch@altran-tech.net writes: > I'm currently working in a company, as embedded developper, which use gnu > tools. I have a good experience about non gnu compiler tools and i need > help because the most disavantage of gcc compiler is the almost unexistant > support for developper. > > I work on an embedded software for an ARM7TDMI target processor (Phillips > LPC 2214) and i have to locate the software in the target. So here comes > the link command file (arm.ln) with wich i am supposed to set the memory > map. The thing is that i can't find any tutorial about link comand file so > i don't know how to write it manually. > > If anybody knows something about link comand file or any book or web site > reference i would apreciate it a lot. Please send questions only to gcc-help@gcc.gnu.org, not also to gcc@gnu.org. Thanks. First let me say that there are several companies which sell support for developers using the GNU tools. If you want support, it is available. The link command file is described in the linker manual. The linker is not part of gcc; it is part of the GNU binutils. Here is the online version of the documentation for version 2.17: http://sourceware.org/binutils/docs-2.17/ld/index.html Ian From osv@javad.com Tue Mar 27 16:38:00 2007 From: osv@javad.com (Sergei Organov) Date: Tue, 27 Mar 2007 16:38:00 -0000 Subject: Embedded arm-elf-gcc In-Reply-To: <34437.81.255.205.37.1175009719.squirrel@81.255.205.37> (jbousch@altran-tech.net's message of "Tue, 27 Mar 2007 17:35:19 +0200 (CEST)") References: <34437.81.255.205.37.1175009719.squirrel@81.255.205.37> Message-ID: <87abxy1y7f.fsf@javad.com> jbousch@altran-tech.net writes: > Hi everybody, > > I'm currently working in a company, as embedded developper, which use gnu > tools. I have a good experience about non gnu compiler tools and i need > help because the most disavantage of gcc compiler is the almost unexistant > support for developper. Really?! My experience is quite opposite. > I work on an embedded software for an ARM7TDMI target processor (Phillips > LPC 2214) and i have to locate the software in the target. So here comes > the link command file (arm.ln) with wich i am supposed to set the memory > map. The thing is that i can't find any tutorial about link comand file so > i don't know how to write it manually. > > If anybody knows something about link comand file or any book or web site > reference i would apreciate it a lot. -- Sergei. From mrs@apple.com Tue Mar 27 17:09:00 2007 From: mrs@apple.com (Mike Stump) Date: Tue, 27 Mar 2007 17:09:00 -0000 Subject: Embedded arm-elf-gcc In-Reply-To: <34437.81.255.205.37.1175009719.squirrel@81.255.205.37> References: <34437.81.255.205.37.1175009719.squirrel@81.255.205.37> Message-ID: On Mar 27, 2007, at 8:35 AM, jbousch@altran-tech.net wrote: > I'm currently working in a company, as embedded developper, which > use gnu > tools. I have a good experience about non gnu compiler tools and i > need > help because the most disavantage of gcc compiler is the almost > unexistant > support for developper. You must be paying the wrong people for support. :-) Find new people to pay. > I work on an embedded software for an ARM7TDMI target processor > (Phillips > LPC 2214) and i have to locate the software in the target. So here > comes > the link command file (arm.ln) with wich i am supposed to set the > memory > map. The thing is that i can't find any tutorial about link comand > file so > i don't know how to write it manually. I'd try the LD manual. > If anybody knows something about link comand file or any book or > web site > reference i would apreciate it a lot. Also, there is a search tool called google at google.com that is able to find all sort of things. For example, you could type "linker documentation", and it would have answered your question in about 140ms, which should be more than 50% faster than the speed at which we can answer your questions. Also, this is the wrong list, gcc-help is for help using gcc. From steve.kreyer@web.de Wed Mar 28 11:02:00 2007 From: steve.kreyer@web.de (Steve Kreyer) Date: Wed, 28 Mar 2007 11:02:00 -0000 Subject: wrong GCC-configuration? (./specs: Is a directory) In-Reply-To: References: <4603FD3F.5000600@blueSpirit.la> <46043721.7070705@blueSpirit.la> Message-ID: <46094EFB.8020403@web.de> Hi, only a guess: Can it be, that gcc searches also in LIBRARY_PATH for the specs file ? If so, maybe you have to check your LIBRARY_PATH environment variable, if this contains a fullstop. Or maybe just play with it and find out how gcc behaves to the content of this variable. Maybe you should set it to /usr/lib/gcc/target/gcc-version directory, if this is the directory where your default specs file is located. Regards, Steve Ian Lance Taylor wrote: > Karl Krach writes: > > >> Ian Lance Taylor wrote: >> >>> Karl Krach writes: >>> >>> >>>> What I figured out: My problem is that my GCC reads the specs from the >>>> current directory (if available). >>>> >>> This is not normal behaviour. There is something odd about your GCC. >>> Or you've done something like set the environment variable >>> GCC_EXEC_PREFIX to ".". >>> >> I've already checked all environment variables. There is only >> $GCC_SPECS and it's empty. But this variable (if empty) has no effect >> to GCC's behavior. >> > > GCC_SPECS does nothing with standard gcc. > > >> And yes, I'm also sure that it's not the normal behavior. But I've no >> idea which parameters to change. >> > > I think you must be using patched source code. I have no other way of > explaining what you are seeing. Well, maybe you configured gcc with > "--prefix=." but that would probably cause other problems. > > Ian > > -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3245 bytes Desc: S/MIME Cryptographic Signature URL: From dinabandhu@lifetreeindia.com Wed Mar 28 11:21:00 2007 From: dinabandhu@lifetreeindia.com (Dinabandhu Mitra) Date: Wed, 28 Mar 2007 11:21:00 -0000 Subject: Problem With templates Message-ID: <006501c77128$86b8b170$cf01a8c0@dinu> Hi, ? The following code does not compile. The code seems all right and it compiles on MSVC, HP-UX aCC and Solaris CC (Forte) compiler. I don?t really know why it does not on g++. I have tried gcc 3.4.5, 4.0.2 on linux. ? Any work around is also ok. ? #include ? ? template class X { public: ??? struct B ??? { ??? }; ??? void method() ??? { ??????? B b; ??????? std::list::iterator c; ??? } }; ? int main() { }??????????????????? ? The error is given below ? ? test_std.cpp: In member function `void X::method()': test_std.cpp:14: error: expected `;' before "c" ? ? Regards, ? Dinabandhu Mitra From domen.vrankar@gmail.com Wed Mar 28 11:22:00 2007 From: domen.vrankar@gmail.com (Domen Vrankar) Date: Wed, 28 Mar 2007 11:22:00 -0000 Subject: list of warning messages Message-ID: <1d9535c10703280421h50245179qa2244d0b2fb1e721@mail.gmail.com> Hi, does anyone know if there is somekind of documentation that contains list and description of all warning/error messages that gcc outputs? r. Domen From daniel.llorens@bluewin.ch Wed Mar 28 12:22:00 2007 From: daniel.llorens@bluewin.ch (=?ISO-8859-1?Q?Daniel_Llorens_del_R=EDo?=) Date: Wed, 28 Mar 2007 12:22:00 -0000 Subject: Problem With templates In-Reply-To: <006501c77128$86b8b170$cf01a8c0@dinu> References: <006501c77128$86b8b170$cf01a8c0@dinu> Message-ID: <72210264-D96B-4FE9-B394-C872E0F71101@bluewin.ch> On 28 Mar, 2007, at 13:02, Dinabandhu Mitra wrote: > std::list::iterator c; try typename std::list::iterator c; From dinabandhu@lifetreeindia.com Wed Mar 28 12:30:00 2007 From: dinabandhu@lifetreeindia.com (Dinabandhu Mitra) Date: Wed, 28 Mar 2007 12:30:00 -0000 Subject: Problem With templates In-Reply-To: <72210264-D96B-4FE9-B394-C872E0F71101@bluewin.ch> Message-ID: <006b01c77133$a9dcf750$cf01a8c0@dinu> Thanks a lot ... it worked. I am just wondering how this works on other compilers ... is it a issue with gcc or other compilers? -----Original Message----- From: Daniel Llorens del R?o [mailto:daniel.llorens@bluewin.ch] Sent: Wednesday, March 28, 2007 4:52 PM To: Dinabandhu Mitra; gcc-help@gcc.gnu.org Subject: Re: Problem With templates On 28 Mar, 2007, at 13:02, Dinabandhu Mitra wrote: > std::list::iterator c; try typename std::list::iterator c; From aph@redhat.com Wed Mar 28 13:17:00 2007 From: aph@redhat.com (Andrew Haley) Date: Wed, 28 Mar 2007 13:17:00 -0000 Subject: Problem With templates In-Reply-To: <006b01c77133$a9dcf750$cf01a8c0@dinu> References: <72210264-D96B-4FE9-B394-C872E0F71101@bluewin.ch> <006b01c77133$a9dcf750$cf01a8c0@dinu> Message-ID: <17930.24528.153425.55629@zebedee.pink> Dinabandhu Mitra writes: > Thanks a lot ... it worked. I am just wondering how this works on other > compilers ... is it a issue with gcc or other compilers? gcc has improved its standards compliance. Andrew. > > -----Original Message----- > From: Daniel Llorens del R??o [mailto:daniel.llorens@bluewin.ch] > Sent: Wednesday, March 28, 2007 4:52 PM > To: Dinabandhu Mitra; gcc-help@gcc.gnu.org > Subject: Re: Problem With templates > > > On 28 Mar, 2007, at 13:02, Dinabandhu Mitra wrote: > > > std::list::iterator c; > > try > > typename std::list::iterator c; > > > -- Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Directors: Michael Cunningham (USA), Charlie Peters (USA) and David Owens (Ireland) From eljay@adobe.com Wed Mar 28 14:05:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Wed, 28 Mar 2007 14:05:00 -0000 Subject: strict C++ mode Message-ID: Hi everyone, Is there a way to get GCC to compile C++ in a "strict C++" mode? By "strict C++" I mean that when I include , I get symbols that are required by ISO 14882, but I don't get symbols that are not specified in ISO 14882. So I'd get: std::printf But I would not get: ::printf And I would not get any #define's that are not required by ISO 14882. (Not including header guards that have a double-underscore or start with underscore-capital letter.) Thanks, --Eljay From gonwg@hotmail.com Wed Mar 28 14:19:00 2007 From: gonwg@hotmail.com (Michael Gong) Date: Wed, 28 Mar 2007 14:19:00 -0000 Subject: what's this syntax ? Message-ID: Hi, Can anyone tell me what the "..." syntax is called in following function definition ? *************************************************************************** struct physid_mask { unsigned long mask [(((256)+32-1/32)]; }; typedef struct physid_mask physid_mask_t; static inline __attribute__((always_inline)) physid_mask_t ioapic_phys_id_map(physid_mask_t phys_id_map) { return ( { physid_mask_t __physid_mask = { { [0 ... (((256)+32 -1)/32)-1] = 0UL <--- Is it designated initializer ??? } }; __physid_mask.mask[0] = 0x0F; __physid_mask; } ); } *************************************************************************** Thanks. Mike From eljay@adobe.com Wed Mar 28 14:31:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Wed, 28 Mar 2007 14:31:00 -0000 Subject: what's this syntax ? In-Reply-To: Message-ID: Hi Michael, I think the '...' is called an ellipsis in the array initializer. So you can do something like: int array[10] = { [4] = 9, [1 ... 2] = 88, [7 ... 9] = 1 }; It's valid C99 code. IIRC, it's *NOT* valid C90 or C++98 code. (I'm not sure if GCC provides convenience extensions that you may have to disable in a C90 or C++98 environment.) You may find this output of interest: gcc -S test.c cat test.s HTH, --Eljay From gonwg@hotmail.com Wed Mar 28 14:33:00 2007 From: gonwg@hotmail.com (Michael Gong) Date: Wed, 28 Mar 2007 14:33:00 -0000 Subject: what's this syntax ? References: Message-ID: Hi, John, Thanks for reply and the information is very helpful. However, to clarify a bit, I don't think it's a valid C99 code. According to gcc manual, http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Designated-Inits.html#Designated-Inits .. To initialize a range of elements to the same value, write `[first ... last] = value'. This is a GNU extension. For example, int widths[] = { [0 ... 9] = 1, [10 ... 99] = 2, [100] = 3 }; .. Thanks. Mike ----- Original Message ----- From: "John Love-Jensen" To: "Michael Gong" ; "MSX to GCC" Sent: Wednesday, March 28, 2007 9:19 AM Subject: Re: what's this syntax ? > Hi Michael, > > I think the '...' is called an ellipsis in the array initializer. > > So you can do something like: > > int array[10] = { [4] = 9, [1 ... 2] = 88, [7 ... 9] = 1 }; > > It's valid C99 code. > > IIRC, it's *NOT* valid C90 or C++98 code. (I'm not sure if GCC > provides > convenience extensions that you may have to disable in a C90 or C++98 > environment.) > > You may find this output of interest: > > gcc -S test.c > cat test.s > > HTH, > --Eljay > > From dinabandhu@lifetreeindia.com Wed Mar 28 14:42:00 2007 From: dinabandhu@lifetreeindia.com (Dinabandhu Mitra) Date: Wed, 28 Mar 2007 14:42:00 -0000 Subject: Problem With templates In-Reply-To: <17930.24528.153425.55629@zebedee.pink> Message-ID: <009001c77146$00049c20$cf01a8c0@dinu> Ok ... Thx. -----Original Message----- From: Andrew Haley [mailto:aph@redhat.com] Sent: Wednesday, March 28, 2007 6:00 PM To: Dinabandhu Mitra Cc: 'Daniel Llorens del R?o'; gcc-help@gcc.gnu.org Subject: RE: Problem With templates Dinabandhu Mitra writes: > Thanks a lot ... it worked. I am just wondering how this works on other > compilers ... is it a issue with gcc or other compilers? gcc has improved its standards compliance. Andrew. > > -----Original Message----- > From: Daniel Llorens del R?o [mailto:daniel.llorens@bluewin.ch] > Sent: Wednesday, March 28, 2007 4:52 PM > To: Dinabandhu Mitra; gcc-help@gcc.gnu.org > Subject: Re: Problem With templates > > > On 28 Mar, 2007, at 13:02, Dinabandhu Mitra wrote: > > > std::list::iterator c; > > try > > typename std::list::iterator c; > > > -- Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Directors: Michael Cunningham (USA), Charlie Peters (USA) and David Owens (Ireland) From eljay@adobe.com Wed Mar 28 14:56:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Wed, 28 Mar 2007 14:56:00 -0000 Subject: what's this syntax ? In-Reply-To: Message-ID: Hi Michael, > However, to clarify a bit, I don't think it's a valid C99 code. Hmmm, I think you are correct. It appears to be a GNU extension. (I haven't programmed in C since 1990, so I haven't bumped into the extension.) Thanks for the finding the link. Sincerely, --Eljay From iant@google.com Wed Mar 28 17:36:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Wed, 28 Mar 2007 17:36:00 -0000 Subject: list of warning messages In-Reply-To: <1d9535c10703280421h50245179qa2244d0b2fb1e721@mail.gmail.com> References: <1d9535c10703280421h50245179qa2244d0b2fb1e721@mail.gmail.com> Message-ID: "Domen Vrankar" writes: > does anyone know if there is somekind of documentation that contains > list and description of all warning/error messages that gcc outputs? There is no such documentation. Sorry. Ian From Vladimir.Simonov@acronis.com Wed Mar 28 18:04:00 2007 From: Vladimir.Simonov@acronis.com (Vladimir Simonov) Date: Wed, 28 Mar 2007 18:04:00 -0000 Subject: gcc forgets to decrease esp after function call In-Reply-To: <17918.51298.795800.290992@zebedee.pink> References: <45F15674.9000701@acronis.com> <17905.22833.766154.45450@zebedee.pink> <45F1681A.6030307@acronis.com> <17905.28252.856544.931176@zebedee.pink> <45F180B3.50901@acronis.com> <17905.33869.537927.207102@zebedee.pink> <45F1A223.6060406@acronis.com> <17905.42424.400663.138838@zebedee.pink> <45F292DA.30804@acronis.com> <17908.16759.282405.262830@zebedee.pink> <45F653D5.8070500@acronis.com> <17910.32685.453760.827798@zebedee.pink> <45F6E269.1050201@acronis.com> <17910.58546.897282.378139@zebedee.pink> <45F80E6C.5090601@acronis.com> <17913.5853.465646.305627@zebedee.pink> <45F92EC7.2000106@acronis.com> <17913.12323.646294.479431@zebedee.pink> <45F984DB.3050201@acronis.com> <17918.27050.815012.142815@zebedee.pink> <45FEBBAD.1090604@acronis.com> <17918.51298.795800.290992@zebedee.pink> Message-ID: <460AA7A2.50205@acronis.com> Andrew Haley wrote: > Vladimir Simonov writes: > > > > > > Andrew Haley wrote: > > > Vladimir Simonov writes: > > > > Andrew Haley wrote: > > > > > Vladimir Simonov writes: > > > > > > Andrew Haley wrote: > > > > > > > Vladimir Simonov writes: > > > > > > > > > > Fillet that, and you will have a test case that can be submitted. > > > > > > > > > > > > It requires a lot of mannual work - remove a peace of code, then > > > > > > check that the test can be built, the check that the bug did not > > > > > > disappear, etc. > > > > > > > > > > It's your code, so presumably you are familiar with it. I stepped > > > > > though the code in gdb, and it seemed that not many routines were > > > > > actually involved. > > > > > > > > We have tried to minimize the test but without significant success. > > > > If we try to create simple test case from scratch we can't > > > > reproduce the problem. I have a feeling the problem appears > > > > if huge templated code involved into codegeneration. > > > > > > > > If I understand correct it is impossible to file this > > > > bug to gcc bugzilla - it does not permit attachements. > > > > > > > > Do you think I need to post the problem to some another > > > > list to get it solved? Or just leave it( and you :) ) alone? > > > > > > It all depends on what you need. I have this feeling that your > > > problem may well be fixed by a more recent g++. It's hard to be sure, > > > because your test case does not even compile with a more recent g++. > > > This is, I suspect, becasue we have improved g++ to be closer to the > > > real ISO C++ standard. > > > > > > g++ Version 4.3 reports a number of type mismatch errors in the area > > > that may be causing problems. It is quite possible that if you fix > > > these errors your problem will go away. > > Hi, Unfortunatelly I had no time to play with gcc 4.3 but we have some progress. 1. We put the function returning object into "for". So the test always crashes if generated code in incorrect ("sub $0x4, esp" after function call is missed). The previous test not always crashed if esp corrupted. It depended on how esp is used after call(and function exit method - via "add XXX, esp" or "mov ebp, esp"). Now stack is "eaten" by "for" if "sub $0x4, esp" is missed. 2. Then we found optimization option which leads to incorrect code generation. It is -ftree-sra. At the moment our problem is solved. Probably new test and knowlege about the option will help somebody to find and to fix the bug. Thank you. Regards Vladimir -------------- next part -------------- A non-text attachment was scrubbed... Name: gcc_bug.tgz Type: application/x-gzip Size: 81947 bytes Desc: not available URL: From rbanfield@flenvironmental.org Wed Mar 28 18:25:00 2007 From: rbanfield@flenvironmental.org (Robert Banfield) Date: Wed, 28 Mar 2007 18:25:00 -0000 Subject: Seemingly identical gcc versions, except one searches subdirectories with -I Message-ID: <460AAE2C.1040205@flenvironmental.org> I have come across this problem and despite my searches I have been unable to find a solution. I have two Fedora Core 6 machines. Both have the same version of gcc/g++ and the development programs/libraries installed. Both are x86_64. When I run the command: [rbanfiel@localhost BobBackup]$ g++ -v -Ijasper-uuid/src/libjasper/include -Iinclude -Igdal/port -Igdal/gcore -Igdal/alg -Igdal/ogr -Igdal/frmts -Izlib -Ipoco/XML/include -Ipoco/Foundation/include -Iinfo-zip -DUSE_ZLIB -DNO_CRYPT -DHAVE_JASPER_UUID -D_unzip_H -Dcimg_display_type=0 -c abc.cpp -o abc.o I get largely the same output, except for the result. On one machine, it compiles (yay!). On the other machine, it complains about a missing header file. The header file cpl_config.h is located in gdal/ogr/ogrsf_frmts/dgn/dist which is a subdirectory of gdal/ogr which is specified on the command line above. I can successfully get it to compile by using -Igdal/ogr/ogrsf_frmts/dgn/dist. Unfortunately there are tons of subdirectories in the various libraries I am including, and I'd love to not have to specify each and every one. A diff on the outputs of both versions with the -v flag shows the following: 7c7 < /usr/libexec/gcc/x86_64-redhat-linux/4.1.1/cc1plus -quiet -v -Ijasper-uuid/src/libjasper/include -Iinclude -Igdal/port -Igdal/gcore -Igdal/alg -Igdal/ogr -Igdal/frmts -Izlib -Ipoco/XML/include -Ipoco/Foundation/include -Iinfo-zip -D_GNU_SOURCE -DUSE_ZLIB -DNO_CRYPT -DHAVE_JASPER_UUID -D_unzip_H -Dcimg_display_type=0 abc.cpp -quiet -dumpbase abc.cpp -mtune=generic -auxbase-strip abc.o -version -o /tmp/ccwnikzF.s --- > /usr/libexec/gcc/x86_64-redhat-linux/4.1.1/cc1plus -quiet -v -Ijasper-uuid/src/libjasper/include -Iinclude -Igdal/port -Igdal/gcore -Igdal/alg -Igdal/ogr -Igdal/frmts -Izlib -Ipoco/XML/include -Ipoco/Foundation/include -Iinfo-zip -D_GNU_SOURCE -DUSE_ZLIB -DNO_CRYPT -DHAVE_JASPER_UUID -D_unzip_H -Dcimg_display_type=0 abc.cpp -quiet -dumpbase abc.cpp -mtune=generic -auxbase-strip abc.o -version -o /tmp/ccsoGgbf.s // The only difference is the /tmp/cc??????.s file 31c31 < GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 --- > GGC heuristics: --param ggc-min-expand=46 --param ggc-min-heapsize=31513 // I tried specifying these parameters manually on the second machine with no change in result 33,35c33,37 < as -V -Qy -o abc.o /tmp/ccwnikzF.s < GNU assembler version 2.17.50.0.6-2.fc6 (x86_64-redhat-linux) using BFD version 2.17.50.0.6-2.fc6 20061020 --- > In file included from gdal/port/cpl_vsi.h:87, > from gdal/port/cpl_string.h:84, > from abc.h:25, > from abc.cpp:24: > gdal/port/cpl_port.h:148:24: error: cpl_config.h: No such file or directory // One compiles, the other doesn't. I have checked my environment also and come up with nothing which would explain the difference in behaviors. Finally, here is a log from the compile on the machine in which it worked. Using built-in specs. Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux Thread model: posix gcc version 4.1.1 20070105 (Red Hat 4.1.1-51) /usr/libexec/gcc/x86_64-redhat-linux/4.1.1/cc1plus -quiet -v -Ijasper-uuid/src/libjasper/include -Iinclude -Igdal/port -Igdal/gcore -Igdal/alg -Igdal/ogr -Igdal/frmts -Izlib -Ipoco/XML/include -Ipoco/Foundation/include -Iinfo-zip -D_GNU_SOURCE -DUSE_ZLIB -DNO_CRYPT -DHAVE_JASPER_UUID -D_unzip_H -Dcimg_display_type=0 weokml.cpp -quiet -dumpbase weokml.cpp -mtune=generic -auxbase-strip weokml.o -version -o /tmp/ccOGy0G5.s ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../x86_64-redhat-linux/include" #include "..." search starts here: #include <...> search starts here: jasper-uuid/src/libjasper/include include gdal/port gdal/gcore gdal/alg gdal/ogr gdal/frmts zlib poco/XML/include poco/Foundation/include info-zip /usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../include/c++/4.1.1 /usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../include/c++/4.1.1/x86_64-redhat-linux /usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../include/c++/4.1.1/backward /usr/local/include /usr/lib/gcc/x86_64-redhat-linux/4.1.1/include /usr/include End of search list. GNU C++ version 4.1.1 20070105 (Red Hat 4.1.1-51) (x86_64-redhat-linux) compiled by GNU C version 4.1.1 20070105 (Red Hat 4.1.1-51). GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: c1be8c277545876a2f11bc40e8290a2f as -V -Qy -o weokml.o /tmp/ccOGy0G5.s GNU assembler version 2.17.50.0.6-2.fc6 (x86_64-redhat-linux) using BFD version 2.17.50.0.6-2.fc6 20061020 Thank you very much for your time and assistance, Robert From satyaakam@gmail.com Wed Mar 28 18:35:00 2007 From: satyaakam@gmail.com (satyaakam goswami) Date: Wed, 28 Mar 2007 18:35:00 -0000 Subject: [AIX] gcc cannot compile huge c file Message-ID: <6491e1350703281125r1af2703cia8a9a696769b2489@mail.gmail.com> Hello All, We have been hit by this bug http://gcc.gnu.org/bugzilla/show_bug.cgi?id=378, We are getting the same error "line 599772: The displacement must be greater than or equal to -32768 and less than or equal to 32767." on AIX 5.3.0.0 , with gcc 3.2.3. Bug is in Suspended state, does look to be fixed in near future, any workaround for this bug will surely help. TIA Satya From dima.sorkin@gmail.com Wed Mar 28 19:56:00 2007 From: dima.sorkin@gmail.com (Dima Sorkin) Date: Wed, 28 Mar 2007 19:56:00 -0000 Subject: OpenMP on gcc Message-ID: Hi. I have some c++ code that should compile both under GCCs (starting from gcc 3.1 to 4.0) and other compiler. I want to insert OpenMP pragmas into code, to optimize it. 1) Starting from which version does GCC support OpenMP ? 2) Will old versions of GCC just ignore OpenMP pragmas, or these will cause errors ? Thank you. Dima. From wjposer@ldc.upenn.edu Wed Mar 28 21:29:00 2007 From: wjposer@ldc.upenn.edu (William J Poser) Date: Wed, 28 Mar 2007 21:29:00 -0000 Subject: command line order of object files and libraries Message-ID: <20070328195556.E0603B290E@lorax.ldc.upenn.edu> I have always (since 1982) believed that when compiling C on *nix object files should precede libraries on the command line since the linker processes files in the same order and only loads library routines to which it has seen references at that point. This belief is supported by the Single Unix spec and by the current gcc info files (under "Link Options"), as well as other documents that I have been able to find, such as the Apple Developer docs for gcc. Yesterday I tried to compile a program I encountered on Freshmeat where the link failed because the Makefile had the libraries before the object files. When I raised this with the author of the program, he said that I was only the second person in many years to encounter this problem and that he himself uses gcc on GNU/Linux and did not encounter it. I have heard that there are linkers that do not work this way, but do not recall ever actually encountering one, and am surprised to hear of this behavior with gcc on GNU/Linux. Have I misunderstood the expected behavior of gcc? If not, can anyone explain why the author of the program in question describes such different behavior? Thanks. Bill From ferad.zyulkyarov@bsc.es Wed Mar 28 22:14:00 2007 From: ferad.zyulkyarov@bsc.es (Ferad Zyulkyarov) Date: Wed, 28 Mar 2007 22:14:00 -0000 Subject: OpenMP on gcc In-Reply-To: References: Message-ID: As I know, OpenMP is being implemented since version 4.2+ But these gcc versions does not have official release. Based on my experience, I compiled few simple OpenMP programs in gcc and I was satisfied. > 1) Starting from which version does GCC support OpenMP ? As I know 4.2 > 2) Will old versions of GCC just ignore OpenMP pragmas, or these > will cause errors ? Based on the pragma specification unknown pragmas are ignored. But you have to deal with the omp_* stuff (i.e. omp_set_lock function) Regards, Ferad -- Ferad Zyulkyarov Barcelona Supercomputing Center From n8tm@aol.com Wed Mar 28 22:38:00 2007 From: n8tm@aol.com (Tim Prince) Date: Wed, 28 Mar 2007 22:38:00 -0000 Subject: OpenMP on gcc In-Reply-To: References: Message-ID: <460AE8BC.3030504@aol.com> ferad.zyulkyarov@bsc.es wrote: > As I know, OpenMP is being implemented since version 4.2+ But these > gcc versions does not have official release. Based on my experience, I > compiled few simple OpenMP programs in gcc and I was satisfied. > The one problem I have had is that gfortran rejects EQUIVALENCE in threadprivate COMMON blocks, as used extensively in legacy applications. I haven't investigated whether any standards bear on this (admittedly undesirable) practice. From ferad.zyulkyarov@bsc.es Wed Mar 28 23:10:00 2007 From: ferad.zyulkyarov@bsc.es (Ferad Zyulkyarov) Date: Wed, 28 Mar 2007 23:10:00 -0000 Subject: OpenMP on gcc In-Reply-To: <460AE8BC.3030504@aol.com> References: <460AE8BC.3030504@aol.com> Message-ID: Hi, My e-mail address appears on the previous message under this thread. I would like to ask the admins if it is possible to delete it (because of the spam). Thanks in advance, Ferad From iant@google.com Wed Mar 28 23:41:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Wed, 28 Mar 2007 23:41:00 -0000 Subject: command line order of object files and libraries In-Reply-To: <20070328195556.E0603B290E@lorax.ldc.upenn.edu> References: <20070328195556.E0603B290E@lorax.ldc.upenn.edu> Message-ID: wjposer@ldc.upenn.edu (William J Poser) writes: > I have always (since 1982) believed that when compiling C on *nix > object files should precede libraries on the command line since > the linker processes files in the same order and only loads > library routines to which it has seen references at that point. > This belief is supported by the Single Unix spec and by > the current gcc info files (under "Link Options"), > as well as other documents that I have been able to find, > such as the Apple Developer docs for gcc. > > Yesterday I tried to compile a program I encountered > on Freshmeat where the link failed because the Makefile > had the libraries before the object files. When I raised > this with the author of the program, he said that I was > only the second person in many years to encounter this > problem and that he himself uses gcc on GNU/Linux and did > not encounter it. I have heard that there are linkers > that do not work this way, but do not recall ever actually > encountering one, and am surprised to hear of this > behavior with gcc on GNU/Linux. > > Have I misunderstood the expected behavior of gcc? > If not, can anyone explain why the author of the > program in question describes such different > behavior? Thanks. This is a question about the linker, not about the compiler. The linker is part of the GNU binutils. See http://sourceware.org/binutils/. You are correct in your description of how the GNU linker behaves: it retains the order of object files and libraries, and the order matters. However, this is mostly only true when using .a archives. When using .so shared libraries things work differently. Perhaps the GNU/Linux build uses shared libraries? Ian From wjposer@ldc.upenn.edu Thu Mar 29 00:06:00 2007 From: wjposer@ldc.upenn.edu (William J Poser) Date: Thu, 29 Mar 2007 00:06:00 -0000 Subject: command line order of object files and libraries Message-ID: <20070328234102.64982B2790@lorax.ldc.upenn.edu> Just to close this off, it looks like the problem is that on most systems the library in question is usually dynamically linked, in which case the ordering constraints do not apply, and that the problem only arises on the odd system like my desktop in which either the shared library does not exist or is in a different directory lower on the path so that static linkage is attempted. Bill From sgk@troutmask.apl.washington.edu Thu Mar 29 01:27:00 2007 From: sgk@troutmask.apl.washington.edu (Steve Kargl) Date: Thu, 29 Mar 2007 01:27:00 -0000 Subject: OpenMP on gcc In-Reply-To: <460AE8BC.3030504@aol.com> References: <460AE8BC.3030504@aol.com> Message-ID: <20070329000545.GA53241@troutmask.apl.washington.edu> On Wed, Mar 28, 2007 at 03:14:20PM -0700, Tim Prince wrote: > ferad.zyulkyarov@bsc.es wrote: > >As I know, OpenMP is being implemented since version 4.2+ But these > >gcc versions does not have official release. Based on my experience, I > >compiled few simple OpenMP programs in gcc and I was satisfied. > > > > The one problem I have had is that gfortran rejects EQUIVALENCE in > threadprivate COMMON blocks, as used extensively in legacy applications. > I haven't investigated whether any standards bear on this (admittedly > undesirable) practice. The OpenMP vwrsion 2.5 spec is available on line. A variable can only appear in a threadprivate directive in the scope in which it is declared. It must not be an element of a common block or be declared in an EQUIVALENCE statement. -- Steve From eager@eagercon.com Thu Mar 29 01:54:00 2007 From: eager@eagercon.com (Michael Eager) Date: Thu, 29 Mar 2007 01:54:00 -0000 Subject: Seemingly identical gcc versions, except one searches subdirectories with -I In-Reply-To: <460AAE2C.1040205@flenvironmental.org> References: <460AAE2C.1040205@flenvironmental.org> Message-ID: <460B15FF.3040607@eagercon.com> Robert Banfield wrote: > > In file included from gdal/port/cpl_vsi.h:87, > > from gdal/port/cpl_string.h:84, > > from abc.h:25, > > from abc.cpp:24: > > gdal/port/cpl_port.h:148:24: error: cpl_config.h: No such file or > directory I'll take it that cpl_config.h does exist on both systems. Are the versions of cpl_port.h identical? -- Michael Eager eager@eagercon.com 1960 Park Blvd., Palo Alto, CA 94306 650-325-8077 From glegoo@gmail.com Thu Mar 29 02:27:00 2007 From: glegoo@gmail.com (Wei Hu) Date: Thu, 29 Mar 2007 02:27:00 -0000 Subject: How to dump all the optimization flags enabled? Message-ID: <5be025980703281853r340a4a80rebb337bde8d5004b@mail.gmail.com> Hello, Is there a way to tell gcc to print out all the effective optimization flags when it compiles a C file? I know the manual tells you what flags are set at different optimization levels, but I'm still looking for an answer to my question because it will be useful to my project. Thanks! From quanhn@cse.unsw.EDU.AU Thu Mar 29 05:55:00 2007 From: quanhn@cse.unsw.EDU.AU (Quan H. Nguyen) Date: Thu, 29 Mar 2007 05:55:00 -0000 Subject: need help: gcc rtl function calls Message-ID: <34450.129.94.173.0.1175135254.squirrel@webmail.cse.unsw.edu.au> Dear gcc, I am currently a PhD student at CSE, UNSW, Australia. I am looking a way to output the memory address of an insn (rtx), in the format="%lu". At the moment, I know how to get the memory address like: find_mem_reference( insn, &mem, write); address= XEXP (mem, 0); Also I know that I need to place some rtl codes like: start_sequence(); ...... end_sequence(); But I could not find any hints to create a function call to place into the dots. Even with a simple call to the builtin printf e.g. expand_builtin_printf(). Don't know how to create argument list, formating, and function call. I am looking around on the internet, gcc documentation, mailing list ... for a month, but could not solve this. Look forward to your advice. Many thanks. Regards, Quan From facundofc@gmail.com Thu Mar 29 06:52:00 2007 From: facundofc@gmail.com (Facundo Ciccioli) Date: Thu, 29 Mar 2007 06:52:00 -0000 Subject: Shifting: what's going on? Message-ID: <56aed05a0703282255ybc55393xeeb8215606fe8cc7@mail.gmail.com> Hi. What follows applies to gcc (GCC) 3.4.2 (mingw-special), platform x86-32bits. This code: int main() { unsigned long long a= 1; unsigned s= 63; a= (a << s); return 0; } generates this assembler (removing preamble and prologue stuff): movl $1, -8(%ebp) movl $0, -4(%ebp) movl $63, -12(%ebp) movl -12(%ebp), %ecx movl -8(%ebp), %eax movl -4(%ebp), %edx shldl %cl,%eax, %edx sall %cl, %eax testb $32, %cl je L2 movl %eax, %edx movl $0, %eax L2: movl %eax, -8(%ebp) movl %edx, -4(%ebp) This is fine, and works as I expect. However, this code: int main() { unsigned long long a; unsigned s= 63; a= (1 << s); return 0; } generates this assembler: movl $63, -12(%ebp) movl -12(%ebp), %ecx movl $1, %eax sall %cl, %eax cltd movl %eax, -8(%ebp) movl %edx, -4(%ebp) which is... wrong. Not only the results aren't what they should, but looking a little harder, the assembler generated doesn't seem to make sense. What's with the CLTD instruction there? If I change s (the shifted amount) to be 63 (31 is equivalent, because only 5 bits of %cl are used) then the result are a bunch of 1's because the sign of %eax goes all over %edx. And that's only one problem. If s is between 62 and 32, the 1 appears in %eax instead of being in %edx, where it should. This is obviusly not urgent, since the first code is perfectly acceptable and applicable to what I am doing, but I just got curious. Thanks a lot. FaQ From me@rupey.net Thu Mar 29 08:52:00 2007 From: me@rupey.net (Rupert Wood) Date: Thu, 29 Mar 2007 08:52:00 -0000 Subject: Shifting: what's going on? In-Reply-To: <56aed05a0703282255ybc55393xeeb8215606fe8cc7@mail.gmail.com> References: <56aed05a0703282255ybc55393xeeb8215606fe8cc7@mail.gmail.com> Message-ID: <085701c771ce$cf608780$6e219680$@net> Facundo Ciccioli wrote: > unsigned long long a; > unsigned s= 63; > > a= (1 << s); The problem is that 1 is a signed integer constant not an unsigned long long constant, and there's no mechanism to automatically spot that you really meant it to be an unsigned long long constant. So this code does mean compute a shift on a 32-bit integer then extend the result into a 64-bit variable. Try: a = (1ULL << s); instead. Rup. ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ From tim@klingt.org Thu Mar 29 09:39:00 2007 From: tim@klingt.org (Tim Blechmann) Date: Thu, 29 Mar 2007 09:39:00 -0000 Subject: asm problem with and without -fPIC on x86 Message-ID: <1175158653.9488.57.camel@localhost> hi all, i've got the following problem: i am using the atomic_ops library to use the cmpxchg8b opcode. the specific section for x86 machines looks like this: __asm__ __volatile__("lock; cmpxchg8b %0; setz %1" : "=m"(*addr), "=q"(result) : "m"(*addr), "d" (old_val1), "a" (old_val2), "c" (new_val1), "b" (new_val2) : "memory"); unfortunately, this doesn't compile, when building as a shared library with the -fPIC flag, as the `b` register can't be used. so i wrote a workaround: __asm__ __volatile__("push %%ebx; movl %6,%%ebx; lock; cmpxchg8b %0; setz %1; pop %%ebx" : "=m"(*addr), "=q"(result) : "m"(*addr), "d" (old_val1), "a" (old_val2), "c" (new_val1), "m" (new_val2) : "memory"); this piece of code works fine if the -fPIC flag is enabled. but when compiling this without -fPIC and switching on optimization (-O), the code compiles, but doesn't work correctly anymore. without optimization it works fine, though. is this a compiler bug or a user bug? thanks in advance, tim -- tim@klingt.org ICQ: 96771783 http://tim.klingt.org Nothing exists until or unless it is observed. An artist is making something exist by observing it. And his hope for other people is that they will also make it exist by observing it. I call it 'creative observation.' Creative viewing. William S. Burroughs -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: From aph@redhat.com Thu Mar 29 09:42:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 29 Mar 2007 09:42:00 -0000 Subject: How to dump all the optimization flags enabled? In-Reply-To: <5be025980703281853r340a4a80rebb337bde8d5004b@mail.gmail.com> References: <5be025980703281853r340a4a80rebb337bde8d5004b@mail.gmail.com> Message-ID: <17931.35118.255175.388522@zebedee.pink> Wei Hu writes: > Hello, > > Is there a way to tell gcc to print out all the effective optimization > flags when it compiles a C file? > I know the manual tells you what flags are set at different > optimization levels, but I'm still looking for an answer to my > question because it will be useful to my project. Yes. -fverbose-asm dumps the flags to the .s file. Andrew. -- Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK Registered in England and Wales No. 3798903 From aph@redhat.com Thu Mar 29 09:47:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 29 Mar 2007 09:47:00 -0000 Subject: Shifting: what's going on? In-Reply-To: <56aed05a0703282255ybc55393xeeb8215606fe8cc7@mail.gmail.com> References: <56aed05a0703282255ybc55393xeeb8215606fe8cc7@mail.gmail.com> Message-ID: <17931.35327.294152.153125@zebedee.pink> Facundo Ciccioli writes: > Hi. What follows applies to gcc (GCC) 3.4.2 (mingw-special), platform > x86-32bits. > > This code: > > int main() { > unsigned long long a= 1; > unsigned s= 63; > > a= (a << s); > > return 0; > } > generates this assembler (removing preamble and prologue stuff): > > movl $1, -8(%ebp) > movl $0, -4(%ebp) > movl $63, -12(%ebp) > movl -12(%ebp), %ecx > movl -8(%ebp), %eax > movl -4(%ebp), %edx > shldl %cl,%eax, %edx > sall %cl, %eax > testb $32, %cl > je L2 > movl %eax, %edx > movl $0, %eax > L2: > movl %eax, -8(%ebp) > movl %edx, -4(%ebp) > > This is fine, and works as I expect. > However, this code: > > int main() { > unsigned long long a; > unsigned s= 63; > > a= (1 << s); > > return 0; > } > generates this assembler: > > movl $63, -12(%ebp) > movl -12(%ebp), %ecx > movl $1, %eax > sall %cl, %eax > cltd > movl %eax, -8(%ebp) > movl %edx, -4(%ebp) > which is... wrong. Not only the results aren't what they should, but > looking a little harder, the assembler generated doesn't seem to make > sense. What's with the CLTD instruction there? If I change s (the > shifted amount) to be 63 (31 is equivalent, because only 5 bits of %cl > are used) then the result are a bunch of 1's because the sign of %eax > goes all over %edx. And that's only one problem. If s is between 62 > and 32, the 1 appears in %eax instead of being in %edx, where it > should. > > This is obviusly not urgent, since the first code is perfectly > acceptable and applicable to what I am doing, but I just got curious. This is an arithmetic overflow, and is explicitly undefined. One result is as good as any other. What do you expect the code to do? Andrew. -- Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK Registered in England and Wales No. 3798903 From aph@redhat.com Thu Mar 29 10:03:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 29 Mar 2007 10:03:00 -0000 Subject: asm problem with and without -fPIC on x86 In-Reply-To: <1175158653.9488.57.camel@localhost> References: <1175158653.9488.57.camel@localhost> Message-ID: <17931.35605.37170.525947@zebedee.pink> Tim Blechmann writes: > hi all, > > i've got the following problem: > i am using the atomic_ops library to use the cmpxchg8b opcode. the > specific section for x86 machines looks like this: > > __asm__ __volatile__("lock; cmpxchg8b %0; setz %1" > : "=m"(*addr), "=q"(result) > : "m"(*addr), "d" (old_val1), "a" (old_val2), > "c" (new_val1), "b" (new_val2) : "memory"); > > unfortunately, this doesn't compile, when building as a shared library > with the -fPIC flag, as the `b` register can't be used. > so i wrote a workaround: > > __asm__ __volatile__("push %%ebx; movl %6,%%ebx; lock; cmpxchg8b %0; setz %1; pop %%ebx" > : "=m"(*addr), "=q"(result) > : "m"(*addr), "d" (old_val1), "a" (old_val2), > "c" (new_val1), "m" (new_val2) : "memory"); > > this piece of code works fine if the -fPIC flag is enabled. but when > compiling this without -fPIC and switching on optimization (-O), the > code compiles, but doesn't work correctly anymore. without optimization > it works fine, though. > > is this a compiler bug or a user bug? You know, this would have been *so* much easier to figure out it you'd provided a test case. Andrew. -- Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK Registered in England and Wales No. 3798903 From brian@dessent.net Thu Mar 29 13:05:00 2007 From: brian@dessent.net (Brian Dessent) Date: Thu, 29 Mar 2007 13:05:00 -0000 Subject: asm problem with and without -fPIC on x86 References: <1175158653.9488.57.camel@localhost> Message-ID: <460B8ED0.4BB7DB28@dessent.net> Tim Blechmann wrote: > i've got the following problem: > i am using the atomic_ops library to use the cmpxchg8b opcode. the > specific section for x86 machines looks like this: > > __asm__ __volatile__("lock; cmpxchg8b %0; setz %1" > : "=m"(*addr), "=q"(result) > : "m"(*addr), "d" (old_val1), "a" (old_val2), > "c" (new_val1), "b" (new_val2) : "memory"); > > unfortunately, this doesn't compile, when building as a shared library > with the -fPIC flag, as the `b` register can't be used. > so i wrote a workaround: > > __asm__ __volatile__("push %%ebx; movl %6,%%ebx; lock; cmpxchg8b %0; setz %1; pop %%ebx" > : "=m"(*addr), "=q"(result) > : "m"(*addr), "d" (old_val1), "a" (old_val2), > "c" (new_val1), "m" (new_val2) : "memory"); > > this piece of code works fine if the -fPIC flag is enabled. but when > compiling this without -fPIC and switching on optimization (-O), the > code compiles, but doesn't work correctly anymore. without optimization > it works fine, though. > > is this a compiler bug or a user bug? Can't you just use the builtin and let gcc worry about it? result = __sync_bool_compare_and_swap (*addr, old_val, new_val); http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html#index-g_t_005f_005fsync_005fbool_005fcompare_005fand_005fswap-2118 Brian From ssam0201@yahoo.co.in Thu Mar 29 14:26:00 2007 From: ssam0201@yahoo.co.in (sameer sinha) Date: Thu, 29 Mar 2007 14:26:00 -0000 Subject: gcc-3.4.6 build failed for Ada Message-ID: <205577.98660.qm@web8504.mail.in.yahoo.com> hello i am trying to build gcc for Language ada for cross target. after successful building in my build directory. i reached the directory gcc/ ans i ran the command $ make gnatlib then i got the error,which i am unable to understad what this is???? please help f any one can help to me........................... the error is as follows: ../../xgcc -B../../ -c -g -O2 -W -Wall -gnatpg a-comlin.adb -o a-comlin.o +===========================GNAT BUG DETECTED==============================+ | 3.4.6 (i960-unknown-coff) Storage_Error stack overflow (or erroneous memory access)| | Error detected at a-comlin.adb:36:17 | | Please submit a bug report; see http://gcc.gnu.org/bugs.html. | | Include the entire contents of this bug box in the report. | | Include the exact gcc or gnatmake command that you entered. | | Also include sources listed below in gnatchop format | | (concatenated together with no headers between files). | +==========================================================================+ compilation abandoned. Thanks & Regards sameer kumar sinha Project Engineer C-DAC Knowledge Park #1, Old Madras Road Bangalore - 560 038, INDIA __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/ From renegade22@gmx.net Thu Mar 29 14:58:00 2007 From: renegade22@gmx.net (Robert Meier) Date: Thu, 29 Mar 2007 14:58:00 -0000 Subject: newlib and interworking Message-ID: <20070329142548.243920@gmx.net> Hi all, i try to compile newlib (on suse linux 10.1 with gcc 4.0.2 20050901) which supports interworking. i hope you can help me. i have to compile these three packages newlib-1.13.0 gcc-3.4.3 binutlis-2.15 i had comiled the newlib and gcc with: ../gcc-3.4.3/configure --target=arm-elf --with-float=soft --enable-multilib --enable-interwork --enable-languages=c,c++ --enable-target-optspace --disable-newlib-multithread 2>&1 | tee ../configure-gcc.out and binutils with: ../(binutils)/configure --target=arm-elf --with-float=soft --enable-multilib --enable-interwork after successfully compiling this error occurs: /usr/local/lib/gcc/arm-elf/3.4.3/../../../../arm-elf/bin/ld: Warning: /usr/local/lib/gcc/arm-elf/3.4.3/../../../../arm-elf/lib/thumb/libc.a(strlen.o) does not support interworking, whereas Foo.elf does and this many times i also did not have the directories which are in the inet are often specified like: /usr/local/arm-elf/lib/interwork /usr/local/arm-elf/lib/mthumb/interwork i only have /usr/local/arm-elf/lib/mthumb Does smb. know what my problem could be? Thx, Robert Meier -- "Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ... Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail From facundofc@gmail.com Thu Mar 29 15:05:00 2007 From: facundofc@gmail.com (Facundo Ciccioli) Date: Thu, 29 Mar 2007 15:05:00 -0000 Subject: Shifting: what's going on? In-Reply-To: <17931.35327.294152.153125@zebedee.pink> References: <56aed05a0703282255ybc55393xeeb8215606fe8cc7@mail.gmail.com> <17931.35327.294152.153125@zebedee.pink> Message-ID: <56aed05a0703290758o64818a1av84efd4e3f4b0f141@mail.gmail.com> I expect to get a 1 in the s-th bit of a, and zeroes in all other bits. I don't know why you say that's an arithmetic overflow, if unsigned long long is 64 bits long and it has a 63-th bit (the last one). Anyway, Rupert Wood comment works, thanks a lot. FaQ 2007/3/29, Andrew Haley : > Facundo Ciccioli writes: > > Hi. What follows applies to gcc (GCC) 3.4.2 (mingw-special), platform > > x86-32bits. > > > > This code: > > > > int main() { > > unsigned long long a= 1; > > unsigned s= 63; > > > > a= (a << s); > > > > return 0; > > } > > generates this assembler (removing preamble and prologue stuff): > > > > movl $1, -8(%ebp) > > movl $0, -4(%ebp) > > movl $63, -12(%ebp) > > movl -12(%ebp), %ecx > > movl -8(%ebp), %eax > > movl -4(%ebp), %edx > > shldl %cl,%eax, %edx > > sall %cl, %eax > > testb $32, %cl > > je L2 > > movl %eax, %edx > > movl $0, %eax > > L2: > > movl %eax, -8(%ebp) > > movl %edx, -4(%ebp) > > > > This is fine, and works as I expect. > > However, this code: > > > > int main() { > > unsigned long long a; > > unsigned s= 63; > > > > a= (1 << s); > > > > return 0; > > } > > generates this assembler: > > > > movl $63, -12(%ebp) > > movl -12(%ebp), %ecx > > movl $1, %eax > > sall %cl, %eax > > cltd > > movl %eax, -8(%ebp) > > movl %edx, -4(%ebp) > > which is... wrong. Not only the results aren't what they should, but > > looking a little harder, the assembler generated doesn't seem to make > > sense. What's with the CLTD instruction there? If I change s (the > > shifted amount) to be 63 (31 is equivalent, because only 5 bits of %cl > > are used) then the result are a bunch of 1's because the sign of %eax > > goes all over %edx. And that's only one problem. If s is between 62 > > and 32, the 1 appears in %eax instead of being in %edx, where it > > should. > > > > This is obviusly not urgent, since the first code is perfectly > > acceptable and applicable to what I am doing, but I just got curious. > > This is an arithmetic overflow, and is explicitly undefined. One > result is as good as any other. What do you expect the code to do? > > Andrew. > > -- > Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK > Registered in England and Wales No. 3798903 > From Vladimir.Simonov@acronis.com Thu Mar 29 15:06:00 2007 From: Vladimir.Simonov@acronis.com (Vladimir Simonov) Date: Thu, 29 Mar 2007 15:06:00 -0000 Subject: How to dump all the optimization flags enabled? In-Reply-To: <17931.35118.255175.388522@zebedee.pink> References: <5be025980703281853r340a4a80rebb337bde8d5004b@mail.gmail.com> <17931.35118.255175.388522@zebedee.pink> Message-ID: <460BD5A1.3080900@acronis.com> Andrew Haley wrote: > Wei Hu writes: > > Hello, > > > > Is there a way to tell gcc to print out all the effective optimization > > flags when it compiles a C file? > > I know the manual tells you what flags are set at different > > optimization levels, but I'm still looking for an answer to my > > question because it will be useful to my project. > > Yes. -fverbose-asm dumps the flags to the .s file. > > Andrew. > Hi, Sorry, if probably a bit offtopic from subj. I've created flags lists for -O0 and -O2, made diff (see attach) and built my project both with -O0 and -O2 -fno-{all options marked by + in diff}. I've expected that results(binaries) will be equal. But they are different. Are my expectations correct? Or -O0 and -O2 -fno-{all options marked by + in diff} are not the same? Regards Vladimir -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: opts.diff URL: From aph@redhat.com Thu Mar 29 15:07:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 29 Mar 2007 15:07:00 -0000 Subject: Shifting: what's going on? In-Reply-To: <56aed05a0703290758o64818a1av84efd4e3f4b0f141@mail.gmail.com> References: <56aed05a0703282255ybc55393xeeb8215606fe8cc7@mail.gmail.com> <17931.35327.294152.153125@zebedee.pink> <56aed05a0703290758o64818a1av84efd4e3f4b0f141@mail.gmail.com> Message-ID: <17931.54731.338355.53605@zebedee.pink> Facundo Ciccioli writes: > FaQ > > 2007/3/29, Andrew Haley : > > Facundo Ciccioli writes: > > > > > > This is obviusly not urgent, since the first code is perfectly > > > acceptable and applicable to what I am doing, but I just got curious. > > > > This is an arithmetic overflow, and is explicitly undefined. One > > result is as good as any other. What do you expect the code to do? > > > I expect to get a 1 in the s-th bit of a, and zeroes in all other > bits. I don't know why you say that's an arithmetic overflow, if > unsigned long long is 64 bits long and it has a 63-th bit (the last > one). > > Anyway, Rupert Wood comment works, thanks a lot. So, even after Rupert Wood's explanation, you still don't realize that you had written an arithmetic overflow? Let's have a look at your code: int main() { unsigned long long a; unsigned s= 63; a= (1 << s); return 0; } This expression is a 32-bit signed integer constant 1 shifted left 63 places, which overflows: (1 << s); You then assign the result of this overflow to the 64-bit signed integer variable a: a= (1 << s); Andrew. -- Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK Registered in England and Wales No. 3798903 From eljay@adobe.com Thu Mar 29 15:11:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Thu, 29 Mar 2007 15:11:00 -0000 Subject: Shifting: what's going on? In-Reply-To: <56aed05a0703290758o64818a1av84efd4e3f4b0f141@mail.gmail.com> Message-ID: Hi Facundo, > I expect to get a 1 in the s-th bit of a, and zeroes in all other > bits. I don't know why you say that's an arithmetic overflow, if > unsigned long long is 64 bits long and it has a 63-th bit (the last > one). You are not dealing with an unsigned long long that is 64-bits. You are dealing with a signed int that is 32-bits. Shifting a number by an amount equal-to-or-greater-than its bitsize has undefined behavior. --Eljay From aph@redhat.com Thu Mar 29 15:21:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 29 Mar 2007 15:21:00 -0000 Subject: How to dump all the optimization flags enabled? In-Reply-To: <460BD5A1.3080900@acronis.com> References: <5be025980703281853r340a4a80rebb337bde8d5004b@mail.gmail.com> <17931.35118.255175.388522@zebedee.pink> <460BD5A1.3080900@acronis.com> Message-ID: <17931.55047.268978.189667@zebedee.pink> Vladimir Simonov writes: > > Andrew Haley wrote: > > Wei Hu writes: > > > Hello, > > > > > > Is there a way to tell gcc to print out all the effective optimization > > > flags when it compiles a C file? > > > I know the manual tells you what flags are set at different > > > optimization levels, but I'm still looking for an answer to my > > > question because it will be useful to my project. > > > > Yes. -fverbose-asm dumps the flags to the .s file. > > Sorry, if probably a bit offtopic from subj. > > I've created flags lists for -O0 and -O2, > made diff (see attach) and built my project > both with -O0 and -O2 -fno-{all options marked by + in diff}. > > I've expected that results(binaries) will be equal. > But they are different. > > Are my expectations correct? > Or -O0 and -O2 -fno-{all options marked > by + in diff} are not the same? I don't really understand your question, but if you're asking "if I set all individual optimization flags but don't set -O, will that still optimize?" the answer is no. If you're asking "f I unset all individual optimization flags but set -O2, will that be the same as -O0", the answer is no. Andrew. -- Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK Registered in England and Wales No. 3798903 From Vladimir.Simonov@acronis.com Thu Mar 29 15:27:00 2007 From: Vladimir.Simonov@acronis.com (Vladimir Simonov) Date: Thu, 29 Mar 2007 15:27:00 -0000 Subject: How to dump all the optimization flags enabled? In-Reply-To: <17931.55047.268978.189667@zebedee.pink> References: <5be025980703281853r340a4a80rebb337bde8d5004b@mail.gmail.com> <17931.35118.255175.388522@zebedee.pink> <460BD5A1.3080900@acronis.com> <17931.55047.268978.189667@zebedee.pink> Message-ID: <460BD987.6070000@acronis.com> Andrew Haley wrote: > Vladimir Simonov writes: > > > > Andrew Haley wrote: > > > Wei Hu writes: > > > > Hello, > > > > > > > > Is there a way to tell gcc to print out all the effective optimization > > > > flags when it compiles a C file? > > > > I know the manual tells you what flags are set at different > > > > optimization levels, but I'm still looking for an answer to my > > > > question because it will be useful to my project. > > > > > > Yes. -fverbose-asm dumps the flags to the .s file. > > > > Sorry, if probably a bit offtopic from subj. > > > > I've created flags lists for -O0 and -O2, > > made diff (see attach) and built my project > > both with -O0 and -O2 -fno-{all options marked by + in diff}. > > > > I've expected that results(binaries) will be equal. > > But they are different. > > > > Are my expectations correct? > > Or -O0 and -O2 -fno-{all options marked > > by + in diff} are not the same? > > I don't really understand your question, but if you're asking "if I > set all individual optimization flags but don't set -O, will that > still optimize?" the answer is no. If you're asking "f I unset all > individual optimization flags but set -O2, will that be the same as > -O0", the answer is no. > > Andrew. > The second one. Do you know a way to turn on optimization flags step by step from -O0 till -O2? Thank you. Vladimir From eljay@adobe.com Thu Mar 29 20:04:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Thu, 29 Mar 2007 20:04:00 -0000 Subject: How to dump all the optimization flags enabled? In-Reply-To: <460BD987.6070000@acronis.com> Message-ID: Hi Vladimir, >Do you know a way to turn on optimization flags step by step from -O0 till -O2? No, not possible. Not all optimizations are controlled by specific flags. Some are controlled by -O setting. And -O0 disables all optimizations, even those specified with a specific flag. Sincerely, --Eljay From flopbucket@hotmail.com Thu Mar 29 22:36:00 2007 From: flopbucket@hotmail.com (Flop Bucket) Date: Thu, 29 Mar 2007 22:36:00 -0000 Subject: tree-ssa optimizations In-Reply-To: <17922.46674.998692.167622@zebedee.pink> Message-ID: > > 1) I know that auto-vectorization is done on GIMPLE. > > I think I need to understand entire syntax GIMPLE to > > understand internal files of gcc which does > > auto-vectorization like tree-vectorizer.c. > > Isn't it? > > 2)Where can I get complete syntax of GIMPLE? > >gcc/tree.def > > 3) Is it possible to compile a .gimple/.ssa/.rtl file? > >No. Yes it is. You need to use gicc (was a symlink in previous releases as gimple-gcc). This will compile your .rtl file and generate the proper autovectorization code for you on architectures that support it. > > > Actually I want to modify above representations of > > a .c program and compile the modified file. > > If it is possible tell me how to do? > This can be done, see above. You need to skip the first phases and front end which generates the parse tree, and inject your modifications into the middle-stage where the p-code is generated. Take a look at gimple-gcc. _________________________________________________________________ Watch free concerts with Pink, Rod Stewart, Oasis and more. Visit MSN Presents today. http://music.msn.com/presents?icid=ncmsnpresentstagline&ocid=T002MSN03A07001 From electrofox@gmail.com Thu Mar 29 23:50:00 2007 From: electrofox@gmail.com (Edd Johnson) Date: Thu, 29 Mar 2007 23:50:00 -0000 Subject: Installing gcc: compiler? Message-ID: So gcc needs an existing ISO C90 compiler? Which should I use, and where should I get it. I am running Red Hat EL 4. I'm running in circles trying to install a few things, because they all depend on each other. Any help would be appreciated Thanks, Max (PS, I have the gcc source, but cannot install it. I have no existing c compiler installed. I do not have gcc on my system installation disks.) From chatterjee.digvijoy@gmail.com Fri Mar 30 01:25:00 2007 From: chatterjee.digvijoy@gmail.com (Digvijoy Chatterjee) Date: Fri, 30 Mar 2007 01:25:00 -0000 Subject: g++ option to generate code after template instantiation Message-ID: <9dd10b1d0703291650h31dd2047h7f50254c87b136ca@mail.gmail.com> when i say std::vector is there an option to g++ generate template instantiated source ,before converting C++ to assembly which could show me how the vector looks.... when the appropriate parameters are replaced template struct _Vector_base { struct _Vector_impl : public _Alloc { int* _M_start; int* _M_finish;............. This is a simple example , but if there is such an option this could be really helpful ,to understand complex template instantiations. Thx Digz From sergio.giro.ar@gmail.com Fri Mar 30 01:56:00 2007 From: sergio.giro.ar@gmail.com (Sergio Giro) Date: Fri, 30 Mar 2007 01:56:00 -0000 Subject: Check of throw qualifiers Message-ID: Dear, I would like to know if there are unimplemented checks related to throw qualifiers. E.g., if I have two methods int theClass::oneMethod() throw (AnException) { throw AnException(); return 1; } int theClass::otherMethod () throw () { return oneMethod(); } Should this be an error? gcc does not complain about that. In addition, if I use the method this way try { otherMethod() } catch(AnException); the exception is not catched (because of the "throw ()", I guess). This seems to be quite strange, I think that the idea of using throw qualifiers is to enforce that the only exceptions the caller needs to catch are those declared in the qualifier. So, the "throw ()" should not be possible. I think that the throw () should be possible only if all the invocations to methods throwing exceptions are enclosed into try { } catch blocks. Quoting the manual, is it a "Regrettable thing we can't change" or a "Known problem"? Cheers, Sergio From narkewoody@gmail.com Fri Mar 30 02:37:00 2007 From: narkewoody@gmail.com (Steven Woody) Date: Fri, 30 Mar 2007 02:37:00 -0000 Subject: How to read the linker map file? Message-ID: hi, i used -Wl,-Map=map.txt,--crossref to generated a map file. but i fond the contents in the file are not easy to understand. is there a document or readme descripting what're in the file? thanks. -- woody then sun rose thinly from the sea and the old man could see the other boats, low on the water and well in toward the shore, spread out across the current. From glegoo@gmail.com Fri Mar 30 03:01:00 2007 From: glegoo@gmail.com (Wei Hu) Date: Fri, 30 Mar 2007 03:01:00 -0000 Subject: How to dump all the optimization flags enabled? In-Reply-To: <1175140467.5262.1.camel@localhost.localdomain> References: <5be025980703281853r340a4a80rebb337bde8d5004b@mail.gmail.com> <1175140467.5262.1.camel@localhost.localdomain> Message-ID: <5be025980703291937o4fb8d41dn434448d278861bcb@mail.gmail.com> Thanks to all for the kind answers! On 3/28/07, Ramana Radhakrishnan wrote: > > > On Wed, 2007-03-28 at 21:53 -0400, Wei Hu wrote: > > Hello, > > > > Is there a way to tell gcc to print out all the effective optimization > > flags when it compiles a C file? > > -fverbose-asm prints out all the optimization options to the assembler > files. So a combination of --save-temps and -fverbose-asm + some > scripting magic could do the trick for you . > > cheers > Ramana > -- > cheers > Ramana > > Ramana Radhakrishnan > IDE & Tools Group > Celunite Inc (www.celunite.com) > > > From ken.lu@intel.com Fri Mar 30 05:40:00 2007 From: ken.lu@intel.com (Lu, Ken) Date: Fri, 30 Mar 2007 05:40:00 -0000 Subject: About address alignment of unicode string data Message-ID: <1C601A6A3344064EB423D0C1E83B717B015371FE@pdsmsx411.ccr.corp.intel.com> Hello: I have question about GCC which is in different behavior with MS VC. See following code: wchar_t *TestStr = L"MyString"; If built by MSVC, the address TestStr would align at 16-bit boundary that mean TestStr's address is even. Because the data of L"MyString" is unicode code string. But if build by GCC, the address of TestStr is even or odd but not always even. I have tried many GCC compiler options but seems not compiler options can make the address of TestStr align to even address. My GCC version is 4.0.2. Who can tell me how to control the alignment of const Unicode data L"" in GCC? Thanks. - K Best Regard! ------------------------------------------------------------------------ ------------ Hear and you forget; see and you remember; do and you understand. --Confucius "The content of this message is my personal opinion only and although I am an employee of Intel, the statements I make here in no way represent Intel's position on the issue, nor am I authorized to speak on behalf of Intel on this matter" From tprince@myrealbox.com Fri Mar 30 08:06:00 2007 From: tprince@myrealbox.com (Tim Prince) Date: Fri, 30 Mar 2007 08:06:00 -0000 Subject: Installing gcc: compiler? In-Reply-To: References: Message-ID: <460CA2C1.7080002@myrealbox.com> Edd Johnson wrote: > So gcc needs an existing ISO C90 compiler? Which should I use, and > where should I get it. I am running Red Hat EL 4. The gcc which comes in the development tools option of your Red Hat is the most obvious choice for building gcc. From dreams_arpit@yahoo.co.in Fri Mar 30 08:29:00 2007 From: dreams_arpit@yahoo.co.in (arpit jain) Date: Fri, 30 Mar 2007 08:29:00 -0000 Subject: GDB-6.4 Build Message-ID: <129976.18474.qm@web8414.mail.in.yahoo.com> Hiiii, I have build GDB-6.3 on Linux for some embedded target i.e. cross builded GDB-6.3 for some different target processor.I have builded it succesfully on my host system but wat i am getting is simulator only that comes with GDB for that target.There is no binary for GDB itself so that I can debug my appication. I am getting "i***-unknown-coff-run" binary file only. Q. Can someone plz tell me how to get that GDB also with simulator? Thanks Arpit __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/ From olivier.delannoy@gmail.com Fri Mar 30 10:17:00 2007 From: olivier.delannoy@gmail.com (Olivier Delannoy) Date: Fri, 30 Mar 2007 10:17:00 -0000 Subject: Code Generator: usage of the #line directive Message-ID: <2b9a46b30703300129r12d33701k50fbf6330020bd23@mail.gmail.com> Hello, I have written a code generator which takes an XML document and generate a C++ file. The XML document contains text element which contains C++ code. I would like to be able to locate error message based on the start of the text element. I think the #line directive is to be use for this but I have trouble marking the end of an included section. The code from the XML document behave really like an include and I would like to report errors in the same way. Thanks for your help. -- Olivier Delannoy ATER PRiSM Laboratory Versailles University, FRANCE From eljay@adobe.com Fri Mar 30 11:10:00 2007 From: eljay@adobe.com (John (Eljay) Love-Jensen) Date: Fri, 30 Mar 2007 11:10:00 -0000 Subject: Check of throw qualifiers References: Message-ID: Hi Sergio, > Should this be an error? gcc does not complain about that. It's an error. It's a runtime error, not something GCC will complain about. >Quoting the manual, is it a "Regrettable thing we can't change" or a "Known problem"? In my opinion, a known "C++ exceptions are not as nice as Java exceptions, and I wish they were" regrettable thing we can't change. HTH, --Eljay From cppljevans@suddenlink.net Fri Mar 30 12:27:00 2007 From: cppljevans@suddenlink.net (Larry Evans) Date: Fri, 30 Mar 2007 12:27:00 -0000 Subject: g++-4.3 alignas(const-expr) fails; workaround? Message-ID: <460CE1A0.6030205@suddenlink.net> With g++-4.3-20070323, alignas(2) fails compile with message indicating it needs a type instead of constant expression. Is there any workaround. For example, could I: typedef unsigned char work_around[const-expr]; unsigned char alignas(work_around) actual_var[const-expr] ? TIA. -Larry From vivek.list@gmail.com Fri Mar 30 12:42:00 2007 From: vivek.list@gmail.com (vivek tyagi) Date: Fri, 30 Mar 2007 12:42:00 -0000 Subject: arm-elf-gcc shared flat support Message-ID: Hi , I am working on Shared flat file support for uClinux (No MMU ARM ).The gcc version I am using is 2.95 and 3.4.0.Theory of operation is similar to that implemented for m68k.One of the major requirement is to call functions via GOT. so a code ******c-code************** foo() {} main() { foo(); } ****************************** is to be called as ****compiler output*********** ldr r3, .L4 mov lr,pc ldr pc[sl,r3] .L4: .word foo(GOT) ****************************** as opposed to bl foo(PLT) where sl holds the address of GOT.(binfmt_flat loader ensures that before the program start) in gcc 3.4.0 this is some how achived if the function attribute __attribute__((weak)) is specified.But no idea for 2.95 Kindly bail me out on this one. Sincere Thanks in advance. Vivek Tyagi From rearnsha@arm.com Fri Mar 30 13:59:00 2007 From: rearnsha@arm.com (Richard Earnshaw) Date: Fri, 30 Mar 2007 13:59:00 -0000 Subject: arm-elf-gcc shared flat support In-Reply-To: References: Message-ID: <1175258559.18859.22.camel@pc960.cambridge.arm.com> On Fri, 2007-03-30 at 17:57 +0530, vivek tyagi wrote: > Hi , > This is the wrong list for these sorts of questions, you should really be asking on gcc-help. > I am working on Shared flat file support for uClinux (No MMU ARM ).The > gcc version > I am using is 2.95 and 3.4.0.Theory of operation is similar to that > implemented for m68k.One of the major requirement is to call functions > via GOT. > so a code > > ******c-code************** > foo() > {} > main() > { > foo(); > } > > ****************************** > > is to be called as > > ****compiler output*********** > > ldr r3, .L4 > mov lr,pc > ldr pc[sl,r3] > > .L4: > .word foo(GOT) > > ****************************** > > as opposed to > bl foo(PLT) > > where sl holds the address of GOT.(binfmt_flat loader ensures that > before the program start) > > in gcc 3.4.0 this is some how achived if the function attribute > __attribute__((weak)) is specified.But no idea for 2.95 > That weak calls have this property is really due to a bug in the compiler (some day I might even fix it :-). You can probably make things work the way you want with more recent compilers if you use -mlong-calls, but it's not really designed for this purpose, so some local definitions may be short-circuited. Is there some reason why linker-generated PLT sequences aren't a reasonable solution? R. From flopbucket@hotmail.com Fri Mar 30 14:01:00 2007 From: flopbucket@hotmail.com (Flop Bucket) Date: Fri, 30 Mar 2007 14:01:00 -0000 Subject: How to read the linker map file? In-Reply-To: Message-ID: >i used -Wl,-Map=map.txt,--crossref to generated a map file. but i >fond the contents in the file are not easy to understand. is there a >document or readme descripting what're in the file? > >thanks. I believe this is the standard COFF-ELF format, take a look at "COFF & ELF Linker Maps" on Amazon. the moon rose thinly from the old man and we could see the his boats, low on the water and well in toward the shore, spread out more than desired. _________________________________________________________________ Interest Rates near 39yr lows! $430,000 Mortgage for $1,399/mo - Calculate new payment http://www.lowermybills.com/lre/index.jsp?sourceid=lmb-9632-18466&moid=7581 From flopbucket@hotmail.com Fri Mar 30 14:18:00 2007 From: flopbucket@hotmail.com (Flop Bucket) Date: Fri, 30 Mar 2007 14:18:00 -0000 Subject: Code Generator: usage of the #line directive In-Reply-To: <2b9a46b30703300129r12d33701k50fbf6330020bd23@mail.gmail.com> Message-ID: >I have written a code generator which takes an XML document and >generate a C++ file. The XML document contains text element which >contains C++ code. I would like to be able to locate error message >based on the start of the text element. I think the #line directive Hmm, sorry, not going to work. #line is used to give the compiler a hint as to how many lines of source code to expect, this way it can size its caches and do memory allocations up front, thereby decreasing compile time. On my current project, we have 583,250 lines of C++. With out a #inline, it compiles in 12min 43 seconds, but if I insert a #line 600000 compile time drops to 7min flat. You should do some research on memory allocation, it is known in professional circles to be one of the more "expensive" activities your code can do. Also fragmentation can occur, but that is beyond the scope of this email. _________________________________________________________________ Exercise your brain! Try Flexicon. http://games.msn.com/en/flexicon/default.htm?icid=flexicon_hmemailtaglinemarch07 From paul@codesourcery.com Fri Mar 30 16:05:00 2007 From: paul@codesourcery.com (Paul Brook) Date: Fri, 30 Mar 2007 16:05:00 -0000 Subject: arm-elf-gcc shared flat support In-Reply-To: References: Message-ID: <200703301518.32140.paul@codesourcery.com> > I am working on Shared flat file support for uClinux (No MMU ARM ).The > gcc version > I am using is 2.95 and 3.4.0.Theory of operation is similar to that You really need to be using the latest gcc (ie. svn trunk, aka 4.3) before we can help you. gcc also has a uclinux target. You should be using that rather than the generic ELF one. > implemented for m68k.One of the major requirement is to call functions > is to be called as > > ****compiler output*********** > > ldr r3, .L4 > mov lr,pc > ldr pc[sl,r3] > > .L4: > .word foo(GOT) > > ****************************** > > as opposed to > bl foo(PLT) > > where sl holds the address of GOT.(binfmt_flat loader ensures that > before the program start) Why on earth do you need to do this? Can't you get the linker to generate PLT sequences like we do for normal shared libraries? Paul From ramana.radhakrishnan@celunite.com Fri Mar 30 17:09:00 2007 From: ramana.radhakrishnan@celunite.com (Ramana Radhakrishnan) Date: Fri, 30 Mar 2007 17:09:00 -0000 Subject: GDB-6.4 Build In-Reply-To: <129976.18474.qm@web8414.mail.in.yahoo.com> References: <129976.18474.qm@web8414.mail.in.yahoo.com> Message-ID: <1175270644.24232.40.camel@localhost.localdomain> Hi, On Fri, 2007-03-30 at 09:06 +0100, arpit jain wrote: > Hiiii, > > I have build GDB-6.3 on Linux for some embedded > target i.e. cross builded GDB-6.3 for some different > target processor.I have builded it succesfully on my > host system but wat i am getting is simulator only > that comes with GDB for that target.There is no binary > for GDB itself so that I can debug my appication. > I am getting "i***-unknown-coff-run" binary file only. Wrong list . This is for help with using gcc. Try gdb@sourceware.org cheers Ramana > > Q. Can someone plz tell me how to get that GDB also > with simulator? > > Thanks > Arpit > > > > __________________________________________________________ > Yahoo! India Answers: Share what you know. Learn something new > http://in.answers.yahoo.com/ -- cheers Ramana Ramana Radhakrishnan IDE & Tools Group Celunite Inc (www.celunite.com) From flopbucket@hotmail.com Fri Mar 30 20:31:00 2007 From: flopbucket@hotmail.com (Flop Bucket) Date: Fri, 30 Mar 2007 20:31:00 -0000 Subject: Code Generator: usage of the #line directive In-Reply-To: <2b9a46b30703300943r3b32f6ebp639c7279b8578e0e@mail.gmail.com> Message-ID: > >#line is indeed use to report the source of the code that come after >the directive. I am just not sure on how to get back to the initial >value of __LINE__, __FILE__ after the chunk of generated code has been >included. OK I misunderstood. You want to use #line to change the current line number, and then set it back to what is should be after you are finished? I dont know anything special you can do with #line but maybe you could someone get the value of __LINE__ and then set it back? #line __LINE__ ? I know that #line can work with macros after it. Would something like #define CUR_POS __LINE__ #line 500 ... you generated code here ... #line CUR_POS havent tried this, just an idea. _________________________________________________________________ The average US Credit Score is 675. The cost to see yours: $0 by Experian. http://www.freecreditreport.com/pm/default.aspx?sc=660600&bcd=EMAILFOOTERAVERAGE From dberlin@dberlin.org Sat Mar 31 00:12:00 2007 From: dberlin@dberlin.org (Daniel Berlin) Date: Sat, 31 Mar 2007 00:12:00 -0000 Subject: tree-ssa optimizations In-Reply-To: References: <17922.46674.998692.167622@zebedee.pink> Message-ID: <4aca3dc20703301331s62487e55n170cddbb46a80733@mail.gmail.com> On 3/29/07, Flop Bucket wrote: > > > 1) I know that auto-vectorization is done on GIMPLE. > > > I think I need to understand entire syntax GIMPLE to > > > understand internal files of gcc which does > > > auto-vectorization like tree-vectorizer.c. > > > Isn't it? > > > 2)Where can I get complete syntax of GIMPLE? > > > >gcc/tree.def > > > > 3) Is it possible to compile a .gimple/.ssa/.rtl file? > > > >No. > > Yes it is. You need to use gicc (was a symlink in previous releases as > gimple-gcc). This will compile your .rtl file and generate the proper > autovectorization code for you on architectures that support it. We (GCC) don't ship such a thing, and have never heard of such a thing Neither has google, from what i can tell. Link? > From egon.kocjan@xlab.si Sat Mar 31 00:23:00 2007 From: egon.kocjan@xlab.si (Egon Kocjan) Date: Sat, 31 Mar 2007 00:23:00 -0000 Subject: horrible link times with g++ 4.1.1 and -g Message-ID: <460DA749.5050209@xlab.si> Hello, I am trying to build a ~100 KLOC c++ application with g++ 4.1.1 and debugging enabled (-g, no -O...). I also link statically some other libraries, like libxml, clucene, etc.., mostly c. The link time with -g is really horrible - it is in range of several minutes! I used 3.4.5 previously, and link time was more like 10-20 seconds. Am I missing something obvious here? Regards, Egon Kocjan From brian@dessent.net Sat Mar 31 03:21:00 2007 From: brian@dessent.net (Brian Dessent) Date: Sat, 31 Mar 2007 03:21:00 -0000 Subject: horrible link times with g++ 4.1.1 and -g References: <460DA749.5050209@xlab.si> Message-ID: <460DA9F9.394387B2@dessent.net> Egon Kocjan wrote: > I am trying to build a ~100 KLOC c++ application with g++ 4.1.1 and > debugging enabled (-g, no -O...). I also link statically some other > libraries, like libxml, clucene, etc.., mostly c. The link time with -g > is really horrible - it is in range of several minutes! I used 3.4.5 > previously, and link time was more like 10-20 seconds. Am I missing > something obvious here? The linker is not part of gcc. Assuming you're using the GNU linker, it's part of binutils, which has its own mailing list. There have been some speedups in the linker code over the last few years, so the first thing I'd do would be to try the latest version (or better, CVS HEAD) and see if the problem is still there. If so, post to the binutils list with as many details as you can. Brian From paul@codesourcery.com Sat Mar 31 04:01:00 2007 From: paul@codesourcery.com (Paul Brook) Date: Sat, 31 Mar 2007 04:01:00 -0000 Subject: arm-elf-gcc shared flat support In-Reply-To: References: <1175258559.18859.22.camel@pc960.cambridge.arm.com> Message-ID: <200703310421.08702.paul@codesourcery.com> > the ELF file generated by the cross compiler tool chain(here > arm-elf-gcc).Now the flat files do not have a PLT .They are very > > simple format with TEXT:GOT:DATA:RELCO sections(in that order).so IMHO the > generic linker modification for PLT sequences cannot be done. Sure it can. The dynamic loader doesn't need to know or care about the plt. It's produced entirely by the static linker. > now the object files would be linked as > arm-elf-gcc ?exe.o -Wl,-R,shared-lib.o Relying on ld -R to build sounds like a fairly bad idea. Also, as you're designing something new, you really should make it EABI based (http://www.arm.com/products/DevTools/ABI.html). That describes a model for generating ELF images, and using a postlinker to generate target binaries (Probably bFLT in this case). Paul From narkewoody@gmail.com Sat Mar 31 04:13:00 2007 From: narkewoody@gmail.com (Steven Woody) Date: Sat, 31 Mar 2007 04:13:00 -0000 Subject: How to read the linker map file? In-Reply-To: References: Message-ID: On 3/30/07, Flop Bucket wrote: > >i used -Wl,-Map=map.txt,--crossref to generated a map file. but i > >fond the contents in the file are not easy to understand. is there a > >document or readme descripting what're in the file? > > > >thanks. > > I believe this is the standard COFF-ELF format, take a look at "COFF & ELF > Linker Maps" on Amazon. > > i tried , but found nothing :-( -- woody then sun rose thinly from the sea and the old man could see the other boats, low on the water and well in toward the shore, spread out across the current. From jbenezech@yahoo.com Sat Mar 31 09:41:00 2007 From: jbenezech@yahoo.com (Jerome Benezech) Date: Sat, 31 Mar 2007 09:41:00 -0000 Subject: GCJ - undefined reference Message-ID: <336073.18913.qm@web32214.mail.mud.yahoo.com> Hi All, I am using GCJ 4.2.0 to compile my java app into a win32 exe. My app uses external jars like log4j. I use the makefile built by eclipse plugin GCJBuilder. So the external libraries have been compiled into .o object files as well as all my java classes. During the compiling/linking (??) process, I get these "undefined reference" errors from external jars classes like log4J but also from my own java classes. Any help would be greatly appreciated. The compile line is like this: gcj -O2 -g3 -fjni -ID:\Software\Programming\gcc-119844-win\share\awt\gui.jar -IC:/MesDocuments/_dev/CocoonWorkspace/Compilation/lib --main=cafe.main.UpdateLauncher debug/./commons-net-1.4.1.jar.o debug/./ethermac.jar.o debug/./jakarta-oro-2.0.8.jar.o debug/./jdic_misc.jar.o debug/./jdic-native.jar.o debug/./jRegistryKey.jar.o debug/./log4j-1.2.12.jar.o cafe/AdCafeException.o cafe/AdCafeProperties.o cafe/Updater.o cafe/MsWinSvc.o cafe/configuration/Configurator.o cafe/configuration/PCConfig.o cafe/configuration/BasePCConfig.o cafe/main/UpdateInstaller.o cafe/main/TestUpdateInstaller.o cafe/main/ConfiguratorLauncher.o cafe/main/TestReporterLauncher.o cafe/main/ReporterLauncher.o cafe/main/TestUpdaterLauncher.o cafe/main/TestConfiguratorLauncher.o cafe/main/UpdateLauncher.o cafe/main/Test.o cafe/reporter/LogFileReporter.o cafe/reporter/StatisticsReporter.o cafe/reporter/Reporter.o cafe/reporter/ActivityReporter.o cafe/updater/LocalUpdateWrapper.o cafe/updater/SoftwareUpdater.o cafe/updater/CafeConfigUpdater.o cafe/updater/AdsUpdater.o cafe/updater/RemoteAdsUpdater.o cafe/updater/RemoteCafeConfigUpdater.o cafe/updater/UpdateWrapper.o cafe/updater/FtpUpdateWrapper.o cafe/updater/RemoteSoftwareUpdater.o cafe/updater/LocalAdsUpdater.o cafe/updater/LocalSoftwareUpdater.o cafe/updater/LocalCafeConfigUpdater.o cafe/updater/Updater.o cafe/util/RegistryUtil.o cafe/util/FileZipper.o cafe/util/JakartaFtpWrapper.o cafe/util/HTTPUtil.o cafe/util/EncryptedFileHandler.o cafe/util/RegistryNotSetException.o cafe/util/CafeUtil.o cafe/util/NetUtil.o -odebug/Compilation -Ldebug -LC:/MesDocuments/_dev/CocoonWorkspace/Compilation/lib An error from the external jar: C:/MesDocuments/_dev/CocoonWorkspace/Compilation/org/apache/log4j/config/PropertyPrinter.java:113: undefined reference to `_ZN4java3awt9Component18firePropertyChangeEJvPNS_4lang6StringEff' An error from one of my own class: C:/MesDocuments/_dev/CocoonWorkspace/Compilation/cafe/AdCafeProperties.java:272: undefined reference to `cafe::AdCafeException::class$' Cheers, Jerome Jerome Benezech jbenezech@yahoo.com From aph@gcc.gnu.org Sat Mar 31 10:27:00 2007 From: aph@gcc.gnu.org (Andrew Haley) Date: Sat, 31 Mar 2007 10:27:00 -0000 Subject: GCJ - undefined reference In-Reply-To: <336073.18913.qm@web32214.mail.mud.yahoo.com> References: <336073.18913.qm@web32214.mail.mud.yahoo.com> Message-ID: <17934.11451.708078.463889@zebedee.pink> Jerome Benezech writes: > I am using GCJ 4.2.0 to compile my java app into a > win32 exe. My app uses external jars like log4j. I use > the makefile built by eclipse plugin GCJBuilder. > > So the external libraries have been compiled into .o > object files as well as all my java classes. During > the compiling/linking (??) process, I get these > "undefined reference" errors from external jars > classes like log4J but also from my own java classes. > > Any help would be greatly appreciated. > An error from the external jar: > > C:/MesDocuments/_dev/CocoonWorkspace/Compilation/org/apache/log4j/config/PropertyPrinter.java:113: > undefined reference to > `_ZN4java3awt9Component18firePropertyChangeEJvPNS_4lang6StringEff' java.awt.Component.firePropertyChange(java.lang.String, float, float)void is a Java 1.5 method. It's in the gcc 4.2 branch, not the 4.1 branch. > An error from one of my own class: > > > C:/MesDocuments/_dev/CocoonWorkspace/Compilation/cafe/AdCafeProperties.java:272: > undefined reference to `cafe::AdCafeException::class$' Not sure about that. It certainly should be there: I'd use nm to inspect cafe/AdCafeException.o. Andrew. From dima.sorkin@gmail.com Sat Mar 31 11:42:00 2007 From: dima.sorkin@gmail.com (Dima Sorkin) Date: Sat, 31 Mar 2007 11:42:00 -0000 Subject: friend template Message-ID: Hi. I have the following error case on gcc 3.4.6. It seems like legal c++. How can it be overcomed ? Thank you, Dima. -------------------------------------------- code ------------------------------------------------ namespace boost { namespace numeric { namespace ublas { template class matrix_row; template void swap (matrix_row mr1, matrix_row mr2); template class matrix_row : public ... { .... friend void swap<> (matrix_row mr1, matrix_row mr2); // line 204 ... }; // definition of swap follows here ... ------------------------------------- error msg --------------------------------------------- /user_temp/dsorkin/libs/boost_1_33_0/boost/numeric/ublas/matrix_proxy.hpp:204: error: variable or field `swap' declared void /user_temp/dsorkin/libs/boost_1_33_0/boost/numeric/ublas/matrix_proxy.hpp:204: error: `swap' is neither function nor member function; cannot be declared friend /user_temp/dsorkin/libs/boost_1_33_0/boost/numeric/ublas/matrix_proxy.hpp:204: error: expected `;' before '<' token /user_temp/dsorkin/libs/boost_1_33_0/boost/numeric/ublas/matrix_proxy.hpp:2479: warning: friend declaration `void boost::numeric::ublas::swap(boost::numeric::ublas::matrix_range, boost::numeric::ublas::matrix_range)' declares a non-template function ----------------------------------- gcc version ------------------------------------------------- g++ (GCC) 3.4.6 20060404 (Red Hat 3.4.6-3) From vda.linux@googlemail.com Sat Mar 31 19:56:00 2007 From: vda.linux@googlemail.com (Denis Vlasenko) Date: Sat, 31 Mar 2007 19:56:00 -0000 Subject: How to Install GCC In-Reply-To: <20070311150107.GQ4439@fencepost.gnu.org> References: <92e033780703110745p60d734dfm4aff466d7a14f390@mail.gmail.com> <20070311150107.GQ4439@fencepost.gnu.org> Message-ID: <200703311341.58507.vda.linux@googlemail.com> On Sunday 11 March 2007 16:01, Thomas Schwinge wrote: > On Sun, Mar 11, 2007 at 10:45:53AM -0400, Sadri SARRAY wrote: > > Please, Would you like to send me a procedure to install the GCC > > compiler on a Linux-Ubuntu OS ? > > With a power screwdriver. Granted, poster was totally new to Linux and asked a very stupid question, but did you really need to practice yourself in user alienation? You could point him to http://www.catb.org/~esr/faqs/smart-questions.html -- vda From noorez.mailist.gcc@gmail.com Thu Mar 1 03:53:00 2007 From: noorez.mailist.gcc@gmail.com (Noorez Kassam) Date: Thu, 01 Mar 2007 03:53:00 -0000 Subject: Missing file in GCC build Message-ID: <52686be80702281953v4691ca22l8f174a3716b9d44d@mail.gmail.com> I am attempting to build the gcc system however, i received the following error on the 'make' stage of the build. Here is a snippet from the build progress.. /bin/sh: cannot open kinds.h: No such file make[2]: *** [kinds.inc] Error 2 make[2]: Leaving directory `/home/noorez/Desktop/objdir/i686-pc-linux-gnu/libgfortran' make[1]: *** [all-target-libgfortran] Error 2 make[1]: Leaving directory `/home/noorez/Desktop/objdir' make: *** [all] Error 2 I have all the perquisites for building gcc listed on the gcc site: http://gcc.gnu.org/install/prerequisites.html and I am quite sure that I unpacked all files that were necessary for the build. Is there anything that I missed? From tprince@myrealbox.com Thu Mar 1 05:14:00 2007 From: tprince@myrealbox.com (Tim Prince) Date: Thu, 01 Mar 2007 05:14:00 -0000 Subject: Missing file in GCC build In-Reply-To: <52686be80702281953v4691ca22l8f174a3716b9d44d@mail.gmail.com> References: <52686be80702281953v4691ca22l8f174a3716b9d44d@mail.gmail.com> Message-ID: <45E6612E.2030105@myrealbox.com> Noorez Kassam wrote: > I am attempting to build the gcc system however, i received the > following error on the 'make' stage of the build. Here is a snippet > from the build progress.. > > /bin/sh: cannot open kinds.h: No such file > make[2]: *** [kinds.inc] Error 2 > make[2]: Leaving directory > `/home/noorez/Desktop/objdir/i686-pc-linux-gnu/libgfortran' > make[1]: *** [all-target-libgfortran] Error 2 > If you search the archives of the gfortran mail list, you should see discussion of several ways in which generation of kinds.h for libgfortran has been seen to fail. Almost certainly, this is a consequence of a problem which should have been indicated earlier in your build. Correctly updating your gmp and mpfr installations is among the necessary steps. Among other things, the details depend on which version of gcc it is, which you didn't care to reveal, and I would as soon not hear about. From dreams_arpit@yahoo.co.in Thu Mar 1 07:38:00 2007 From: dreams_arpit@yahoo.co.in (arpit jain) Date: Thu, 01 Mar 2007 07:38:00 -0000 Subject: Building cross compiler Message-ID: <510582.99771.qm@web8409.mail.in.yahoo.com> Hiiiiiiiii Can anyone please help me regarding building gcc-3.x as a cross compiler for embedded targets?? I have build binutils package for cross linker and cross assembler. 1. Do i need to configure the gcc by giving -with-as and --with-ld cross assembler and cross linker or should I configure it with -with-gnu-ld and --with-gnu-as? Thanks Arpit __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/ From Walter.Kasberg@web.de Thu Mar 1 08:20:00 2007 From: Walter.Kasberg@web.de (Walter Kasberg) Date: Thu, 01 Mar 2007 08:20:00 -0000 Subject: How to pass function names as parameter? In-Reply-To: References: Message-ID: <200703010920.28540.Walter.Kasberg@web.de> On Wednesday 28 February 2007 19:48, John Love-Jensen wrote: > Hi Walter, > > This isn't doing what you think it is doing: > > rufen ( feins () ); > rufen ( fzwei () ); > > You probably wanted: > > rufen ( feins ); > rufen ( fzwei ); > > HTH, > --Eljay I tried it, but it too does not work. There is still the memory address error. Walter From Walter.Kasberg@web.de Thu Mar 1 08:28:00 2007 From: Walter.Kasberg@web.de (Walter Kasberg) Date: Thu, 01 Mar 2007 08:28:00 -0000 Subject: How to pass function names as parameter? In-Reply-To: References: Message-ID: <200703010928.36051.Walter.Kasberg@web.de> On Wednesday 28 February 2007 19:48, John Love-Jensen wrote: > Hi Walter, > > This isn't doing what you think it is doing: > > rufen ( feins () ); > rufen ( fzwei () ); > > You probably wanted: > > rufen ( feins ); > rufen ( fzwei ); > > HTH, > --Eljay sorry, discard my previous mail. I made a mistake: I changed the code but did not save the changes and compiled the old version. Thanks, you are right, now it works. Walter From ext@sidvind.com Thu Mar 1 09:18:00 2007 From: ext@sidvind.com (David Sveningsson) Date: Thu, 01 Mar 2007 09:18:00 -0000 Subject: Variadic macros and commas Message-ID: <45E69A48.3070903@sidvind.com> Hi, I have a function that takes any number of pointers and creates an array (an array class) and puts the pointers in it. This is the prototype: Array *ar(Object *first = NULL, ...); It keeps adding pointers until NULL is reached, thus the argument list must be ended with NULL. If 'first' is NULL an empty array is returned. However too often NULL is forgotten causing nasty bugs. So what I want to do is to create a macro that adds NULL after the varadic arguments. #define ar(...) real_ar( __VA_ARGS__, NULL ) The above works as long as we have arguments but using ar() expands to real_ar( , NULL ) which is a compiler error. Using ## with __VA_ARGS__ doesn't seem to work in this case. The manual doesn't say this but it seems like it only works when the comma is placed before __VA_ARGS. I got the same error at least. So, is there a way to do this? Or maybe I am doing it all wrong, maybe there is a better way. -- //*David Sveningsson [eXt]* Freelance coder | Game Development Student http://sidvind.com Thou shalt make thy program's purpose and structure clear to thy fellow man by using the One True Brace Style, even if thou likest it not, for thy creativity is better used in solving problems than in creating beautiful new impediments to understanding. From osv@javad.com Thu Mar 1 11:22:00 2007 From: osv@javad.com (Sergei Organov) Date: Thu, 01 Mar 2007 11:22:00 -0000 Subject: better load/store scheduling References: <96CDC40E4321F84FA0FB83A1EF2A422864B93F@Hermes.shaktisystems.com> Message-ID: "Ben Cheng" writes: > I am trying to tune the performance of hand-unrolled code. I was > wondering what cmd-line options should I specify in order to get h[i+1] > loaded before the store to g[i]: > > > Code: > > void foo(int * __restrict g, int * __restrict h) > { > int i; > for (i = 0; i < 4096; i+=2) { > g[i] = h[i] + 10; > g[i+1] = h[i+1] + 10; > } > } Use temporaries: void foo(int * __restrict g, int * __restrict h) { int i; for (i = 0; i < 4096; i+=2) { int a = h[i]; int b = h[i+1]; g[i] = a + 10; g[i+1] = b + 10; } } > > Command line: > > gcc-4.0.2 -O3 loop.c -fargument-noalias-global -fstrict-aliasing -S > loop.s > > Assembly code of the loop body: > > .L2: > leal 0(,%ebx,4), %eax > leal (%eax,%esi), %ecx > leal (%edi,%eax), %eax > movl -8(%ecx), %edx // = h[i] > addl $10, %edx // + 10 > movl %edx, -8(%eax) // g[i] = > movl -4(%ecx), %edx // = h[i+1] > addl $10, %edx // + 10 > movl %edx, -4(%eax) // g[i+1] = > addl $2, %ebx > cmpl $4098, %ebx > jne .L2 With gcc 4.0.4, it gives: .L2: leal 0(,%ebx,4), %edx addl $2, %ebx leal (%esi,%edx), %eax addl %edi, %edx movl -4(%eax), %ecx movl -8(%eax), %eax addl $10, %ecx addl $10, %eax cmpl $4098, %ebx movl %eax, -8(%edx) movl %ecx, -4(%edx) jne .L2 With gcc 4.1.2, it gives: .L2: movl -4(%ebx,%ecx,4), %eax movl -8(%ebx,%ecx,4), %edx addl $10, %eax addl $10, %edx movl %edx, -8(%esi,%ecx,4) movl %eax, -4(%esi,%ecx,4) addl $2, %ecx cmpl $4098, %ecx jne .L2 -- Sergei. From monica@natalnet.br Thu Mar 1 12:18:00 2007 From: monica@natalnet.br (=?iso-8859-1?Q?Monica_Magalh=E3es_Pereira?=) Date: Thu, 01 Mar 2007 12:18:00 -0000 Subject: Basic blocks and profiling information Message-ID: Hi, I would like to know if there is any command which I can see the basic blocks show in profiling information. I am using an older version of gcc, because I need to see the bb.out and analyze the profiling information about the basic blocks. But now, I need to see the basic blocks. Is there any command that I can generate these basic blocks? Thanks Monica From dreams_arpit@yahoo.co.in Thu Mar 1 12:40:00 2007 From: dreams_arpit@yahoo.co.in (arpit jain) Date: Thu, 01 Mar 2007 12:40:00 -0000 Subject: building gcc cross compiler Message-ID: <647496.70499.qm@web8402.mail.in.yahoo.com> Hiiiiiii I am trying to build gcc-3.x cross-compiler for Ada language.I have successfully build binutils package for the same target. Now I am trying to configure the gcc by giving the configure command as: /configure --prefix=/home/compiler/arpitj/cross/install/ --host=i686-pc-linux-gnu --enable-obsolete --enable-languages="c,ada" --target=i***-unknown-coff --with-/compiler/arpitj/binutils/binutil_build/install/bin/ --with-as=/home/compiler/arpitj/binutils/binutil_build/install/bin/ --with-ld=/home/compiler/arpitj/binutils/binutil_build/install/bin/ --with-ranlib=/home/compiler/arpitj/binutils/binutil_build/install/bin/ I am giving absolute path of cross-assembler,linker,archiver,ranlib. Can anyone please tell me whether it is correct? bcoz I m getting error like: installation problem, cannot exec `/home/compiler/arpitj/binutils/binutil_build/install/bin/': Permission denied Thanks Arpit __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/ From me@rupey.net Thu Mar 1 13:33:00 2007 From: me@rupey.net (Rupert Wood) Date: Thu, 01 Mar 2007 13:33:00 -0000 Subject: building gcc cross compiler In-Reply-To: <647496.70499.qm@web8402.mail.in.yahoo.com> References: <647496.70499.qm@web8402.mail.in.yahoo.com> Message-ID: <017e01c75c06$26768850$736398f0$@net> arpit jain wrote: > --with-as=/home/compiler/arpitj/binutils/binutil_build/install/bin/ : > I am giving absolute path of cross-assembler,linker,archiver,ranlib. > Can anyone please tell me whether it is correct? > bcoz I m getting error like: > > installation problem, cannot exec > `/home/compiler/arpitj/binutils/binutil_build/install/bin/': > Permission denied It wants the complete path of the executable, not the path containing the executable, i.e. --with-as=/home/compiler/arpitj/binutils/binutil_build/install/bin/as --with-ld=/home/compiler/arpitj/binutils/binutil_build/install/bin/ld etc. Rup. ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ From christian.convey@gmail.com Thu Mar 1 17:02:00 2007 From: christian.convey@gmail.com (Christian Convey) Date: Thu, 01 Mar 2007 17:02:00 -0000 Subject: Is there a free substitute for Flexilint? In-Reply-To: References: <6addebae0702281454l54509cf1k70834f4eeef215c@mail.gmail.com> Message-ID: <6addebae0703010901y7bc30e0dla90c85ea6c010371@mail.gmail.com> Thanks. So your basic point is use "-Wall", and filter as needed? If so, do you have any sense of how big the gap is between that approach and what FlexiLint does for me? (I realize this is a hard thing to quantify.) - Christian On 2/28/07, John (Eljay) Love-Jensen wrote: > Hi Christian, > > > Is there any free, or close-to-free, tool that you can recommend? > > I recommend GCC. > > q.v. http://gcc.gnu.org/ml/gcc-help/2007-01/msg00172.html (the part where I talk about lint and GCC). > > HTH, > --Eljay > From fdc@cp.dias.ie Thu Mar 1 17:08:00 2007 From: fdc@cp.dias.ie (Fabio De Colle) Date: Thu, 01 Mar 2007 17:08:00 -0000 Subject: g77 question. Message-ID: <45E70899.8060509@cp.dias.ie> Hi!, I compile this small code with g77 (gcc-3.4) --> no error. But when I run the code I have a "Segmentation fault". Please someone can tell me where is the error? Please note: commenting the call to the subroutine s2 --> no segmentation fault! Cheers Fabio program test parameter(n=3000000) call s1(n) stop end subroutine s1(n) integer m1(n) call s2 return end subroutine s2 return end From terry@chem.gu.se Thu Mar 1 17:13:00 2007 From: terry@chem.gu.se (Terry Frankcombe) Date: Thu, 01 Mar 2007 17:13:00 -0000 Subject: Compiling gcc-4.2 on 64 bit Ubuntu In-Reply-To: <1172602042.5222.21.camel@fkpc167> References: <1172602042.5222.21.camel@fkpc167> Message-ID: <1172769184.5165.2.camel@fkpc167> [Posted for completeness] After no useful help here or through the Ubuntu forums, I worked it out. Solution was simple: set CFLAGS to -m64 before configure. Strange, as the previously installed gcc produced 64 bit execs by default. On Tue, 2007-02-27 at 19:47 +0100, Terry Frankcombe wrote: > Hi folks > > I've run into trouble trying to compile gcc 4.2 (gcc-4.2-20070221) on an > amd64 machine running 64 bit Ubuntu. I configure with: > > ./configure --disable-multilibs --enable-languages=fortran > > then doing a make gets as far as compiling ../.././gcc/crtstuff.c in > gcc-4.2-20070221/host-x86_64-unknown-linux-gnu/gcc. /usr/include/gnu/stubs.h is included which then tries to include gnu/stubs-32.h, which doesn't exist, rather than gnu/stubs-64.h, which does. Thus apparently __WORDSIZE is defined as 32. > > Now Ubuntu has 64 bit libraries in /usr/lib and 32 bit libraries > in /usr/lib32 (with a simlink from /usr/lib64 to /usr/lib). > > Any ideas about how I can coerce configure to set things up correctly to > build a 64 bit compiler? > > Ciao > Terry > From me22.ca@gmail.com Thu Mar 1 17:14:00 2007 From: me22.ca@gmail.com (me22) Date: Thu, 01 Mar 2007 17:14:00 -0000 Subject: Is there a free substitute for Flexilint? In-Reply-To: <6addebae0703010901y7bc30e0dla90c85ea6c010371@mail.gmail.com> References: <6addebae0702281454l54509cf1k70834f4eeef215c@mail.gmail.com> <6addebae0703010901y7bc30e0dla90c85ea6c010371@mail.gmail.com> Message-ID: On 3/1/07, Christian Convey wrote: > Thanks. So your basic point is use "-Wall", and filter as needed? > -Wall doesn't get you everything. You'll likely want -Wextra and some specialty ones too. > If so, do you have any sense of how big the gap is between that > approach and what FlexiLint does for me? (I realize this is a hard > thing to quantify.) > I've usually been fairly impressed with GCC's warnings, but afaik it doesn't do much looking for stylistic things. Of course, the existance of -Weffc++ suggests that it might be there if you find the right argument, so you might be pleasantly surprised. YYMV, Scott McMurray From nu2007@gmail.com Thu Mar 1 18:05:00 2007 From: nu2007@gmail.com (n u) Date: Thu, 01 Mar 2007 18:05:00 -0000 Subject: Compilation Error on AIX 5.3 with g++ 3.3.2 In-Reply-To: References: Message-ID: Hi, i have a simple makefile which looks like this: CArchive: CFileRw.o CArchive.o CMain.o g++ -o CArchive CFileRw.o CArchive.o CMain.o 3rdparty_1.a CFileRw.o: CFileRw.cxx HCommon.h g++ -c CFileRw.cxx CArchive.o: CArchive.cxx HCommon.h g++ -c CArchive.cxx CMain.o: CMain.cxx HCommon.h g++ -c CMain.cxx clean: rm CArchive CFileRw.o CArchive.o CMain.o When i try complining this on AIX 5.3 with g++ 3.3.2. It gives the below mentioned error g++ -o CArchive CFileRw.o CArchive.o CMain.o 3rdparty_1.a ld: 0711-447 SEVERE ERROR: Shared object 3rdparty_1.a The .loader section has been truncated. The object is being ignored. collect2: ld returned 12 exit status make: 1254-004 The error code from the last command is 1. If somone can point out as to whats going wrong here, that would be nice. thanks, From eljay@adobe.com Thu Mar 1 18:10:00 2007 From: eljay@adobe.com (John (Eljay) Love-Jensen) Date: Thu, 01 Mar 2007 18:10:00 -0000 Subject: Is there a free substitute for Flexilint? References: <6addebae0703010901y7bc30e0dla90c85ea6c010371@mail.gmail.com> Message-ID: Hi Christian, > So your basic point is use "-Wall", and filter as needed? Yep. Hopefully the filter part won't be necessary. The warning flags I use: http://gcc.gnu.org/ml/gcc-help/2007-01/msg00187.html http://gcc.gnu.org/ml/gcc-help/2006-09/msg00118.html > If so, do you have any sense of how big the gap is between that approach and what FlexiLint does for me? (I realize this is a hard thing to quantify.) Sorry, I'm not sure how big the gap is. I haven't used Gimpel's software for a long while now (almost two decades ago). Sincerely, --Eljay From iant@google.com Thu Mar 1 18:10:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Thu, 01 Mar 2007 18:10:00 -0000 Subject: Variadic macros and commas In-Reply-To: <45E69A48.3070903@sidvind.com> References: <45E69A48.3070903@sidvind.com> Message-ID: David Sveningsson writes: > It keeps adding pointers until NULL is reached, thus the argument list > must be ended with NULL. If 'first' is NULL an empty array is returned. > However too often NULL is forgotten causing nasty bugs. You may find the sentinel function attribute to be useful here. It is a gcc extension which adds a warnings if the function is called without a trailing NULL. Ian From r.atwood@imperial.ac.uk Thu Mar 1 19:07:00 2007 From: r.atwood@imperial.ac.uk (Atwood, Robert C) Date: Thu, 01 Mar 2007 19:07:00 -0000 Subject: Comparison failure Comiling 4.2 svn on RedHat EL-3 In-Reply-To: Message-ID: <2CB39EAF0E0EFF498ADEDA636B8C999F04C3909A@icex1.ic.ac.uk> Suppose for some reason I wish not to install Red Hat 4 or some other system, so the first obvious solution is not available. I tried building 4.2 from svn on a Red Hat EL3 (Dell PowerEdge 2600 Intel P4 2.8) and obtained a comparison error between stage2 and stage3. Any help, or pointers to other info I missed finding? Thanks. Robert Here's some info about the version and system: [root@xe01 gcc]# svnversion . 122433M I made the following change inspired by googleing the previous mailing list entries, otherwise it would not get anywhere at all: [root@xe01 gcc]# svnversion . 122433M [root@xe01 gcc]# svn status M gcc/config/host-linux.c [root@xe01 gcc]# svn diff gcc/config/host-linux.c Index: gcc/config/host-linux.c =================================================================== --- gcc/config/host-linux.c (revision 122433) +++ gcc/config/host-linux.c (working copy) @@ -23,10 +23,12 @@ #include "coretypes.h" #include #include +#define SSIZE_MAX LONG_MAX /* HERE I changed the file */ #include "hosthooks.h" #include "hosthooks-def.h" For simplicity...'c' only... configured with: ../gcc/configure --prefix=/usr/local/encap/gcc-4.2.0.0 --program-suffix=v42 --enable-languages=c Gcc version: gcc --version gcc (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-56) Error received: Comparing stages 2 and 3 warning: ./cc1-checksum.o differs Bootstrap comparison failure! ./cfg.o differs ./cfgloopanal.o differs ./loop-iv.o differs ./value-prof.o differs ./predict.o differs ./profile.o differs ./ipa-inline.o differs make[2]: *** [compare] Error 1 make[2]: Leaving directory `/home/sources/gcc_source/gcc_42_svn/build' make[1]: *** [stage3-bubble] Error 2 make[1]: Leaving directory `/home/sources/gcc_source/gcc_42_svn/build' make: *** [all] Error 2 Processor /proc/cpuinfo: processor : 0 vendor_id : GenuineIntel cpu family : 15 model : 2 model name : Intel(R) Xeon(TM) CPU 2.80GHz stepping : 7 cpu MHz : 2791.281 cache size : 512 KB fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 2 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe cid bogomips : 5588.14 From ext@sidvind.com Thu Mar 1 19:36:00 2007 From: ext@sidvind.com (ext@sidvind.com) Date: Thu, 01 Mar 2007 19:36:00 -0000 Subject: Variadic macros and commas In-Reply-To: References: <45E69A48.3070903@sidvind.com> Message-ID: <2191.83.209.20.148.1172777799.squirrel@mail.sidvind.com> > David Sveningsson writes: > >> It keeps adding pointers until NULL is reached, thus the argument list >> must be ended with NULL. If 'first' is NULL an empty array is returned. >> However too often NULL is forgotten causing nasty bugs. > > You may find the sentinel function attribute to be useful here. It is > a gcc extension which adds a warnings if the function is called > without a trailing NULL. > > Ian > Yes, I tried the sentinel attribute but since it's valid to call the function without any arguments at all (the first argument default to NULL) the sentinel warns that not enough arguments has been passed. From r.atwood@imperial.ac.uk Thu Mar 1 20:00:00 2007 From: r.atwood@imperial.ac.uk (Atwood, Robert C) Date: Thu, 01 Mar 2007 20:00:00 -0000 Subject: Is there a free substitute for Flexilint? In-Reply-To: Message-ID: <2CB39EAF0E0EFF498ADEDA636B8C999F04C3909D@icex1.ic.ac.uk> At risk of being off topic... what about splint www.splint.org? I've not delved into all its features ... it's GPL distributable. I'm not sure how well it handles c++ versus c code though. From christian.convey@gmail.com Thu Mar 1 21:05:00 2007 From: christian.convey@gmail.com (Christian Convey) Date: Thu, 01 Mar 2007 21:05:00 -0000 Subject: Is there a free substitute for Flexilint? In-Reply-To: References: <6addebae0702281454l54509cf1k70834f4eeef215c@mail.gmail.com> Message-ID: <6addebae0703011304r5740a7e3g27e692220f0028f4@mail.gmail.com> Thanks. So your basic point is use "-Wall", and filter as needed? If so, do you have any sense of how big the gap is between that approach and what FlexiLint does for me? (I realize this is a hard thing to quantify.) - Christian On 2/28/07, John (Eljay) Love-Jensen wrote: > Hi Christian, > > > Is there any free, or close-to-free, tool that you can recommend? > > I recommend GCC. > > q.v. http://gcc.gnu.org/ml/gcc-help/2007-01/msg00172.html (the part where I talk about lint and GCC). > > HTH, > --Eljay > From bccheng@peakstreaminc.com Thu Mar 1 21:08:00 2007 From: bccheng@peakstreaminc.com (Ben Cheng) Date: Thu, 01 Mar 2007 21:08:00 -0000 Subject: better load/store scheduling Message-ID: <96CDC40E4321F84FA0FB83A1EF2A422864BA1C@Hermes.shaktisystems.com> Well, I guess the real question is how to make gcc schedule better code if loop unrolling is enabled? My original code is actually for (i = 0; i < 4096; i++) { g[i] = h[i] + 10; } After gcc unrolls the loop, the loop bodies from different iterations aren't overlapping with each other because the load from later iterations is not scheduled across earlier stores. I thought this might be due to phase ordering issues of optimization stages so I manually unroll the loop. But unfortunately I still cannot get gcc to schedule loads/stores more aggressively. Since I want gcc to unroll the loop for me, I cannot create temporaries for h[i]. Therefore I am still hoping for some magic command line options to make gcc produce better scheduling. Thanks, -Ben -----Original Message----- From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On Behalf Of Sergei Organov Sent: Thursday, March 01, 2007 3:22 AM To: gcc-help@gcc.gnu.org Subject: Re: better load/store scheduling "Ben Cheng" writes: > I am trying to tune the performance of hand-unrolled code. I was > wondering what cmd-line options should I specify in order to get h[i+1] > loaded before the store to g[i]: > > > Code: > > void foo(int * __restrict g, int * __restrict h) > { > int i; > for (i = 0; i < 4096; i+=2) { > g[i] = h[i] + 10; > g[i+1] = h[i+1] + 10; > } > } Use temporaries: void foo(int * __restrict g, int * __restrict h) { int i; for (i = 0; i < 4096; i+=2) { int a = h[i]; int b = h[i+1]; g[i] = a + 10; g[i+1] = b + 10; } } > > Command line: > > gcc-4.0.2 -O3 loop.c -fargument-noalias-global -fstrict-aliasing -S > loop.s > > Assembly code of the loop body: > > .L2: > leal 0(,%ebx,4), %eax > leal (%eax,%esi), %ecx > leal (%edi,%eax), %eax > movl -8(%ecx), %edx // = h[i] > addl $10, %edx // + 10 > movl %edx, -8(%eax) // g[i] = > movl -4(%ecx), %edx // = h[i+1] > addl $10, %edx // + 10 > movl %edx, -4(%eax) // g[i+1] = > addl $2, %ebx > cmpl $4098, %ebx > jne .L2 With gcc 4.0.4, it gives: .L2: leal 0(,%ebx,4), %edx addl $2, %ebx leal (%esi,%edx), %eax addl %edi, %edx movl -4(%eax), %ecx movl -8(%eax), %eax addl $10, %ecx addl $10, %eax cmpl $4098, %ebx movl %eax, -8(%edx) movl %ecx, -4(%edx) jne .L2 With gcc 4.1.2, it gives: .L2: movl -4(%ebx,%ecx,4), %eax movl -8(%ebx,%ecx,4), %edx addl $10, %eax addl $10, %edx movl %edx, -8(%esi,%ecx,4) movl %eax, -4(%esi,%ecx,4) addl $2, %ecx cmpl $4098, %ecx jne .L2 -- Sergei. From vmakarov@redhat.com Thu Mar 1 22:12:00 2007 From: vmakarov@redhat.com (Vladimir Makarov) Date: Thu, 01 Mar 2007 22:12:00 -0000 Subject: better load/store scheduling In-Reply-To: <96CDC40E4321F84FA0FB83A1EF2A422864BA1C@Hermes.shaktisystems.com> References: <96CDC40E4321F84FA0FB83A1EF2A422864BA1C@Hermes.shaktisystems.com> Message-ID: <45E74FCE.6010605@redhat.com> Ben Cheng wrote: >Well, I guess the real question is how to make gcc schedule better code >if loop unrolling is enabled? > >My original code is actually > > for (i = 0; i < 4096; i++) { > g[i] = h[i] + 10; > } > >After gcc unrolls the loop, the loop bodies from different iterations >aren't overlapping with each other because the load from later >iterations is not scheduled across earlier stores. I thought this might >be due to phase ordering issues of optimization stages so I manually >unroll the loop. But unfortunately I still cannot get gcc to schedule >loads/stores more aggressively. > >Since I want gcc to unroll the loop for me, I cannot create temporaries >for h[i]. Therefore I am still hoping for some magic command line >options to make gcc produce better scheduling. > > > There is no such magic option. The problem is not in the scheduler itself. It can be done when/if we have more accurate aliasing info on rtl level. Another problem is that even if we have more accurate alias analysis, it might be still impossible to move ld/st after RA worked. Insn scheduling before RA is switched off for x86, x86_64 because of a bug which finally occurs in reload when the reload can not find a hard register for an insn operand. To get rid off this bug, insn scheduler should be register pressure sensitive. Also It is better to use software pipelining for this loop. You can try -fmodulo-sched and see what happens. It might work. From finchlady888@hotmail.com Fri Mar 2 02:29:00 2007 From: finchlady888@hotmail.com (funchlady) Date: Fri, 02 Mar 2007 02:29:00 -0000 Subject: x86_64-pc-mingw32 Message-ID: <9262940.post@talk.nabble.com> I built a cross compiler, i.e., x86_64-pc-mingw32-gcc (release 4.1.2, I modified ASM when necessary) on a x86_64-linux, and then I applied x86_64-pc-mingw32-gcc to generate binaries of w32api (3.8) and mingw-runtime (3.11, I modified ASM when necessary). Reference is inconsistent. For example, the WINAPI EnterCriticalSection is labeled as EnterCriticalSection@4 in library of w32api, but is labeled as EnterCriticalSection@8 in runtime library. It seems w32api is in 32-bit, and runtime is in 64-bit. Linker x86_64-pc-mingw32-ld fails to find the references. Is there any way to resolve it? Thank you. So far, the corss compiler I built can generate object code and built library, but cannot build windows executable. Thank you again. -- View this message in context: http://www.nabble.com/x86_64-pc-mingw32-tf3331275.html#a9262940 Sent from the gcc - Help mailing list archive at Nabble.com. From dreams_arpit@yahoo.co.in Fri Mar 2 06:39:00 2007 From: dreams_arpit@yahoo.co.in (arpit jain) Date: Fri, 02 Mar 2007 06:39:00 -0000 Subject: cross compiler building Message-ID: <657948.3687.qm@web8405.mail.in.yahoo.com> Hiiiiiii, I tried building gcc-3.x cross compiler but i am getting some error.My procedure was: 1.Build and install binutils-2.10 for the same target in the same directory where I will install gcc. The above step was done successfully as I have got binaries for the cross assembler,linker,archiver etc. in the same directory. 2.When I build (configure) gcc using the same target and by giving absolute path of these cross assembler,linker etc,I got some error like: i***-unknown-coff-ar: Command not found. Can anyone please tell me wheteher my procedure is correct nd if so,then where is the problem?? Thanks Arpit __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/ From me@rupey.net Fri Mar 2 10:12:00 2007 From: me@rupey.net (Rupert Wood) Date: Fri, 02 Mar 2007 10:12:00 -0000 Subject: x86_64-pc-mingw32 In-Reply-To: <9262940.post@talk.nabble.com> References: <9262940.post@talk.nabble.com> Message-ID: <03ff01c75cb3$469a57d0$d3cf0770$@net> funchlady wrote: > I built a cross compiler, i.e., x86_64-pc-mingw32-gcc (release > 4.1.2, I modified ASM when necessary) on a x86_64-linux, and then I > applied x86_64-pc-mingw32-gcc to generate binaries of w32api (3.8) > and mingw-runtime (3.11, I modified ASM when necessary). If you're trying to port mingw to x86_64 you should probably talk to this guy http://gcc.gnu.org/ml/gcc/2007-02/msg00545.html if you haven't already. At first glance the problem is that export symbols in the .def files are wrong when you're compiling 64-bit - they're hard-coded with the argument length (as per stdcall) for 32-bit pointers. There's a further problem in that the w32api headers are missing some uses of DWORD_PTR so they won't compile correctly for 64-bit anyway or at least some of the structures will be wrong. I guess you'll need to fix all of this: you'll have to audit the headers against Microsoft's own platform SDK http://www.microsoft.com/msdownload/platformsdk/sdkupdate/ (old link but redirects to the newer, much longer one) for LONG_PTR, ULONG_PTR and DWORD_PTR - and possibly some more similar types, I can't remember - rebuild w32api and then check the symbols in the .a files against the .def files to see which ones you'll need to edit for 64-bit. Or you could try Microsoft's own 64-bit import libraries from the platform SDK download: it is a free download but might be awkward to extract if you don't have a Windows machine handy: I can't swear that Microsoft's .libs are compatible with mingw's linker, but I can't think of a good reason why not. Good luck! Rup. ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ From Walter.Kasberg@web.de Fri Mar 2 10:16:00 2007 From: Walter.Kasberg@web.de (Walter Kasberg) Date: Fri, 02 Mar 2007 10:16:00 -0000 Subject: g77 question. In-Reply-To: <45E70899.8060509@cp.dias.ie> References: <45E70899.8060509@cp.dias.ie> Message-ID: <200703021116.35880.Walter.Kasberg@web.de> On Thursday 01 March 2007 18:08, Fabio De Colle wrote: > Hi!, > > I compile this small code with g77 (gcc-3.4) --> no error. But when I > run the code I have a > "Segmentation fault". > Please someone can tell me where is the error? > Please note: commenting the call to the subroutine s2 --> no > segmentation fault! > Cheers > > Fabio > > > > program test > parameter(n=3000000) > call s1(n) > stop > end > > subroutine s1(n) > integer m1(n) > call s2 > return > end > > subroutine s2 > return > end I am not sure but suppose that could be due to possible segment limit in f77. If you ommit s2 perhaps it just fits into this limit. Perhaps you can try to put n into a common block. Maybe that could work, I tried your code with g95 (Mandrake g95-0.50-1.403_20060327.1mdv2007.0) and gcc-gfortran (Mandrake gcc-gfortran-4.1.1-3mdk). Both work. Walter From michael@unixiron.org Fri Mar 2 12:06:00 2007 From: michael@unixiron.org (Michael Kukat) Date: Fri, 02 Mar 2007 12:06:00 -0000 Subject: 8/16bit oddities on avr-gcc In-Reply-To: References: Message-ID: Hello, i'm programming a lot of AVR firmware since a while, first in pure assembler, as gcc 3.x didn't produce code i liked very much. But the 4.1.1 i'm currently using produces quite good code if you sometimes try around to get the best results (as in "i would write nearly the same in assembler"). But now, i found one strange thing where i currently can't find a workaround i really like. It's about a quite simple loop here: This is my perftest.c file: #include #include < inttypes.h> volatile uint8_t xx; void test() { uint8_t ctr; ctr = 0; do { xx = ctr; } while(++ctr < 64); } quite simple. If i compile this like the following: avr-gcc -mmcu=atmega644 -O3 -S -o - perftest.c i see that ctr is used in 16bit: ldi r24,lo8(0) ldi r25,hi8(0) .L2: sts xx,r24 adiw r24,1 cpi r24,64 cpc r25,__zero_reg__ brne .L2 /* epilogue: frame size=0 */ ret Now i tried around a bit and see the following situation: if i replace the "xx = ctr" by an __asm__("nop"), the counter is 8 bit, as it should be. If i use ctr = 64 before the loop and do while(--ctr);, the counter also is 8 bit (with xx = ctr in the loop). All experiments trying < (uint8_t) 64 and so didn't work, also != instead of < doesn't work, i can't find a "nice" way to force the counter being 8 bit when using the value within the loop. I need that loop in this way, that's why i don't use --ctr. But i found one operation, which does the same like (++ctr < 64) in my case, but doesn't create the counter in 16bit but in 8bit, as desired: (++ctr % 64). With this, the result is exactly what i want: ldi r24,lo8(0) .L2: sts xx,r24 subi r24,lo8(-(1)) cpi r24,lo8(64) brne .L2 /* epilogue: frame size=0 */ ret Is there any reason for this strange 16bit behaviour? To me, it looks like the assignemt xx = ctr seems to trigger some signed flags for the comparison, because ((++ctr & 0x7f) < 64) also produces the desired 8bit version. Might be okay in this loop, but isn't so fine if i need, say, 200 as the counter top value. What do you think about this? ...Michael From osv@javad.com Fri Mar 2 12:14:00 2007 From: osv@javad.com (Sergei Organov) Date: Fri, 02 Mar 2007 12:14:00 -0000 Subject: 8/16bit oddities on avr-gcc References: Message-ID: "Michael Kukat" writes: > Hello, > > i'm programming a lot of AVR firmware since a while, first in pure > assembler, as gcc 3.x didn't produce code i liked very much. But the > 4.1.1 i'm currently using produces quite good code if you sometimes > try around to get the best results (as in "i would write nearly the > same in assembler"). > > But now, i found one strange thing where i currently can't find a > workaround i really like. It's about a quite simple loop here: > > This is my perftest.c file: > #include > #include < inttypes.h> > > volatile uint8_t xx; > > void test() { > uint8_t ctr; > > ctr = 0; > do { > xx = ctr; > } while(++ctr < 64); Try "while((uint8_t)(++ctr) < 64)" -- Sergei. From michael@unixiron.org Fri Mar 2 12:28:00 2007 From: michael@unixiron.org (Michael Kukat) Date: Fri, 02 Mar 2007 12:28:00 -0000 Subject: Comparison In-Reply-To: References: Message-ID: Hi, 2007/3/2, John (Eljay) Love-Jensen : > Isn't the result of a comparison, such as (x < y), an int -- regardless of the types of x and y? Hm, may be. But i wonder why the variable ctr is then initialized as 16bit if just the comparison would be int. And i also assume, that while((uint8_t)(++ctr < 64)) should avoid 16bit in this case, which it doesn't. -mint8 creates lots of other problems, so i can't try this out (besides this i don't really want to use this option :) ...Michael From aph@redhat.com Fri Mar 2 12:56:00 2007 From: aph@redhat.com (Andrew Haley) Date: Fri, 02 Mar 2007 12:56:00 -0000 Subject: 8/16bit oddities on avr-gcc In-Reply-To: References: Message-ID: <17896.7917.832091.677150@zebedee.pink> Michael Kukat writes: > > i'm programming a lot of AVR firmware since a while, first in pure > assembler, as gcc 3.x didn't produce code i liked very much. But the > 4.1.1 i'm currently using produces quite good code if you sometimes > try around to get the best results (as in "i would write nearly the > same in assembler"). > > But now, i found one strange thing where i currently can't find a > workaround i really like. It's about a quite simple loop here: > > This is my perftest.c file: > #include > #include < inttypes.h> > > volatile uint8_t xx; > > void test() { > uint8_t ctr; > > ctr = 0; > do { > xx = ctr; > } while(++ctr < 64); > } > > quite simple. If i compile this like the following: > > avr-gcc -mmcu=atmega644 -O3 -S -o - perftest.c > > i see that ctr is used in 16bit: > > ldi r24,lo8(0) > ldi r25,hi8(0) > .L2: > sts xx,r24 > adiw r24,1 > cpi r24,64 > cpc r25,__zero_reg__ > brne .L2 > /* epilogue: frame size=0 */ > ret > > Now i tried around a bit and see the following situation: > > if i replace the "xx = ctr" by an __asm__("nop"), the counter is 8 > bit, as it should be. If i use ctr = 64 before the loop and do > while(--ctr);, the counter also is 8 bit (with xx = ctr in the loop). > All experiments trying < (uint8_t) 64 and so didn't work, also != > instead of < doesn't work, i can't find a "nice" way to force the > counter being 8 bit when using the value within the loop. I need that > loop in this way, that's why i don't use --ctr. > > But i found one operation, which does the same like (++ctr < 64) in my > case, but doesn't create the counter in 16bit but in 8bit, as desired: > (++ctr % 64). With this, the result is exactly what i want: > > ldi r24,lo8(0) > .L2: > sts xx,r24 > subi r24,lo8(-(1)) > cpi r24,lo8(64) > brne .L2 > /* epilogue: frame size=0 */ > ret > > Is there any reason for this strange 16bit behaviour? To me, it looks > like the assignemt xx = ctr seems to trigger some signed flags for the > comparison, because ((++ctr & 0x7f) < 64) also produces the desired > 8bit version. Might be okay in this loop, but isn't so fine if i need, > say, 200 as the counter top value. > > What do you think about this? This is strange, and might be a missed optimization bug. I can't see any explanation for the behaviour you see here. What does the output of -fdump-tree-optimized look like? Andrew. From michael@kukat.de Fri Mar 2 13:00:00 2007 From: michael@kukat.de (Michael Kukat) Date: Fri, 02 Mar 2007 13:00:00 -0000 Subject: 8/16bit oddities on avr-gcc In-Reply-To: <87zm6v956m.fsf@javad.com> References: <87zm6v956m.fsf@javad.com> Message-ID: Hi, 2007/3/2, osv@javad.com : > Sounds like some bug/misfeature then. I'd also try to move ++ out of the > comparison: also tried this already, with ctr++ in a separate line at the end of the loop - also compiles with 16bit ctr. ...Michael From michael@unixiron.org Fri Mar 2 13:03:00 2007 From: michael@unixiron.org (Michael Kukat) Date: Fri, 02 Mar 2007 13:03:00 -0000 Subject: 8/16bit oddities on avr-gcc In-Reply-To: <17896.7917.832091.677150@zebedee.pink> References: <17896.7917.832091.677150@zebedee.pink> Message-ID: Hi, 2007/3/2, Andrew Haley : > This is strange, and might be a missed optimization bug. I can't see > any explanation for the behaviour you see here. > > What does the output of -fdump-tree-optimized look like? I can't read out something useful from this... $ avr-gcc -mmcu=atmega16 -Wall -Werror -O3 -fdump-tree-optimized -S -o - perftest.c .file "perftest.c" .arch atmega16 __SREG__ = 0x3f __SP_H__ = 0x3e __SP_L__ = 0x3d __tmp_reg__ = 0 __zero_reg__ = 1 .global __do_copy_data .global __do_clear_bss .text .global test .type test, @function test: /* prologue: frame size=0 */ /* prologue end (size=0) */ ldi r24,lo8(0) ldi r25,hi8(0) .L2: sts xx,r24 adiw r24,1 cpi r24,64 cpc r25,__zero_reg__ brne .L2 /* epilogue: frame size=0 */ ret /* epilogue end (size=1) */ /* function test size 9 (8) */ .size test, .-test .comm xx,1,1 /* File "perftest.c": code 9 = 0x0009 ( 8), prologues 0, epilogues 1 */ But optimization was also my idea, because with -O0, it makes ctr 8bit: std Y+1,__zero_reg__ .L2: ldd r24,Y+1 sts xx,r24 ldd r24,Y+1 subi r24,lo8(-(1)) std Y+1,r24 ldd r24,Y+1 cpi r24,lo8(64) brlo .L2 okay, this code is due to heavy SRAM use not really good, but i tested all optimization levels, -Os, -O1 up to -O3, the "16bit problem" appears in all levels, just O0 seems to work in 8bit. I didn't find an option to disable from -O1 to get back to 8bit to track it down further yet. ...Michael From michael@kukat.de Fri Mar 2 13:12:00 2007 From: michael@kukat.de (Michael Kukat) Date: Fri, 02 Mar 2007 13:12:00 -0000 Subject: 8/16bit oddities on avr-gcc In-Reply-To: <87vehj94zg.fsf@javad.com> References: <87vehj94zg.fsf@javad.com> Message-ID: Hi, 2007/3/2, osv@javad.com : > I'd try to ask at avr-gcc mailing list: Yep, i'll ask there later, as currently i can't prove this problem is "generic", if i compile this on i386, it uses "one register". Fine. But as registers are 16 or 32 bits there, this isn't a suitable comparison, this can only be checked on compiler variants for CPUs with 8bit registers. ...Michael From michael@unixiron.org Fri Mar 2 13:17:00 2007 From: michael@unixiron.org (Michael Kukat) Date: Fri, 02 Mar 2007 13:17:00 -0000 Subject: 8/16bit oddities on avr-gcc In-Reply-To: <003101c75ccc$464884f0$d2d98ed0$@net> References: <17896.7917.832091.677150@zebedee.pink> <003101c75ccc$464884f0$d2d98ed0$@net> Message-ID: Hi, 2007/3/2, Rupert Wood : > I think he wants the perftest.c.099t.optimized file that'd be generated on disk. ah, okay, didn't use that option for now, so i didn't know that the necessary info is written to files :) Here it comes: ;; Function test (test) Analyzing Edge Insertions. test () { unsigned int ivtmp.28; uint8_t ivtmp.27; uint8_t pretmp.25; uint8_t ctr; : ivtmp.28 = 0; :; ctr = (uint8_t) ivtmp.28; xx = ctr; ivtmp.28 = ivtmp.28 + 1; if (ivtmp.28 != 64) goto ; else goto ; :; return; } Hm. It creates "unsigned int" for this comparison. Now trying without the assignment within the loop: ;; Function test (test) Analyzing Edge Insertions. test () { uint8_t ivtmp.27; uint8_t pretmp.25; uint8_t ctr; : ctr = 0; :; __asm__ __volatile__("nop"::); ctr = ctr + 1; if (ctr != 64) goto ; else goto ; :; return; } Here, ctr is taken for the comparison, not one of those ivtmp variables. ...Michael From michael@kukat.de Fri Mar 2 13:27:00 2007 From: michael@kukat.de (Michael Kukat) Date: Fri, 02 Mar 2007 13:27:00 -0000 Subject: 8/16bit oddities on avr-gcc In-Reply-To: References: <17896.7917.832091.677150@zebedee.pink> <003101c75ccc$464884f0$d2d98ed0$@net> Message-ID: Even more funny with the variant using ctr % 64: test () { unsigned int ivtmp.28; int pretmp.27; int pretmp.26; uint8_t pretmp.25; uint8_t ctr; int D.1293; int D.1292; : ctr = 0; :; __asm__ __volatile__("nop"::); xx = ctr; ctr = ctr + 1; if (ctr != 64) goto ; else goto ; :; return; } Lots of variables ivtmp.*, but the counter handling and modulo is done on the ctr, compared to the less-than, where counter handling and comparison is done on one of the ivtmp.* variables. ...Michael From aph@redhat.com Fri Mar 2 13:51:00 2007 From: aph@redhat.com (Andrew Haley) Date: Fri, 02 Mar 2007 13:51:00 -0000 Subject: 8/16bit oddities on avr-gcc In-Reply-To: References: <17896.7917.832091.677150@zebedee.pink> <003101c75ccc$464884f0$d2d98ed0$@net> Message-ID: <17896.11207.1808.259901@zebedee.pink> Michael Kukat writes: > Hi, > > 2007/3/2, Rupert Wood : > > I think he wants the perftest.c.099t.optimized file that'd be generated on disk. > > ah, okay, didn't use that option for now, so i didn't know that the > necessary info is written to files :) Here it comes: > > ;; Function test (test) > > Analyzing Edge Insertions. > test () > { > unsigned int ivtmp.28; > uint8_t ivtmp.27; > uint8_t pretmp.25; > uint8_t ctr; > > : > ivtmp.28 = 0; > > :; > ctr = (uint8_t) ivtmp.28; > xx = ctr; > ivtmp.28 = ivtmp.28 + 1; > if (ivtmp.28 != 64) goto ; else goto ; > > :; > return; > > } > > Hm. It creates "unsigned int" for this comparison. It does the same with my copy of gcc 4.1.2. For -O2 gcc 4.3 does: ;; Function test (test) Analyzing Edge Insertions. test () { uint8_t ctr; : xx = 0; xx = 1; ctr = 2; :; xx = ctr; ctr = ctr + 1; if (ctr != 64) goto ; else goto ; :; return; (And, before you ask, I have no idea what the xx = 0; xx = 1; lines are for!) gcc 4.2 might do better than 4.1. Andrew. From michael@kukat.de Fri Mar 2 15:14:00 2007 From: michael@kukat.de (Michael Kukat) Date: Fri, 02 Mar 2007 15:14:00 -0000 Subject: 8/16bit oddities on avr-gcc In-Reply-To: <17896.11207.1808.259901@zebedee.pink> References: <17896.7917.832091.677150@zebedee.pink> <003101c75ccc$464884f0$d2d98ed0$@net> <17896.11207.1808.259901@zebedee.pink> Message-ID: <45E83F3B.1010005@kukat.de> Hi, Andrew Haley schrieb: > (And, before you ask, I have no idea what the xx = 0; xx = 1; lines > are for!) I think that is this voodoo thing Eljay mentioned :) Okay, it starts ctr with 2, so it's logically to optimize the first 2 loop iterations away by doing it this way. Is there a new -funroll-loops-a-bit option? :) > gcc 4.2 might do better than 4.1. Hm okay, if i remember the improvement from 3.3 to 4.1, maybe i should give it a try over the weekend. Thanks so far, at least we know now, that this is a common issue, which only appears on 8bit CPUs. ...Michael From michael@kukat.de Fri Mar 2 16:40:00 2007 From: michael@kukat.de (Michael Kukat) Date: Fri, 02 Mar 2007 16:40:00 -0000 Subject: 8/16bit oddities on avr-gcc In-Reply-To: <17896.11207.1808.259901@zebedee.pink> References: <17896.7917.832091.677150@zebedee.pink> <003101c75ccc$464884f0$d2d98ed0$@net> <17896.11207.1808.259901@zebedee.pink> Message-ID: <45E8535A.1080605@kukat.de> Hi again, Andrew Haley schrieb: > For -O2 gcc 4.3 does: > > ;; Function test (test) > > Analyzing Edge Insertions. > test () > { > uint8_t ctr; > > : > xx = 0; > xx = 1; > ctr = 2; > > :; > xx = ctr; > ctr = ctr + 1; > if (ctr != 64) goto ; else goto ; > > :; > return; okay, i just tested 4.2-20070228 and voila - i can reproduce what you have seen in 4.3, here is the assembler equivalent of this: test: /* prologue: frame size=0 */ /* prologue end (size=0) */ sts var,__zero_reg__ ldi r24,lo8(1) sts var,r24 ldi r24,lo8(2) .L2: sts var,r24 subi r24,lo8(-(1)) cpi r24,lo8(64) brne .L2 /* epilogue: frame size=0 */ ret So the uint8_t versus unsigned int problem seems to be gone in 4.2. But only for this special case, as in the function where i have seen the "problem" yesterday, i see this "unsigned int" stuff again now and it again compiles to a 16 bit counter. I'll try to find out what triggers the problem this time. ...Michael From michael@kukat.de Fri Mar 2 17:04:00 2007 From: michael@kukat.de (Michael Kukat) Date: Fri, 02 Mar 2007 17:04:00 -0000 Subject: 8/16bit oddities on avr-gcc In-Reply-To: <17896.11207.1808.259901@zebedee.pink> References: <17896.7917.832091.677150@zebedee.pink> <003101c75ccc$464884f0$d2d98ed0$@net> <17896.11207.1808.259901@zebedee.pink> Message-ID: <45E8590C.1070400@kukat.de> Okay, next fun :) This is the (nearly) whole function: void cv_mux_update() { uint8_t regnum; int16_t value, *cv, *cvold; struct update { uint8_t num; int16_t val; } *update; spibuff[0] = CMD_SETREGS; update = (struct update *)&(spibuff[1]); cv = cv_mux_comm.cvdata; cvold = cv_mux_comm.cvdata_old; regnum = 0; if(cv_mux_comm.force_update) { do { value = *cv; *cvold = value; update->num = regnum; /* update->val = value;*/ update++; cvold++; cv++; } while(++regnum < NUM_CV); } else { } slave_send(3, spibuff, (uint8_t *)update - spibuff); cv_mux_comm.force_update = 0; } cvdata and cvdata_old in cv_mux_comm are int16_t[], spibuff is uint8_t[]. If i leave the commented line commented, regnum is left in 8 bit over the loop. No "unsigned int" variables are created, just an "int spibuff.1", which currently doesn't interest me too much. If i remove the comments, 2 variables which have absolutely nothing to do with regnum lead to the "unsigned int" variable introduces again to take the role of regnum. Same thing as the simpler example which has shown this problem with 4.1.1: unsigned int ivtmp.272; ... MEM[base: update] = (uint8_t) ivtmp.272; ... ivtmp.272 = ivtmp.272 + 1; if (ivtmp.272 != 64) goto ; else goto ; Don't want to rip out the struct, as this is for performance reasons. You don't want to see the code which results from an int16_t >> 8 :) I could write it in a different way, but then it gets a bit unreadable :) Okay, investigating further, just wanted to tell this... ...Michael From matt.fago@itt.com Fri Mar 2 21:20:00 2007 From: matt.fago@itt.com (Matt Fago) Date: Fri, 02 Mar 2007 21:20:00 -0000 Subject: Coverage broken in gcc 4.1.1? Message-ID: <1172870426.31831.33.camel@entropy.aes.de.ittind.com> I'm trying to use gcov with gcc 4.1.1 as installed in Fedora Core 6 x86_64. This works fine: gcc --coverage -o hello hello.c This does not: gcc --coverage -o hello.o -c hello.c gcc --coverage -o hello hello.o Both work as expected with Apple's gcc 4.0.4 (with explicit -fprofile-arcs -ftest-coverage) and FSF gcc 4.1.2 on powerpc or gcc trunk on x86_64. I thought I'd heard of this on gcc@gcc.gnu.org, but I've looked in Bugzilla and cannot find it. If this is known I'd appreciate a reference to a bug so I can ask Fedora to patch their version of gcc. Thanks, Matt ************************************ This e-mail and any files transmitted with it are proprietary and intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the sender. Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of ITT, Inc. The recipient should check this e-mail and any attachments for the presence of viruses. ITT accepts no liability for any damage caused by any virus transmitted by this e-mail. ************************************ From kaz@zeugmasystems.com Sat Mar 3 01:31:00 2007 From: kaz@zeugmasystems.com (Kaz Kylheku) Date: Sat, 03 Mar 2007 01:31:00 -0000 Subject: [OT] RE: Is there a free substitute for Flexilint? Message-ID: <66910A579C9312469A7DF9ADB54A8B7D65740E@exchange.ZeugmaSystems.local> gcc-help-owner@gcc.gnu.org wrote: > Gimpel Software has a tool that I've gotten tons of benefit from when > my employers have had a copy: FlexiLint. It's been marvelous at > statically checking C++ code and uncovered all kinds of evil bugs. > > But it's also out-of-reach expensive: $1000 for a single user. That's ``nothing'' for a software company. Even in an organization with, say, 30 developers, you could keep the code clean with just one license for this type of software. It's not the type of software that requires a maintenance contract or upgrades. You buy it once and then ``lint away'' for years. What's the cost of not doing the linting? Bugs caught late (i.e. by the customer) can quickly eat away more than a thousand bucks from your bottom line. > Is there any free, or close-to-free, tool that you can recommend? The GNU compiler has a lot of C++ specific warnings which are not turned on by default. It's not exactly lint, but you can squeeze more out of the compiler's diagnostic ability. Flexelint requires a lot of tweaking. When you let it loose on a codebase for the first time, it can produce a huge amount of noise. Not all of it is useful. You'd be crazy to follow up on every one of its recommendations by adjusting the code (rather than turning off the check which produced it). > (I suspect Valgrind has some overlap in terms of what bugs the two > tools detect, but it's not going to catch stuff like misuse of > "const", etc.) There would only be overlap if you ignore the diagnostics from the static checker and run the program anyway, under valgrind. :) You can also get more out of valgrind by learning about its API. Misuse of const /can/ actually be diagnosed. You see, you can inform Valgrind that some arbitrary region of memory is read only. Then if anything writes to it, there will be a diagnostic. Of course, GCC doesn't have any code generation option to do this valgrind-specific hack for const objects (but you could hack that feature in!) Even the C front end can do this, because the constructor/destructor hook mechanism is available to it. (The bounds-checking patches for GCC that were developed years ago took advantage of this in order to register and unregister block-scope objects in the splay tree of live objects). From sdirkse@gams.com Sat Mar 3 07:59:00 2007 From: sdirkse@gams.com (Steven Dirkse) Date: Sat, 03 Mar 2007 07:59:00 -0000 Subject: problem running gcc 4.3.0 on i386-pc-solaris2.10 Message-ID: <45E92AE8.8040902@gams.com> Hi, I am having a problem running the GCC 4.3 I just built and installed on a Solaris Intel machine. Somehow, the absolute path is left off of crtbegin.o and crtend.o. Any ideas on what I did wrong to cause this, or failed to do? Here's the broken run's output: -bash-3.00$ /usr/local/bin/gcc -o hello hello.c -v Using built-in specs. Target: i386-pc-solaris2.10 Configured with: ../configure --build=i386-pc-solaris2.10 --with-gnu-as --with-as=/usr/sfw/bin/gas --without-gnu-ld -with-ld=/usr/ccs/bin/ld --with-gmp=/usr/local --with-mpfr=/usr/local --enable-languages=c,c++,fortran --enable-shared Thread model: posix gcc version 4.3.0 20070301 (experimental) /usr/local/libexec/gcc/i386-pc-solaris2.10/4.3.0/cc1 -quiet -v hello.c -quiet -dumpbase hello.c -mtune=generic -auxbase hello -version -o /var/tmp//ccxcSoPX.s ignoring nonexistent directory "/usr/local/lib/gcc/i386-pc-solaris2.10/4.3.0/../../../../i386-pc-solaris2.10/include" #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/local/lib/gcc/i386-pc-solaris2.10/4.3.0/include /usr/local/lib/gcc/i386-pc-solaris2.10/4.3.0/include-fixed /usr/include End of search list. GNU C version 4.3.0 20070301 (experimental) (i386-pc-solaris2.10) compiled by GNU C version 4.3.0 20070301 (experimental). GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: 15fd974b8d70fc2c218783c6076c49f0 /usr/sfw/bin/gas --traditional-format -V -Qy -s -o /var/tmp//ccAwK3EN.o /var/tmp//ccxcSoPX.s GNU assembler version 2.15 (i386-pc-solaris2.10) using BFD version 2.15 /usr/local/libexec/gcc/i386-pc-solaris2.10/4.3.0/collect2 -V -Y P,/usr/ccs/lib:/usr/lib -Qy -o hello /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/values-Xa.o crtbegin.o -L/usr/local/lib/gcc/i386-pc-solaris2.10/4.3.0 -L/usr/local/lib/gcc/i386-pc-solaris2.10/4.3.0/../../.. /var/tmp//ccAwK3EN.o -lgcc -lgcc_eh -lc -lgcc -lgcc_eh crtend.o /usr/lib/crtn.o ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.482 ld: fatal: file crtbegin.o: open failed: No such file or directory ld: fatal: library -lgcc: not found ld: fatal: library -lgcc_eh: not found ld: fatal: library -lgcc: not found ld: fatal: library -lgcc_eh: not found ld: fatal: file crtend.o: open failed: No such file or directory ld: fatal: File processing errors. No output written to hello collect2: ld returned 1 exit status -bash-3.00$ Here's a working run's output, using the gcc 3.4 that was already installed: -bash-3.00$ gcc -o hello hello.c -v Reading specs from /usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/specs Configured with: /builds/sfw10-gate/usr/src/cmd/gcc/gcc-3.4.3/configure --prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as --with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++ --enable-shared Thread model: posix gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath) /usr/sfw/libexec/gcc/i386-pc-solaris2.10/3.4.3/cc1 -quiet -v hello.c -quiet -dumpbase hello.c -auxbase hello -version -o /var/tmp//ccw0ST6d.s ignoring nonexistent directory "/usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/../../../../i386-pc-solaris2.10/include" #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/sfw/include /usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/include /usr/include End of search list. GNU C version 3.4.3 (csl-sol210-3_4-branch+sol_rpath) (i386-pc-solaris2.10) compiled by GNU C version 3.4.3 (csl-sol210-3_4-branch+sol_rpath). GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 /usr/sfw/bin/gas --traditional-format -V -Qy -s -o /var/tmp//cccd8M1l.o /var/tmp//ccw0ST6d.s GNU assembler version 2.15 (i386-pc-solaris2.10) using BFD version 2.15 /usr/sfw/libexec/gcc/i386-pc-solaris2.10/3.4.3/collect2 -V -Y P,/usr/ccs/lib:/usr/lib -Qy -o hello /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/values-Xa.o /usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/crtbegin.o -L/usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3 -L/usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/../../.. /var/tmp//cccd8M1l.o -R/usr/sfw/lib -lgcc -lgcc_eh -lc -R/usr/sfw/lib -lgcc -lgcc_eh /usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/crtend.o /usr/lib/crtn.o ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.482 From maurizio_vitale@verizon.net Sat Mar 3 15:23:00 2007 From: maurizio_vitale@verizon.net (Maurizio Vitale) Date: Sat, 03 Mar 2007 15:23:00 -0000 Subject: overload set management for assignment operator, SFINAE and GCC Message-ID: Is the following code supposed to be valid C++ or is GCC right in rejecting it: template class A; template struct hidden_unless_int { }; template<> struct hidden_inless_int {typedef A& type; }; template struct visible_unless_int { typedef A& type; }; template<> struct visible_unless_int {}; template class A { public: typename hidden_unless_int::type operator = (T value) {} typename visible_unless_int::type operator = (T value) {} }; A ai; A af; There're a couple of things going on here. Clearly overloading on the returned type alone is not enough to disambiguate (but the specific case of operator= doesn't allow for the usual trick of an additional dummy parameter with a default value) . What we would have hoped here is that the SFINAE rule would have kicked in to filter the set of possible overloads. Is GCC right in failing on the instantiations {hidden,visible}_unless_int that do not contain the typedef for type? [another data point is that comeau C++ - edg based - agrees with GCC, which strongly suggests that the code above is wrong ] If the above is illegal code, is there any way to control the overloading set for operator= ? Thanks a lot. Maurizio Vitale From pavankumar@cse.iitb.ac.in Sat Mar 3 18:29:00 2007 From: pavankumar@cse.iitb.ac.in (P. Pavan Kumar) Date: Sat, 03 Mar 2007 18:29:00 -0000 Subject: DFA-scheduler Message-ID: <43215.10.129.41.35.1172946562.squirrel@www.cse.iitb.ac.in> Respected sir, DFA pipeline hazard recognizer is used to avoid structural hazards. While intra block(basic block scheduling) scheduling how data hazards are avoided . DFA will take care of only structural hazards, but what about data hazards. First cycle mutiple pass scheduling algorithm tries different schedules and choose the best one. intra block scheduling reorders the instructions within the basic block by constructing DAG and based on LIST scheduling algorithm . If First cycle mutiple pass algorithm chooses the best schedule then why gcc needs intra block scheduling ? Now gcc will do instruction scheduling beyond basic blocks i,e inter block scheduling (region scheduling) then why gcc needs intrablock scheduling? what is command line option for enabling only intra block(with in basic block) scheduling. and diabling all remaining intruction scheduling ( trace, modulo etc). Please help me sir. Thanks in advance Pavan, Home: http://www.cse.iitb.ac.in/~pavankumar From dima.sorkin@gmail.com Sat Mar 3 19:59:00 2007 From: dima.sorkin@gmail.com (Dima Sorkin) Date: Sat, 03 Mar 2007 19:59:00 -0000 Subject: gfortran installation problems Message-ID: Hi. Please CC Yves Nievergelt on reply. The "gfortran" command gives the following error: (program: "simple.f" does nothing: PROGRAM XYZ STOP END): Command line: $ /usr/local/bin/gfortran ~/Fprograms/simple.f Error message that I get: /usr/bin/ld: can't locate file for: -lSystemStubs collect2: ld returned 1 exit status I get the same error message from two different installations: an installation from gfortran-macosx.dmg by the command > sudo tar -xvzf gfortran-bin.tar.gz -C / and an installation from gfortranCompleteInstaller.mpkg (which puts another version (copy) of gfortran in another directory: /usr/local/gfortran/bin/gfortran but gives the same error message). Any advice will be greatly appreciated: I have now tried to install and run gfortran for several years. On every try, something goes wrong. I know some UNIX, but evidently not enough. Perhaps I'm too dumb to do this kind of thing. If you think so, just let me know, and I'll give up. In any event, thank you again for your time. Sincerely, Yves. Did you try gfortran ~/Fprograms/cbrtest.f ? Dima. On 2/20/07, Yves Nievergelt wrote: > To whom it may concern: > > After apparently successfully installing gfortran-macosx.dmg > and after restarting the computer, > attempts at compiling fortran code from the command line > > > gcc ~/Fprograms/cbrtest.f > > > cause the following error message: > > > gcc: /Users/faculty/Fprograms/cbrtest.f: Fortran compiler not installed > on this system -- Yves Nievergelt, Ph.D. Professor of Mathematics Department of Mathematics Eastern Washington University 216 Kingston Hall Cheney, Washington 99004-2418 USA email ynievergelt@ewu.edu voice (509) 359-4259 FAX (509) 359-4700 -- Yves Nievergelt, Ph.D. Professor of Mathematics Department of Mathematics Eastern Washington University 216 Kingston Hall Cheney, Washington 99004-2418 USA email ynievergelt@ewu.edu voice (509) 359-4259 FAX (509) 359-4700 From peterhull90@gmail.com Sat Mar 3 22:00:00 2007 From: peterhull90@gmail.com (Peter Hull) Date: Sat, 03 Mar 2007 22:00:00 -0000 Subject: m32c-elf cross compiler Message-ID: <8833de210703031400k4072fa58u480b0485c9ce0e9c@mail.gmail.com> I'm trying to build an m32c-elf toolchain, hosted on OSX. I've downloaded binutils-2.16.94, mpfr-2.2.1, gmp-4.2.1, gcc-4.1.2 and newlib-1.15.0 and unpacked them all into separate directories. Then I created a build subdirectory for each of binutils, newlib and gcc. I configured, built and installed binutils with no problems. However the gcc build fails when it gets to building libssp. The command is: /Users/peterhull/gnuproject/build-gcc/./gcc/xgcc -B/Users/peterhull/gnuproject/build-gcc/./gcc/ -B/Users/peterhull/m32c-elf/bin/ -B/Users/peterhull/m32c-elf/lib/ -isystem /Users/peterhull/m32c-elf/include -isystem /Users/peterhull/m32c-elf/sys-include -DHAVE_CONFIG_H -I. -I../../../gcc-4.1.2/libssp -I. -Wall -O2 -g -O2 -I../mpfr-2.2.1 -MT ssp.lo -MD -MP -MF .deps/ssp.Tpo -c ../../../gcc-4.1.2/libssp/ssp.c -o ssp.o The errors are: ../../../gcc-4.1.2/libssp/ssp.c: In function '__guard_setup': ../../../gcc-4.1.2/libssp/ssp.c:70: warning: implicit declaration of function 'open' ../../../gcc-4.1.2/libssp/ssp.c:70: error: 'O_RDONLY' undeclared (first use in this function) ../../../gcc-4.1.2/libssp/ssp.c:70: error: (Each undeclared identifier is reported only once ../../../gcc-4.1.2/libssp/ssp.c:70: error: for each function it appears in.) .... and many more 'undeclared' errors. As far as I can see this is because when configure runs for libssp, it doesn't find any of the standard headers, so (for example) HAVE_FCNTL_H is not #defined in config.h. I assume that the libssp.a that's being built is for m32c-elf, rather than for the host. If so, it should be the newlib headers on the search path, rather than the ones in /usr/include. Is this right? Am I following the right procedure for building gcc or am I missing something? Peter From bogusbill@mindless.com Sun Mar 4 02:49:00 2007 From: bogusbill@mindless.com (Bogus Bill) Date: Sun, 04 Mar 2007 02:49:00 -0000 Subject: gcc does nothing Message-ID: <9292367.post@talk.nabble.com> I just installed gcc under Cygwin. I tried to compile the requisite "Hello, world!" program, but gcc didn't give any messages, nor generate any output. Here are the specifics: Code: #include using namespace std; int main (void) { cout << "Hello, world!"; return 0; } Compiler command: gcc -o hello hello.cpp gcc version: 3.4.4 Thanks for your help. Bill P.S.: I've also tried g++ and c++ instead of gcc, to no avail. -- View this message in context: http://www.nabble.com/gcc-does-nothing-tf3341149.html#a9292367 Sent from the gcc - Help mailing list archive at Nabble.com. From brian@dessent.net Sun Mar 4 02:57:00 2007 From: brian@dessent.net (Brian Dessent) Date: Sun, 04 Mar 2007 02:57:00 -0000 Subject: gcc does nothing References: <9292367.post@talk.nabble.com> Message-ID: <45EA35A4.2B834B0A@dessent.net> Bogus Bill wrote: > I just installed gcc under Cygwin. I tried to compile the requisite "Hello, > world!" program, but gcc didn't give any messages, nor generate any output. > Here are the specifics: It would be better to post this to the Cygwin mailing list, and include the cygcheck output, without which we can only guess about your configuration. The most likely cause is you are missing a required package. You can check for missing DLLs with "cygcheck /usr/bin/gcc". But setup should have included all required packages when you selected gcc. But again, without cygcheck output, all we can do is guess. > P.S.: I've also tried g++ and c++ instead of gcc, to no avail. It is required to use the g++ driver when compiling C++ code. Not that that necessarily matters here. Brian From sigra@home.se Sun Mar 4 05:26:00 2007 From: sigra@home.se (Erik) Date: Sun, 04 Mar 2007 05:26:00 -0000 Subject: [OT] RE: Is there a free substitute for Flexilint? In-Reply-To: <66910A579C9312469A7DF9ADB54A8B7D65740E@exchange.ZeugmaSystems.local> References: <66910A579C9312469A7DF9ADB54A8B7D65740E@exchange.ZeugmaSystems.local> Message-ID: <45EA58BB.7040702@home.se> Kaz Kylheku skrev: > > Is there any free, or close-to-free, tool that you can recommend? > > The GNU compiler has a lot of C++ specific warnings which are not turned > on by default. It's not exactly lint, but you can squeeze more out of > the compiler's diagnostic ability This lack of checking tools has bothered me too. Therefore I was delighted when I read at [http://freshmeat.net/projects/gcc/] that "GCC provides many levels of source code error checking traditionally provided by other tools (such as lint)". But unfortunately this is not what GCC is trying to be. If I report a feature request for a checking feature, it is usually rejected within half an hour. For example there is a useful feature in the Ada frontend, that warns about variables that are not modified after initialization and could be declared constant (with "gnatmake -gnatwa"). This feature has helped me catch a few errors, for example when I intended to modify a variable and then forgot to write the statement to do it. Now some people probably say that I should be using Ada instead of C++ anyway. In principle they are right of course, but unfortunately I still often have to code in C++ (for existing projects). So I requested to have this useful feature for C++ as well. The request got closed as WONTFIX and someone replied "Isn't this a task for lint-like tool? GCC isn't such thing." I wonder why we can not make C++ development at least a LITTLE bit easier and safer by adding such features. It wouldn't be Ada, but it would certainly help during the time while we still have to use C++. [http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25845] Another feature request was to warn about using pointers without checking for 0 (which would result in segmentation fault). That request went the same way. [http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29208] Sure, C++ was not designed to control nuclear power plants or space shuttles, but does that mean we are not allowed to avoid bugs when we can easily do so? From sunzird@gmail.com Sun Mar 4 13:55:00 2007 From: sunzird@gmail.com (Sunzir Deepur) Date: Sun, 04 Mar 2007 13:55:00 -0000 Subject: VCG viewer Message-ID: hello all, where can I find a VCG viewer to install in fedora (i want to view the vcg files outputed from gcc) ? i found only deb packages, and sources that didn't compile in my fedora... if there were rpm or yum package it could be heaven ! thanks sunzir From ranjit_kumar_b4u@yahoo.co.uk Sun Mar 4 18:17:00 2007 From: ranjit_kumar_b4u@yahoo.co.uk (ranjith kumar) Date: Sun, 04 Mar 2007 18:17:00 -0000 Subject: gcc and SIMD Message-ID: <20070304181746.27891.qmail@web27401.mail.ukl.yahoo.com> Hi, 1) Seems that all defintions for MMX, SSE and SSE2 are deinred in mmtrin.h,xmmintrin.h and emmintrin.h header files respectively. Am I right? 2) In those header files all functions call _builtin_ia32_*. Where those functions(body) are defined? 3) I thought that associated with each SIMD instruction defined in Intel-ia-32-architectures manual(Basic architecture) there is one function defined in those header files. But for some instructions no functions were defined in those header files.(For example MOVDQA instruction) Also those header files contain some more functions for which no SIMD assembly instruction exist.Example in emmintrin.h static __inline __m128i _mm_load_si128 (__m128i const *__P) { return (__m128i) __builtin_ia32_loaddqa ((char const *)__P); } What could be the reason? Thanks in advance. ___________________________________________________________ To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com From ranjit_kumar_b4u@yahoo.co.uk Sun Mar 4 19:30:00 2007 From: ranjit_kumar_b4u@yahoo.co.uk (ranjith kumar) Date: Sun, 04 Mar 2007 19:30:00 -0000 Subject: regarding autovectorization and prefetching Message-ID: <20070304193054.50975.qmail@web27401.mail.ukl.yahoo.com> --- Tim Prince wrote: > ranjith kumar wrote: > > 1) gcc manuals says -fprefetch-loop-arrays option > > inserts prefetch instructions automatically. > > Where can I get an example .c program for which > gcc > > inserts prefetching instruction. > > > > 2) Similarly to the autovectorization. > > Thanks in advance. > > > > > You might specify what target you are interested in. > As x86-64 targets > do better with hardware prefetch than software > prefetch, for the simple > cases, I don't find the latter so interesting. > There are test cases for -ftree-vectorize in the > testsuite, both in the > language parts and the tree-lang testsuite. > gfortran-4.3 does a > consistently good job on vectorization of the simple > cases. gcc > vectorizes effectively several of the gfortran > library functions, > including matmul. > 1)Where can I get test cases. I have searched in google. but it sucked. 2)The above two optimizations are done for C programs also. Am I right? 3)From which version of gcc they are enabled? ___________________________________________________________ New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at the Yahoo! Mail Championships. Plus: play games and win prizes. http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk From ranjit_kumar_b4u@yahoo.co.uk Sun Mar 4 21:18:00 2007 From: ranjit_kumar_b4u@yahoo.co.uk (ranjith kumar) Date: Sun, 04 Mar 2007 21:18:00 -0000 Subject: how save data from XMM register to int array Message-ID: <20070304211829.67469.qmail@web27415.mail.ukl.yahoo.com> Hi, I tried it with _mm_stream_si128(&a[1],m128) function. But I got compilation error. I have read about MOVDQU instruction in intel manuals. What is the equilant function defined at c level( for gcc) in (what)header files? Thanks in advance. ___________________________________________________________ What kind of emailer are you? Find out today - get a free analysis of your email personality. Take the quiz at the Yahoo! Mail Championship. http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk From iant@google.com Mon Mar 5 01:24:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Mon, 05 Mar 2007 01:24:00 -0000 Subject: gcc and SIMD In-Reply-To: <20070304181746.27891.qmail@web27401.mail.ukl.yahoo.com> References: <20070304181746.27891.qmail@web27401.mail.ukl.yahoo.com> Message-ID: ranjith kumar writes: > 1) Seems that all defintions for MMX, SSE and SSE2 > are deinred in mmtrin.h,xmmintrin.h and emmintrin.h > header files respectively. Am I right? Yes. > 2) In those header files all functions call > _builtin_ia32_*. Where those functions(body) are > defined? They are intrinsic functions automatically defined by the compiler. > 3) I thought that associated with each SIMD > instruction defined in Intel-ia-32-architectures > manual(Basic architecture) there is one function > defined in those header files. > But for some instructions no functions were defined in > those header files.(For example MOVDQA instruction) > Also those header files contain some more functions > for which no SIMD assembly instruction exist.Example > in emmintrin.h > static __inline __m128i > _mm_load_si128 (__m128i const *__P) > { > return (__m128i) __builtin_ia32_loaddqa ((char > const *)__P); > } > What could be the reason? Those header files follow the implementation described by Intel. Ian From chnabsankar@yahoo.com Mon Mar 5 04:37:00 2007 From: chnabsankar@yahoo.com (sankar chebolu) Date: Mon, 05 Mar 2007 04:37:00 -0000 Subject: GCC Versioning Policy Message-ID: <34128.60174.qm@web30704.mail.mud.yahoo.com> Hi, Any document available which explains the GCC Versioning policy/scheme? Among GCC 4.0.4 & 4.1.2 which one is more stable? Thanks in Advance. Sankar ____________________________________________________________________________________ Need a quick answer? Get one in minutes from people who know. Ask your question on www.Answers.yahoo.com From tprince@myrealbox.com Mon Mar 5 05:32:00 2007 From: tprince@myrealbox.com (Tim Prince) Date: Mon, 05 Mar 2007 05:32:00 -0000 Subject: GCC Versioning Policy In-Reply-To: <34128.60174.qm@web30704.mail.mud.yahoo.com> References: <34128.60174.qm@web30704.mail.mud.yahoo.com> Message-ID: <45EBAB69.500@myrealbox.com> sankar chebolu wrote: > Hi, > Any document available which explains the GCC > Versioning policy/scheme? > > Among GCC 4.0.4 & 4.1.2 which one is more stable? > > Thanks in Advance. > Sankar > > I guess any answer could be justified by your personal outlook. As 4.1.2 is the current release, and has support for Fortran, my personal answer is evident. From dreams_arpit@yahoo.co.in Mon Mar 5 06:48:00 2007 From: dreams_arpit@yahoo.co.in (arpit jain) Date: Mon, 05 Mar 2007 06:48:00 -0000 Subject: Cross compiler build Message-ID: <883001.68220.qm@web8408.mail.in.yahoo.com> Hiiiiii, I have build gcc-3.x cross compiler (for ADA language) for some embedded target.But it is asking for some runtime library files when running the binary. I think it needs some target specific files.I have not build newlib package as I think it is runtime library for C language only. 1.Can someone please tell me what is the error and Do I need to build newlib package also(as I am building gcc for ASA language)? 2. Where can I get the sources for runtime libraries for embedded targets? Thanks & Regards, Arpit __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/ From john.fisher@nec.com.au Mon Mar 5 07:43:00 2007 From: john.fisher@nec.com.au (John Fisher) Date: Mon, 05 Mar 2007 07:43:00 -0000 Subject: -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations Message-ID: <000f01c75ef9$ce78f650$6bd04c93@mul7.nec.com.au> Is it necessary to specify all 4 of these warnings to get the maximum amount of warnings in C code? I would expect that -Wmissing-prototypes implies -Wmissing-declarations since I understand prototype to mean exactly "new-style function declaration". However I note that http://gcc.gnu.org/ml/gcc/2006-10/msg00609.html does not state that any of these 4 options imply another. What I'm trying to achieve is no old-style function declarations or definitions, all global function definitions must have a pre-existing new-style function declaration. From me@rupey.net Mon Mar 5 09:47:00 2007 From: me@rupey.net (Rupert Wood) Date: Mon, 05 Mar 2007 09:47:00 -0000 Subject: Cross compiler build In-Reply-To: <883001.68220.qm@web8408.mail.in.yahoo.com> References: <883001.68220.qm@web8408.mail.in.yahoo.com> Message-ID: <06aa01c75f0b$2b1601d0$81420570$@net> arpit jain wrote: > I have build gcc-3.x cross compiler (for ADA language) for some > embedded target.But it is asking for some runtime library files when > running the binary. > > I think it needs some target specific files.I have not build newlib > package as I think it is runtime library for C language only. The C runtime library is usually the interface to the OS kernel: in general all code will expect a C runtime library is available. I think you will need to build newlib or some other C library and I think the Ada runtime does contain some C code. As an aside you could look into RTEMS: it's an OS for embedded systems with good Ada support. http://www.rtems.com/ There are sketch build instructions for RTEMS and Ada here: http://www.rtems.com/wiki/index.php/RTEMSAda Rup. ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ From ranjit_kumar_b4u@yahoo.co.uk Mon Mar 5 10:31:00 2007 From: ranjit_kumar_b4u@yahoo.co.uk (ranjith kumar) Date: Mon, 05 Mar 2007 10:31:00 -0000 Subject: gcc and SIMD In-Reply-To: Message-ID: <20070305103142.92029.qmail@web27408.mail.ukl.yahoo.com> --- Ian Lance Taylor wrote: > ranjith kumar writes: > > > 1) Seems that all defintions for MMX, SSE and > SSE2 > > are deinred in mmtrin.h,xmmintrin.h and > emmintrin.h > > header files respectively. Am I right? > > Yes. > > > 2) In those header files all functions call > > _builtin_ia32_*. Where those functions(body) are > > defined? > > They are intrinsic functions automatically defined > by the compiler. Please tell me in what file they are defined. > > > 3) I thought that associated with each SIMD > > instruction defined in Intel-ia-32-architectures > > manual(Basic architecture) there is one function > > defined in those header files. > > But for some instructions no functions were > defined in > > those header files.(For example MOVDQA > instruction) > > Also those header files contain some more > functions > > for which no SIMD assembly instruction > exist.Example > > in emmintrin.h > > static __inline __m128i > > _mm_load_si128 (__m128i const *__P) > > { > > return (__m128i) __builtin_ia32_loaddqa ((char > > const *)__P); > > } > > What could be the reason? > > Those header files follow the implementation > described by Intel. In which file they are described? The thing is that I want to go into internals of it. Thanks in advance. > > Ian > ___________________________________________________________ All New Yahoo! Mail ?? Tired of unwanted email come-ons? Let our SpamGuard protect you. http://uk.docs.yahoo.com/nowyoucan.html From kapil.anurag@yahoo.co.in Mon Mar 5 11:02:00 2007 From: kapil.anurag@yahoo.co.in (kapil jain) Date: Mon, 05 Mar 2007 11:02:00 -0000 Subject: Cross Compiler to Native Compiler Message-ID: <212326.15803.qm@web7810.mail.in.yahoo.com> Hi, I am porting/developing GCC onto a new platform. This platform already have a cross tool chain. Can anybody give me a roadmap to port GCC in native environment from scratch? or Way to convert, Croos-Compiler to Native-Compiler? Thanks n Regards, Kapil __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/ From maurizio_vitale@verizon.net Mon Mar 5 14:00:00 2007 From: maurizio_vitale@verizon.net (Maurizio Vitale) Date: Mon, 05 Mar 2007 14:00:00 -0000 Subject: gcc and SIMD In-Reply-To: <20070305103142.92029.qmail@web27408.mail.ukl.yahoo.com> References: <20070305103142.92029.qmail@web27408.mail.ukl.yahoo.com> Message-ID: <3369CBB2-0874-4F64-8BCB-B4D7CFE7E605@verizon.net> you can answer your questions yourself with a few Unix commands. If you want to know where __builtin_X is defined, start with all files in which it is used: find . -type f | xargs egrep -l __builtin_X [run from the top gcc directory] if you suspect that something is architecture specific you can limit the search to your architecture of interest by replacing '.' with the correct directory. But for the __builtin_* functions, you may end up with nothing: defined by the compiler means that GCC knows how to replace those calls with RTL (or maybe these days w/ higher level representations). So there's no function called __builtin_X. It is still likely that the __builtin_X names are mentioned somewhere in the code or comments around where the replacement happens. On Mar 5, 2007, at 5:31 AM, ranjith kumar wrote: > > --- Ian Lance Taylor wrote: > >> ranjith kumar writes: >> >>> 1) Seems that all defintions for MMX, SSE and >> SSE2 >>> are deinred in mmtrin.h,xmmintrin.h and >> emmintrin.h >>> header files respectively. Am I right? >> >> Yes. >> >>> 2) In those header files all functions call >>> _builtin_ia32_*. Where those functions(body) are >>> defined? >> >> They are intrinsic functions automatically defined >> by the compiler. > Please tell me in what file they are defined. > >> >>> 3) I thought that associated with each SIMD >>> instruction defined in Intel-ia-32-architectures >>> manual(Basic architecture) there is one function >>> defined in those header files. >>> But for some instructions no functions were >> defined in >>> those header files.(For example MOVDQA >> instruction) >>> Also those header files contain some more >> functions >>> for which no SIMD assembly instruction >> exist.Example >>> in emmintrin.h >>> static __inline __m128i >>> _mm_load_si128 (__m128i const *__P) >>> { >>> return (__m128i) __builtin_ia32_loaddqa ((char >>> const *)__P); >>> } >>> What could be the reason? >> >> Those header files follow the implementation >> described by Intel. > In which file they are described? > The thing is that I want to go into internals of it. > Thanks in advance. >> >> Ian >> > > > > > ___________________________________________________________ > All New Yahoo! Mail ? Tired of unwanted email come-ons? Let our > SpamGuard protect you. http://uk.docs.yahoo.com/nowyoucan.html > > From Danny.Birdie@synopsys.com Mon Mar 5 15:11:00 2007 From: Danny.Birdie@synopsys.com (Danny Birdie) Date: Mon, 05 Mar 2007 15:11:00 -0000 Subject: how to target the Intel 8051? Message-ID: Hi, I have some C code targeted for the Intel 8051. How do I go about using GCC to target the 8051, so I can generate an assembly output, or an Intel Hex output. Please send me all the necessary instructions/links for this. Regards, Danny From michael@kukat.de Mon Mar 5 16:02:00 2007 From: michael@kukat.de (Michael Kukat) Date: Mon, 05 Mar 2007 16:02:00 -0000 Subject: how to target the Intel 8051? In-Reply-To: References: Message-ID: <45EC3EF1.1070305@kukat.de> Hi, Danny Birdie schrieb: > I have some C code targeted for the Intel 8051. How do I go about > using GCC to target the 8051, so I can generate an assembly output, or > an Intel Hex output. does gcc really know about 8051? I think i used SDCC the last time i compiled C for the 8051. If you can read german, you may want to look here: http://www.mikrocontroller.net/articles/MCS51 This also might help (english): http://www.pjrc.com/tech/8051/ As i don't see any signs for gcc knowing about 8051, i don't assume that a driver exists for it. ...Michael From aph@redhat.com Mon Mar 5 16:13:00 2007 From: aph@redhat.com (Andrew Haley) Date: Mon, 05 Mar 2007 16:13:00 -0000 Subject: how to target the Intel 8051? In-Reply-To: References: Message-ID: <17900.16817.54522.911476@zebedee.pink> Danny Birdie writes: > Hi, > I have some C code targeted for the Intel 8051. How do I go about > using GCC to target the 8051, so I can generate an assembly output, or > an Intel Hex output. > > Please send me all the necessary instructions/links for this. The 8051 wouldn't be a good target for gcc. It's severely register starved, and the result would be very poor code density. Andrew. From vmakarov@redhat.com Mon Mar 5 16:47:00 2007 From: vmakarov@redhat.com (Vladimir Makarov) Date: Mon, 05 Mar 2007 16:47:00 -0000 Subject: DFA-scheduler In-Reply-To: <43215.10.129.41.35.1172946562.squirrel@www.cse.iitb.ac.in> References: <43215.10.129.41.35.1172946562.squirrel@www.cse.iitb.ac.in> Message-ID: <45EC495E.40103@redhat.com> P. Pavan Kumar wrote: >Respected sir, > > DFA pipeline hazard recognizer is used to avoid structural hazards. >While intra block(basic block scheduling) scheduling how data hazards are >avoided . DFA will take care of only structural hazards, but what about >data hazards. > >First cycle mutiple pass scheduling algorithm tries different schedules >and choose the best one. >intra block scheduling reorders the instructions within the basic block by >constructing DAG and based on LIST scheduling algorithm . >If First cycle mutiple pass algorithm chooses the best schedule then why >gcc needs intra block scheduling ? > The first cycle mutiple pass algorithm tries to increase number of insns issued on the same cycle while guaranting that the insn with the highest priority (the most important part of which is critical path length) will be issued on the same cycle. It can result in issuing not highest priority insn first. This algorithm is useful for VLIW processors. For example, a VLIW processor (e.g. FRV) requires to put integer insns at the start of VLIW and fp ones at the end. If fp insn has the highest priority, the scheduler without the first cycle mutiple pass algorithm will issue it first putting nops at the start of VLIW and the integer insns in the next VLIW. It means additional cycle for executing the insns. The scheduler with the algorithm will issue the insns on the same cycle (putting them in one VLIW). The algorithm was useful to speed up Itanium benchmarks. You could read more about this in an article about DFA in proceedings of the first gcc summit (you can find them on gcc web site). >Now gcc will do instruction scheduling beyond basic blocks i,e inter block >scheduling (region scheduling) then why gcc needs intrablock scheduling? > > BB scheduling is used only after the RA for all targets except for Itanium (historically there were no practically interblock movements after the RA, and there are even few of them even before the RA). Itanium port uses an extended block scheduling. There is recent Maxim's Kuvyrkov's proposal to make ebb scheduling working for all other targets. >what is command line option for enabling only intra block(with in basic >block) scheduling. and diabling all remaining intruction scheduling ( >trace, modulo etc). > > > Please, read the documentation. As I remember modulo scheduling and trace scheduling is not on by default. Forcing BB scheduling before the RA can be achieved by prohibiting interblock movements (please see gcc documentation). From iant@google.com Mon Mar 5 17:37:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Mon, 05 Mar 2007 17:37:00 -0000 Subject: gcc and SIMD In-Reply-To: <20070305103142.92029.qmail@web27408.mail.ukl.yahoo.com> References: <20070305103142.92029.qmail@web27408.mail.ukl.yahoo.com> Message-ID: ranjith kumar writes: > > > 2) In those header files all functions call > > > _builtin_ia32_*. Where those functions(body) are > > > defined? > > > > They are intrinsic functions automatically defined > > by the compiler. > Please tell me in what file they are defined. config/i386/i386.c defines the builtin functions support for x86 and x86_64. They expand into insn patterns described mostly in i386.md, some in other .md files in that directory. Ian From maurizio_vitale@verizon.net Mon Mar 5 18:11:00 2007 From: maurizio_vitale@verizon.net (Maurizio Vitale) Date: Mon, 05 Mar 2007 18:11:00 -0000 Subject: gcc and SIMD In-Reply-To: <20070305103142.92029.qmail@web27408.mail.ukl.yahoo.com> References: <20070305103142.92029.qmail@web27408.mail.ukl.yahoo.com> Message-ID: <3369CBB2-0874-4F64-8BCB-B4D7CFE7E605@verizon.net> you can answer your questions yourself with a few Unix commands. If you want to know where __builtin_X is defined, start with all files in which it is used: find . -type f | xargs egrep -l __builtin_X [run from the top gcc directory] if you suspect that something is architecture specific you can limit the search to your architecture of interest by replacing '.' with the correct directory. But for the __builtin_* functions, you may end up with nothing: defined by the compiler means that GCC knows how to replace those calls with RTL (or maybe these days w/ higher level representations). So there's no function called __builtin_X. It is still likely that the __builtin_X names are mentioned somewhere in the code or comments around where the replacement happens. On Mar 5, 2007, at 5:31 AM, ranjith kumar wrote: > > --- Ian Lance Taylor wrote: > >> ranjith kumar writes: >> >>> 1) Seems that all defintions for MMX, SSE and >> SSE2 >>> are deinred in mmtrin.h,xmmintrin.h and >> emmintrin.h >>> header files respectively. Am I right? >> >> Yes. >> >>> 2) In those header files all functions call >>> _builtin_ia32_*. Where those functions(body) are >>> defined? >> >> They are intrinsic functions automatically defined >> by the compiler. > Please tell me in what file they are defined. > >> >>> 3) I thought that associated with each SIMD >>> instruction defined in Intel-ia-32-architectures >>> manual(Basic architecture) there is one function >>> defined in those header files. >>> But for some instructions no functions were >> defined in >>> those header files.(For example MOVDQA >> instruction) >>> Also those header files contain some more >> functions >>> for which no SIMD assembly instruction >> exist.Example >>> in emmintrin.h >>> static __inline __m128i >>> _mm_load_si128 (__m128i const *__P) >>> { >>> return (__m128i) __builtin_ia32_loaddqa ((char >>> const *)__P); >>> } >>> What could be the reason? >> >> Those header files follow the implementation >> described by Intel. > In which file they are described? > The thing is that I want to go into internals of it. > Thanks in advance. >> >> Ian >> > > > > > ___________________________________________________________ > All New Yahoo! Mail ? Tired of unwanted email come-ons? Let our > SpamGuard protect you. http://uk.docs.yahoo.com/nowyoucan.html > > From pcech@vision.ee.ethz.ch Mon Mar 5 19:15:00 2007 From: pcech@vision.ee.ethz.ch (Peter Cech) Date: Mon, 05 Mar 2007 19:15:00 -0000 Subject: GCC Versioning Policy In-Reply-To: <34128.60174.qm@web30704.mail.mud.yahoo.com> References: <34128.60174.qm@web30704.mail.mud.yahoo.com> Message-ID: <20070305181144.GH28834@ee.ethz.ch> On Sun, Mar 04, 2007 at 20:37:43 -0800, sankar chebolu wrote: > Hi, > Any document available which explains the GCC > Versioning policy/scheme? Did not stumble upon any so far, but I can offer what I gathered around. GCC is not using any odd/even (or stable/unstable) notion in the versioning. Each X.Y.z version is stable release. Each release series starts with number X.Y.0 and is maintained in a separate branch that is in regression fixes only mode. That means, no new features, only bugfixes will appear in X.Y.1 and later patch releases. If a bugfix is too intrusive, it is not applied to release series (the reason is that intrusive changes are likely to introduce new bugs), instead the bug is fixed in the current developer branch (that will become next release series in the future). The GCC website (http://gcc.gnu.org) has a status and history section where you can have a look at the changes, current status of the series and list of regressions (bugs that did not occur in a previous versions of GCC) against the series. Generally, X.Y.0 contain new features, so you are more likely to encounter a bug. Personally I'm waiting for X.Y.1 or X.Y.2 when switching to newer version of the compiler. If there are big changes (like between 3.4 and 4.0) or if you want to use brand new feature, it might be wise to wait a bit longer. > Among GCC 4.0.4 & 4.1.2 which one is more stable? Both should be in a reasonably good shape, but as the internal representation changed in the 4.0 series, I would go for 4.1.2 (as I mentioned above, there is a category of bugs that cannot be fully fixed on a release branch, but are likely fixed before the next X.Y release). Hope it helps. Peter From dqarras@yahoo.com Mon Mar 5 23:10:00 2007 From: dqarras@yahoo.com (Daniel Qarras) Date: Mon, 05 Mar 2007 23:10:00 -0000 Subject: Using new gcc/glibc on an older system Message-ID: <653710.55422.qm@web36802.mail.mud.yahoo.com> Hi! > this might be a FAQ but I didn't find anything yet, so: > > On an older system it is rather trivial to install latest > binutils/gcc/gdb and then use them during development: just configure > them with --prefix=/some/path and add /some/path/bin in front of your > PATH (with GCC I'm also using LD_LIBRARY_PATH pointing to .o > files/libgcc.so). All those seem to work. However, when glibc comes > into play, nothing seems to be trivial anymore. There are two things > I'd like to do: > > 1) compile programs against a new glibc and then run those binaries > that require the new libc. > > 2) run any given existing program against the new glibc seems hairy: It turned out that I was using a bad snapshot, latest CVS versions works in both cases when running old or new programs with the new ld-linux.so.2 --library-path ... Cheers! ____________________________________________________________________________________ Looking for earth-friendly autos? Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center. http://autos.yahoo.com/green_center/ From seanm@seanm.ca Tue Mar 6 02:37:00 2007 From: seanm@seanm.ca (Sean MacLennan) Date: Tue, 06 Mar 2007 02:37:00 -0000 Subject: G++ and constructors Message-ID: <45ECA343.5030306@seanm.ca> Hi, I have been warned that the following can happen under another compiler. I don't think it can happen with g++, and frankly I don't think it can happen, but I was wondering if anybody could give a definitive answer. We have a singleton and a method to get the singleton that creates it if necessary. Assume lock and unlock just work ;) static myclass *instance = NULL; static myclass *myclass::get_instance() { if(instance == NULL) { lock(); if(instance == NULL) instance = new myclass(); unlock(); } return instance; } What was argued was that the new can be split it two parts. It can allocate the memory, assign this memory to instance, *then* call the constructor. So you have a race condition in a multi-threaded system where instance is non-null, but has not yet been initialized. I always thought that the new would not return until *after* the constructor had been called. Therefore, no race condition. I don't need work-arounds, I just need to know if the code ever could be split. Cheers, Sean MacLennan From sagrav@racsa.co.cr Tue Mar 6 03:00:00 2007 From: sagrav@racsa.co.cr (Gordiano Brunati) Date: Tue, 06 Mar 2007 03:00:00 -0000 Subject: gcc-4.1.2 configuration failed Message-ID: <1173148628.7617.4.camel@makumba> hello: I'm trying to configure gcc in my objdir from a separate source directory as recommended. I've installed gmp via apt-get. from: ubuntu 6.06 gcc-4.1.2 i686-pc-linux-gnu critical part of my config.log: configure:2177: checking how to compare bootstrapped objects configure:2281: checking for correct version of gmp.h configure:2294: gcc -c -g -O2 conftest.c 1>&5 configure:2284:17: error: gmp.h: No such file or directory configure: In function 'main': configure:2288: error: 'choke' undeclared (first use in this function) configure:2288: error: (Each undeclared identifier is reported only once configure:2288: error: for each function it appears in.) configure:2288: error: syntax error before 'me' configure: failed program was: #line 2283 "configure" #include "confdefs.h" #include "gmp.h" int main() { #if __GNU_MP_VERSION < 3 choke me #endif ; return 0; } can anybody help me? Thanks in advance. Rafael www.astrocosas.com From brian@dessent.net Tue Mar 6 05:38:00 2007 From: brian@dessent.net (Brian Dessent) Date: Tue, 06 Mar 2007 05:38:00 -0000 Subject: gcc-4.1.2 configuration failed References: <1173148628.7617.4.camel@makumba> Message-ID: <45ECD955.CB0E0A9@dessent.net> Gordiano Brunati wrote: > configure:2284:17: error: gmp.h: No such file or directory It looks like you don't have the headers installed. They are usually in a separate package (with -dev or -devel in the name) because they are only needed by developers (i.e. linking against the library), not for regular users that are just running binaries that use the library. So you need to double check that you got the right package. Brian From iant@google.com Tue Mar 6 08:12:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Tue, 06 Mar 2007 08:12:00 -0000 Subject: -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations In-Reply-To: <000f01c75ef9$ce78f650$6bd04c93@mul7.nec.com.au> References: <000f01c75ef9$ce78f650$6bd04c93@mul7.nec.com.au> Message-ID: "John Fisher" writes: > Is it necessary to specify all 4 of these warnings to get the maximum amount > of warnings in C code? Probably not. > I would expect that -Wmissing-prototypes implies -Wmissing-declarations > since I understand > prototype to mean exactly "new-style function declaration". -Wmissing-prototypes warns about void f (); void f (int i) { } (i.e., there is no previous declaration with a prototype). -Wmissing-declarations normally warns about void f (int i) { } (i.e., there is no previous declaration at all) which is a subset of -Wmissing-prototypes. I can't think of any case where -Wmissing-declarations will give a warning but -Wmissing-prototypes will not. There is what appears to be such a case in the compiler source code, but I don't see any way to trigger it with a valid program. Ian From kaminaga@sm.sony.co.jp Tue Mar 6 12:44:00 2007 From: kaminaga@sm.sony.co.jp (Hiroki Kaminaga) Date: Tue, 06 Mar 2007 12:44:00 -0000 Subject: wrong-code in -ftree-ter on arm? Message-ID: <20070306.170610.35008765.kaminaga@sm.sony.co.jp> Hi, The attached codes, snipped from linux kernel source code produce wrong code above -O1. $ arm-linux-gcc -O2 -c div64.S $ arm-linux-gcc -O2 -save-temps dodiv.c div64.o -o dodiv actual result: $ ./dodiv tbuf: <4>[ 52.305419] expected result: tbuf: <4>[ 0.305419] when compiled with -fno-tree-ter, the result was OK. I'm using gcc-4.1.2. The problem comes from bad argument passing to sprintf(), looking from dodiv.s: ... mov r2, r5 <<<<<< (1) mov ip, ip, lsr #6 mov r3, r5 <<<<<< (2) ldr r1, .L10+8 mov r0, r4 str ip, [sp, #0] bl sprintf Where (1) is loglev_char argument and (2) is (unsigned long)t argument in sprintf() in dodiv.c. Apparently, the loglev_char is also assigned to the first %5lu part of sprintf, which is the cause. I'm not sure if this is a gcc bug, since in div64.S obtained from linux kernel, comments that it is non standard for optimal code. Any hint/advice please? Thanks in Advance. (Hiroki Kaminaga) t -- -------------- next part -------------- #include #include #define __xl "r0" #define __xh "r1" #define __asmeq(x, y) ".ifnc " x "," y " ; .err ; .endif\n\t" #define do_div(n,base) \ ({ \ register unsigned int __base asm("r4") = base; \ register unsigned long long __n asm("r0") = n; \ register unsigned long long __res asm("r2"); \ register unsigned int __rem asm(__xh); \ asm( __asmeq("%0", __xh) \ __asmeq("%1", "r2") \ __asmeq("%2", "r0") \ __asmeq("%3", "r4") \ "bl __do_div64" \ : "=r" (__rem), "=r" (__res) \ : "r" (__n), "r" (__base) \ : "ip", "lr", "cc"); \ n = __res; \ __rem; \ }) #define default_message_loglevel 4 unsigned long long printk_clock(void){ return (unsigned long long) 0x12345678; } int main(void) { int loglev_char; char *p; char tbuf[50], *tp; unsigned tlen; unsigned long long t; unsigned long nanosec_rem; p = alloca(1024); if (p[0] == '<' ) { loglev_char = p[1]; } else { loglev_char = default_message_loglevel + '0'; } t = printk_clock(); nanosec_rem = do_div(t, 1000000000); tlen = sprintf(tbuf, "<%c>[%5lu.%06lu] ", loglev_char, (unsigned long)t, nanosec_rem/1000); printf("tbuf: %s\n", tbuf); return 0; } -------------- next part -------------- /* * linux/arch/arm/lib/div64.S * * Optimized computation of 64-bit dividend / 32-bit divisor * * Author: Nicolas Pitre * Created: Oct 5, 2003 * Copyright: Monta Vista Software, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ //#include #define ALIGN .align 4,0x90 #define ENTRY(name) \ .globl name ; \ ALIGN ; \ name: #ifdef __ARMEB__ #define xh r0 #define xl r1 #define yh r2 #define yl r3 #else #define xl r0 #define xh r1 #define yl r2 #define yh r3 #endif /* * __do_div64: perform a division with 64-bit dividend and 32-bit divisor. * * Note: Calling convention is totally non standard for optimal code. * This is meant to be used by do_div() from include/asm/div64.h only. * * Input parameters: * xh-xl = dividend (clobbered) * r4 = divisor (preserved) * * Output values: * yh-yl = result * xh = remainder * * Clobbered regs: xl, ip */ ENTRY(__do_div64) @ Test for easy paths first. subs ip, r4, #1 bls 9f @ divisor is 0 or 1 tst ip, r4 beq 8f @ divisor is power of 2 @ See if we need to handle upper 32-bit result. cmp xh, r4 mov yh, #0 blo 3f @ Align divisor with upper part of dividend. @ The aligned divisor is stored in yl preserving the original. @ The bit position is stored in ip. #if __LINUX_ARM_ARCH__ >= 5 clz yl, r4 clz ip, xh sub yl, yl, ip mov ip, #1 mov ip, ip, lsl yl mov yl, r4, lsl yl #else mov yl, r4 mov ip, #1 1: cmp yl, #0x80000000 cmpcc yl, xh movcc yl, yl, lsl #1 movcc ip, ip, lsl #1 bcc 1b #endif @ The division loop for needed upper bit positions. @ Break out early if dividend reaches 0. 2: cmp xh, yl orrcs yh, yh, ip subcss xh, xh, yl movnes ip, ip, lsr #1 mov yl, yl, lsr #1 bne 2b @ See if we need to handle lower 32-bit result. 3: cmp xh, #0 mov yl, #0 cmpeq xl, r4 movlo xh, xl movlo pc, lr @ The division loop for lower bit positions. @ Here we shift remainer bits leftwards rather than moving the @ divisor for comparisons, considering the carry-out bit as well. mov ip, #0x80000000 4: movs xl, xl, lsl #1 adcs xh, xh, xh beq 6f cmpcc xh, r4 5: orrcs yl, yl, ip subcs xh, xh, r4 movs ip, ip, lsr #1 bne 4b mov pc, lr @ The top part of remainder became zero. If carry is set @ (the 33th bit) this is a false positive so resume the loop. @ Otherwise, if lower part is also null then we are done. 6: bcs 5b cmp xl, #0 moveq pc, lr @ We still have remainer bits in the low part. Bring them up. #if __LINUX_ARM_ARCH__ >= 5 clz xh, xl @ we know xh is zero here so... add xh, xh, #1 mov xl, xl, lsl xh mov ip, ip, lsr xh #else 7: movs xl, xl, lsl #1 mov ip, ip, lsr #1 bcc 7b #endif @ Current remainder is now 1. It is worthless to compare with @ divisor at this point since divisor can not be smaller than 3 here. @ If possible, branch for another shift in the division loop. @ If no bit position left then we are done. movs ip, ip, lsr #1 mov xh, #1 bne 4b mov pc, lr 8: @ Division by a power of 2: determine what that divisor order is @ then simply shift values around #if __LINUX_ARM_ARCH__ >= 5 clz ip, r4 rsb ip, ip, #31 #else mov yl, r4 cmp r4, #(1 << 16) mov ip, #0 movhs yl, yl, lsr #16 movhs ip, #16 cmp yl, #(1 << 8) movhs yl, yl, lsr #8 addhs ip, ip, #8 cmp yl, #(1 << 4) movhs yl, yl, lsr #4 addhs ip, ip, #4 cmp yl, #(1 << 2) addhi ip, ip, #3 addls ip, ip, yl, lsr #1 #endif mov yh, xh, lsr ip mov yl, xl, lsr ip rsb ip, ip, #32 orr yl, yl, xh, lsl ip mov xh, xl, lsl ip mov xh, xh, lsr ip mov pc, lr @ eq -> division by 1: obvious enough... 9: moveq yl, xl moveq yh, xh moveq xh, #0 moveq pc, lr @ Division by 0: str lr, [sp, #-4]! bl __div0 @ as wrong as it could be... mov yl, #0 mov yh, #0 mov xh, #0 ldr pc, [sp], #4 From eljay@adobe.com Tue Mar 6 12:46:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Tue, 06 Mar 2007 12:46:00 -0000 Subject: G++ and constructors In-Reply-To: <45ECA343.5030306@seanm.ca> Message-ID: Hi Sean, > I don't need work-arounds, I just need to know if the code ever could be > split. Yes. The code can be split (assuming that "lock()" and "unlock()" are not performing some thread "critical protection" locking for you). Although you didn't ask for work-arounds, here's a work-around that works for GCC, but may not work in C++ in general*. GCC uses threading protection for static objects. So this variant of your routine, in GCC, should be thread safe: ---------------------------------------------------------------------- myclass* myclass::init_instance() // private: static { return new myclass(); } myclass* myclass::get_instance() // public: static { static myclass* instance = InitInstance(); return instance; } ---------------------------------------------------------------------- HTH, --Eljay * since ISO 14882 C++ punted on the whole threading issue**. ** ... and on a standard C++ ABI, on modules, on... well, lots of stuff for various reasons***. *** some good reasons, some bad reasons -- depending on one's point of view. From eljay@adobe.com Tue Mar 6 14:58:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Tue, 06 Mar 2007 14:58:00 -0000 Subject: G++ and constructors In-Reply-To: Message-ID: Note: I put in the init_instance() presuming you wanted to do some extra work in there -- such as whatever lock() and unlock() are doing. If you don't need to do any extra work, then you can collapse it to the simpler: ---------------------------------------------------------------------- myclass* myclass::get_instance() // public: static { static myclass* instance = new myclass; return instance; } ---------------------------------------------------------------------- Sorry if I previous more complicated example caused confusion. --Eljay From dreams_arpit@yahoo.co.in Tue Mar 6 15:54:00 2007 From: dreams_arpit@yahoo.co.in (arpit jain) Date: Tue, 06 Mar 2007 15:54:00 -0000 Subject: Cross compiler build.... Message-ID: <999329.54724.qm@web8403.mail.in.yahoo.com> Hiiiii, I am trying to build gcc-3.x cross compiler for Ada language for some embbedded target platform. I have already build 1.binutils (i.e. cross assembler,cross linker) 2.newlib 1.14.0 I wanna to know: 1. Is it necessary to build newlib for Ada also bcoz i think its for c language only? 2. What are the steps to build newlib? Thanks & Regards Arpit __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/ From kickslop@yahoo.com Tue Mar 6 15:57:00 2007 From: kickslop@yahoo.com (Charles Blaine) Date: Tue, 06 Mar 2007 15:57:00 -0000 Subject: GCC 4.1.1 build failure in libjava - RHELv4 Message-ID: <876767.43937.qm@web61318.mail.yahoo.com> Building GCC 4.1.1 fails with both GCC 3.4.6 and 4.1.0 as provided by Red Hat (at the same spot) Building from source is a requirement for us. Any ideas? mkdir build cd build ../gcc-4.1.1/configure --prefix=/my/path --disable-shared make bootstrap ... make[7]: Entering directory `/utopia/tmp/build/i686-pc-linux-gnu/libjava/classpath/native/jni/midi-alsa' make[7]: *** No rule to make target `gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c', needed by `gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.lo'. Stop. ____________________________________________________________________________________ Finding fabulous fares is fun. Let Yahoo! FareChase search your favorite travel sites to find flight and hotel bargains. http://farechase.yahoo.com/promo-generic-14795097 From karuottu@mbnet.fi Tue Mar 6 16:01:00 2007 From: karuottu@mbnet.fi (Kai Ruottu) Date: Tue, 06 Mar 2007 16:01:00 -0000 Subject: Cross compiler build.... In-Reply-To: <999329.54724.qm@web8403.mail.in.yahoo.com> References: <999329.54724.qm@web8403.mail.in.yahoo.com> Message-ID: <45ED9030.5080104@mbnet.fi> arpit jain kirjoitti: > Hiiiii, > > I am trying to build gcc-3.x cross compiler for Ada > language for some embbedded target platform. > I have already build > 1.binutils (i.e. cross assembler,cross linker) > 2.newlib 1.14.0 > > I wanna to know: > 1. Is it necessary to build newlib for Ada also bcoz i > think its for c language only? > I would assume that what Rupert Wood wrote earlier is true, the Ada libraries will require functions from the C library! Checking this is easy, just write 'nm libgnat.a | less' for the host 'libgnat.a' and see what kind of symbols will appear as 'U' (unknown). The first 'C like function' I saw there was 'memcpy' and it was there in 84 places : Dell:/usr/local/lib/gcc-lib/i586-suse-linux9.2/3.4.6/adalib # nm libgnat.a | grep memcpy | wc -l 84 Just try to remember some common C functions and see whether they are required in 'libgnat.a' and such. So having the C library too is obligatory with GNU Ada. Also C++ and Fortran libraries use fuctions from the C library, they aren't "stand-alone" either. > 2. What are the steps to build newlib? > If you have already built newlib-1.14.0 then you already know.... Generally the steps are the usual 'configure', 'build' and 'install'. From aph@redhat.com Tue Mar 6 16:04:00 2007 From: aph@redhat.com (Andrew Haley) Date: Tue, 06 Mar 2007 16:04:00 -0000 Subject: GCC 4.1.1 build failure in libjava - RHELv4 In-Reply-To: <876767.43937.qm@web61318.mail.yahoo.com> References: <876767.43937.qm@web61318.mail.yahoo.com> Message-ID: <17901.36945.879694.20490@zebedee.pink> Charles Blaine writes: > Building GCC 4.1.1 fails with both GCC 3.4.6 and 4.1.0 as provided by Red Hat > (at the same spot) > > Building from source is a requirement for us. Any ideas? > > > mkdir build > > cd build > > ../gcc-4.1.1/configure --prefix=/my/path --disable-shared > > make bootstrap > ... > make[7]: Entering directory > `/utopia/tmp/build/i686-pc-linux-gnu/libjava/classpath/native/jni/midi-alsa' > make[7]: *** No rule to make target > `gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c', needed by > `gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.lo'. Stop. I can't remember seeing anything like this before. This file should be present as gcc/classpath/native/jni/midi-alsa/.svn/text-base/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c Is it present in your source tree? It is possible that using a relative path to configure is screwing things up. Try /utopia/tmp/configure --prefix=/my/path --disable-shared Andrew. From aph@redhat.com Tue Mar 6 16:13:00 2007 From: aph@redhat.com (Andrew Haley) Date: Tue, 06 Mar 2007 16:13:00 -0000 Subject: GCC 4.1.1 build failure in libjava - RHELv4 In-Reply-To: <17901.36945.879694.20490@zebedee.pink> References: <876767.43937.qm@web61318.mail.yahoo.com> <17901.36945.879694.20490@zebedee.pink> Message-ID: <17901.37102.335142.506171@zebedee.pink> Andrew Haley writes: > Charles Blaine writes: > > Building GCC 4.1.1 fails with both GCC 3.4.6 and 4.1.0 as provided by Red Hat > > (at the same spot) > > > > Building from source is a requirement for us. Any ideas? > > > > > > mkdir build > > > > cd build > > > > ../gcc-4.1.1/configure --prefix=/my/path --disable-shared > > > > make bootstrap > > ... > > make[7]: Entering directory > > `/utopia/tmp/build/i686-pc-linux-gnu/libjava/classpath/native/jni/midi-alsa' > > make[7]: *** No rule to make target > > `gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c', needed by > > `gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.lo'. Stop. > > I can't remember seeing anything like this before. This file should > be present as > gcc/classpath/native/jni/midi-alsa/.svn/text-base/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c Typo, sorry gcc/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c > > Is it present in your source tree? > > It is possible that using a relative path to configure is screwing > things up. Try > > /utopia/tmp/configure --prefix=/my/path --disable-shared > > Andrew. From avi@qumranet.com Tue Mar 6 16:20:00 2007 From: avi@qumranet.com (Avi Kivity) Date: Tue, 06 Mar 2007 16:20:00 -0000 Subject: Inline assembly constraints for a specific register Message-ID: <45ED926E.9090400@qumranet.com> How can I specify a constraint for a specific register, for example r8 on x86_64? I can specify any of rax, rbx, rcx, and rdx using a,b, c, and d. But what about the rest of the register file? -- error compiling committee.c: too many arguments to function From kickslop@yahoo.com Tue Mar 6 16:21:00 2007 From: kickslop@yahoo.com (Charles Blaine) Date: Tue, 06 Mar 2007 16:21:00 -0000 Subject: GCC 4.1.1 build failure in libjava - RHELv4 Message-ID: <626220.58377.qm@web61321.mail.yahoo.com> Nope -- file ends in '.' not '.c' build:utopia> ls ../gcc-4.1.1/libjava/classpath/native/jni/midi-alsa/ gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c Makefile.am gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice. Makefile.in gnu_javax_sound_midi_alsa_AlsaPortDevice.c build:utopia> I confirmed that the gcc-4.1.1.tar.gz I downloaded some time ago from gnu.org has the broken file suffix as well (in the tar.gz). ----- Original Message ---- From: Andrew Haley To: Charles Blaine ; gcc-help@gcc.gnu.org Sent: Tuesday, March 6, 2007 11:03:58 AM Subject: Re: GCC 4.1.1 build failure in libjava - RHELv4 Andrew Haley writes: > Charles Blaine writes: > > Building GCC 4.1.1 fails with both GCC 3.4.6 and 4.1.0 as provided by Red Hat > > (at the same spot) > > > > Building from source is a requirement for us. Any ideas? > > > > > > mkdir build > > > > cd build > > > > ../gcc-4.1.1/configure --prefix=/my/path --disable-shared > > > > make bootstrap > > ... > > make[7]: Entering directory > > `/utopia/tmp/build/i686-pc-linux-gnu/libjava/classpath/native/jni/midi-alsa' > > make[7]: *** No rule to make target > > `gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c', needed by > > `gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.lo'. Stop. > > I can't remember seeing anything like this before. This file should > be present as > gcc/classpath/native/jni/midi-alsa/.svn/text-base/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c Typo, sorry gcc/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c > > Is it present in your source tree? > > It is possible that using a relative path to configure is screwing > things up. Try > > /utopia/tmp/configure --prefix=/my/path --disable-shared > > Andrew. ____________________________________________________________________________________ Don't pick lemons. See all the new 2007 cars at Yahoo! Autos. http://autos.yahoo.com/new_cars.html From aph@redhat.com Tue Mar 6 16:31:00 2007 From: aph@redhat.com (Andrew Haley) Date: Tue, 06 Mar 2007 16:31:00 -0000 Subject: Inline assembly constraints for a specific register In-Reply-To: <45ED926E.9090400@qumranet.com> References: <45ED926E.9090400@qumranet.com> Message-ID: <17901.38148.968808.545168@zebedee.pink> Avi Kivity writes: > How can I specify a constraint for a specific register, for example r8 > on x86_64? > > I can specify any of rax, rbx, rcx, and rdx using a,b, c, and d. But > what about the rest of the register file? Like this: int poo (int N) { register int zz __asm__ ("r8") = N; __asm__ ("mov %0, %0" : "+r"(zz)); return zz; } Andrew. From wivanov@csodessa.com Tue Mar 6 16:45:00 2007 From: wivanov@csodessa.com (W. Ivanov) Date: Tue, 06 Mar 2007 16:45:00 -0000 Subject: BUG: wrong function call Message-ID: <45ED96B3.9020906@csodessa.com> -------------- next part -------------- An embedded message was scrubbed... From: "W. Ivanov" Subject: BUG: wrong function call Date: Tue, 06 Mar 2007 17:19:12 +0200 Size: 600 URL: From eljay@adobe.com Tue Mar 6 17:55:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Tue, 06 Mar 2007 17:55:00 -0000 Subject: BUG: wrong function call In-Reply-To: <45ED96B3.9020906@csodessa.com> Message-ID: Hi W. Ivanov, Please provide a short, compilable, stand-alone code example that demonstrates the problem you are experiencing. Also, what version of GCC are you using? What platform are you compiling and running on? Thanks, --Eljay From aph@redhat.com Tue Mar 6 18:17:00 2007 From: aph@redhat.com (Andrew Haley) Date: Tue, 06 Mar 2007 18:17:00 -0000 Subject: GCC 4.1.1 build failure in libjava - RHELv4 In-Reply-To: <626220.58377.qm@web61321.mail.yahoo.com> References: <626220.58377.qm@web61321.mail.yahoo.com> Message-ID: <17901.43794.175421.992233@zebedee.pink> Please don't top-post. Charles Blaine writes: > From: Andrew Haley > Andrew Haley writes: > > Charles Blaine writes: > > > Building GCC 4.1.1 fails with both GCC 3.4.6 and 4.1.0 as provided by Red Hat > > > (at the same spot) > > > > > > Building from source is a requirement for us. Any ideas? > > > > > > > > > mkdir build > > > > > > cd build > > > > > > ../gcc-4.1.1/configure --prefix=/my/path --disable-shared > > > > > > make bootstrap > > > ... > > > make[7]: Entering directory > > > `/utopia/tmp/build/i686-pc-linux-gnu/libjava/classpath/native/jni/midi-alsa' > > > make[7]: *** No rule to make target > > > `gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c', needed by > > > `gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.lo'. Stop. > > > > I can't remember seeing anything like this before. This file should > > be present as > > gcc/classpath/native/jni/midi-alsa/.svn/text-base/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c > > Typo, sorry > > gcc/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c > > > > > Is it present in your source tree? > Nope -- file ends in '.' not '.c' > > build:utopia> ls ../gcc-4.1.1/libjava/classpath/native/jni/midi-alsa/ > > gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c Makefile.am > > gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice. Makefile.in > > gnu_javax_sound_midi_alsa_AlsaPortDevice.c > > build:utopia> > > I confirmed that the gcc-4.1.1.tar.gz I downloaded some time ago > from gnu.org has the broken file suffix as well (in the tar.gz). It's ok at ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.1.1/gcc-4.1.1.tar.bz2: gcc-4.1.1/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaPortDevice.c gcc-4.1.1/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c gcc-4.1.1/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c gcc-4.1.1/libjava/classpath/native/jni/classpath/ Where did you get gcc-4.1.1.tar.gz ? :-) Andrew. From ranjit_kumar_b4u@yahoo.co.uk Tue Mar 6 19:35:00 2007 From: ranjit_kumar_b4u@yahoo.co.uk (ranjith kumar) Date: Tue, 06 Mar 2007 19:35:00 -0000 Subject: Folding built-in functions Message-ID: <20070306181652.9029.qmail@web27414.mail.ukl.yahoo.com> Gcc manuals says all builtin functions are folded in tree optimization passe(given below) that are run after gimplification http://gcc.gnu.org/onlinedocs/gccint/Tree_002dSSA-passes.html#Tree_002dSSA-passes >Folding built-in functions >This pass simplifies built-in functions, as applicable, >with constant arguments or with inferrable string >lengths. It is located in tree-ssa-ccp.c and is >described by pass_fold_builtins. 1)I find _builtin* functions in mmintrin.h, xmmintrin.h and emmintrin.h........ I think 'Folding built-in functions' is the pass that replaces _builtin functions when a program is compiled. Am I right? ___________________________________________________________ New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at the Yahoo! Mail Championships. Plus: play games and win prizes. http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk From kickslop@yahoo.com Wed Mar 7 01:11:00 2007 From: kickslop@yahoo.com (Charles Blaine) Date: Wed, 07 Mar 2007 01:11:00 -0000 Subject: GCC 4.1.1 build failure in libjava - RHELv4 Message-ID: <970893.62653.qm@web61318.mail.yahoo.com> Sorry for "top posting", Andrew :) In my 14 years on the internet I've never been scolded for it. I guess everyone has preferences (I personally hate when people reply in-line -- I know what the conversation is about already, don't make me dig through the whole message exchange to find your latest comments! :) As you can see below, using 'reply-all' via Yahoo Mail does not put '>' marks or any other quote nesting. Replying in-line would be very confusing in this case. Sorry, Yahoo Mail is what I use for all of my mailing list subscriptions in order to avoid spam at my "real/personal" account. Anyway... I do not know exactly where I got the gcc-4.1.1.tar.gz, but it was surely a GNU mirror or gnu.org itself. The timestamp on my copy is September 26, 2006. Oh well -- thanks for the help. Renaming the file solved the problem. ----- Original Message ---- From: Andrew Haley To: Charles Blaine Cc: gcc-help@gcc.gnu.org Sent: Tuesday, March 6, 2007 12:55:30 PM Subject: Re: GCC 4.1.1 build failure in libjava - RHELv4 Please don't top-post. Charles Blaine writes: > From: Andrew Haley > Andrew Haley writes: > > Charles Blaine writes: > > > Building GCC 4.1.1 fails with both GCC 3.4.6 and 4.1.0 as provided by Red Hat > > > (at the same spot) > > > > > > Building from source is a requirement for us. Any ideas? > > > > > > > > > mkdir build > > > > > > cd build > > > > > > ../gcc-4.1.1/configure --prefix=/my/path --disable-shared > > > > > > make bootstrap > > > ... > > > make[7]: Entering directory > > > `/utopia/tmp/build/i686-pc-linux-gnu/libjava/classpath/native/jni/midi-alsa' > > > make[7]: *** No rule to make target > > > `gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c', needed by > > > `gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.lo'. Stop. > > > > I can't remember seeing anything like this before. This file should > > be present as > > gcc/classpath/native/jni/midi-alsa/.svn/text-base/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c > > Typo, sorry > > gcc/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c > > > > > Is it present in your source tree? > Nope -- file ends in '.' not '.c' > > build:utopia> ls ../gcc-4.1.1/libjava/classpath/native/jni/midi-alsa/ > > gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c Makefile.am > > gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice. Makefile.in > > gnu_javax_sound_midi_alsa_AlsaPortDevice.c > > build:utopia> > > I confirmed that the gcc-4.1.1.tar.gz I downloaded some time ago > from gnu.org has the broken file suffix as well (in the tar.gz). It's ok at ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.1.1/gcc-4.1.1.tar.bz2: gcc-4.1.1/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaPortDevice.c gcc-4.1.1/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c gcc-4.1.1/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c gcc-4.1.1/libjava/classpath/native/jni/classpath/ Where did you get gcc-4.1.1.tar.gz ? :-) Andrew. ____________________________________________________________________________________ Bored stiff? Loosen up... Download and play hundreds of games for free on Yahoo! Games. http://games.yahoo.com/games/front From kaminaga@sm.sony.co.jp Wed Mar 7 16:23:00 2007 From: kaminaga@sm.sony.co.jp (Hiroki Kaminaga) Date: Wed, 07 Mar 2007 16:23:00 -0000 Subject: wrong-code in -ftree-ter on arm? In-Reply-To: <20070306.170610.35008765.kaminaga@sm.sony.co.jp> References: <20070306.170610.35008765.kaminaga@sm.sony.co.jp> Message-ID: <20070307.100454.131914938.kaminaga@sm.sony.co.jp> Hi, From: Hiroki Kaminaga > > The attached codes, snipped from linux kernel source code produce > wrong code above -O1. May I file this into bugzilla? Best Regards, -- From satyaakam@gmail.com Wed Mar 7 16:33:00 2007 From: satyaakam@gmail.com (satyaakam goswami) Date: Wed, 07 Mar 2007 16:33:00 -0000 Subject: libg2c.a missing in 4.1.1 Message-ID: <6491e1350703070822x63a7c795ge815c6219a8447b8@mail.gmail.com> Hi, Noticed libg2c.a is missing in /lib in 4.1.1 hierarchy , whats the equivalent of libg2c.a in gcc 4.1.1 , any pointers . Satya From daniel.lohmann@informatik.uni-erlangen.de Wed Mar 7 16:40:00 2007 From: daniel.lohmann@informatik.uni-erlangen.de (Daniel Lohmann) Date: Wed, 07 Mar 2007 16:40:00 -0000 Subject: G++ and constructors In-Reply-To: References: Message-ID: <45EEE953.3090409@informatik.uni-erlangen.de> John Love-Jensen schrieb: > [...] > Although you didn't ask for work-arounds, here's a work-around that works > for GCC, but may not work in C++ in general*. > > GCC uses threading protection for static objects. > > So this variant of your routine, in GCC, should be thread safe: > > ---------------------------------------------------------------------- > myclass* myclass::init_instance() // private: static > { > return new myclass(); > } > > myclass* myclass::get_instance() // public: static > { > static myclass* instance = InitInstance(); > return instance; > } > ---------------------------------------------------------------------- *GCC* does the threading protection? I really wonder how! How can GCC achieve this on every platform (especially embedded targets such as AVR, H8, ARM) without help from the runtime? (I haven't seen any dependencies to RTL functions in such case.) Is this implemented using interruption-transparent algorithms / atomic operations or does the above simply hold only for some specific platform? Daniel From brian@dessent.net Wed Mar 7 17:11:00 2007 From: brian@dessent.net (Brian Dessent) Date: Wed, 07 Mar 2007 17:11:00 -0000 Subject: libg2c.a missing in 4.1.1 References: <6491e1350703070822x63a7c795ge815c6219a8447b8@mail.gmail.com> Message-ID: <45EEEA84.2D9ECAF0@dessent.net> satyaakam goswami wrote: > Noticed libg2c.a is missing in /lib in 4.1.1 hierarchy , whats > the equivalent of libg2c.a in gcc 4.1.1 , any pointers . libg2c was part of g77, which was dropped in gcc 4.x. The replacement, gfortran, does not have any such library. The functions that used to be in that library are implemented as intrinsics, and so -lg2c should not be necessary (but see also -ff2c). Brian From satyaakam@gmail.com Wed Mar 7 21:27:00 2007 From: satyaakam@gmail.com (satyaakam goswami) Date: Wed, 07 Mar 2007 21:27:00 -0000 Subject: libg2c.a missing in 4.1.1 In-Reply-To: <45EEEA84.2D9ECAF0@dessent.net> References: <6491e1350703070822x63a7c795ge815c6219a8447b8@mail.gmail.com> <45EEEA84.2D9ECAF0@dessent.net> Message-ID: <6491e1350703070911q26b086ccsad3a36b23cbefcb3@mail.gmail.com> On 3/7/07, Brian Dessent wrote: > satyaakam goswami wrote: > > > Noticed libg2c.a is missing in /lib in 4.1.1 hierarchy , whats > > the equivalent of libg2c.a in gcc 4.1.1 , any pointers . > > libg2c was part of g77, which was dropped in gcc 4.x. The replacement, > gfortran, does not have any such library. The functions that used to be > in that library are implemented as intrinsics, and so -lg2c should not > be necessary (but see also -ff2c). do you mean we can use -lf2c instead of -lg2c Satya From michael.haubenwallner@salomon.at Wed Mar 7 22:47:00 2007 From: michael.haubenwallner@salomon.at (Michael Haubenwallner) Date: Wed, 07 Mar 2007 22:47:00 -0000 Subject: platform specific information for aix5.3 Message-ID: <1173303004.22557.25.camel@localhost> Hi, there's one more thing which IMO should be mentioned on the platform-specific site: On AIX 5.3 there is a bug where 'thread_creds_t' is a global variable instead of a typedef in /usr/include/sys/threads.h In case of C, the linker may give 'duplicate symbol' on this one. What can happen in case of C++, see http://www-128.ibm.com/developerworks/forums/dw_thread.jsp?forum=747&thread=119546&cat=72 The workaround is to define 'thread_creds_t' to nothing: -Dthread_creds_t= This only affects AIX 5.3, not AIX <= 5.2. According to IBM, the fix for this APAR IY90737 is incorporated into Service Pack 5300-05-04. Thanks, /haubi/ From dpgood@gmail.com Wed Mar 7 23:18:00 2007 From: dpgood@gmail.com (Dana Good) Date: Wed, 07 Mar 2007 23:18:00 -0000 Subject: Alarm callbacks on Windows with Gnu or MinGW? Message-ID: Please excuse me if this is the wrong location for this post - I looked long and hard before I posted, and would be happy to be redirected! I am using C++ in Eclipse with CDT and MinGW on a Windows machine. I'd prefer not to use VC++. I would like to implement a simple alarm callback, a la 'C', where I set a timer to go off and use a signal catcher to catch the interrupt/exception/signal/whatever. (as, on Unix/Linux, signal(SIG_ALRM, FPTR); alarm(nsec); where FPTR is a pointer to a function that will asynchronously handle the signal SIG_ALRM) I don't find support for SIG_ALRM in MinGW, though other signals are defined. My Googles have left me fairly convinced that I can't do this without including the VC++ libraries - is this true? Thanks, Dana Good From brian@dessent.net Wed Mar 7 23:37:00 2007 From: brian@dessent.net (Brian Dessent) Date: Wed, 07 Mar 2007 23:37:00 -0000 Subject: Alarm callbacks on Windows with Gnu or MinGW? References: Message-ID: <45EF483F.E35A0171@dessent.net> Dana Good wrote: > Please excuse me if this is the wrong location for this post - I > looked long and hard before I posted, and would be happy to be > redirected! You'd get better responses on the MinGW list. > I am using C++ in Eclipse with CDT and MinGW on a Windows machine. > I'd prefer not to use VC++. > > I would like to implement a simple alarm callback, a la 'C', where I > set a timer to go off and use a signal catcher to catch the > interrupt/exception/signal/whatever. For this you need to use the Win32 API. See for example CreateWaitableTimer(), SetWaitableTimer(), WaitForSingleObject(), CreateThread/_beginthreadex and so on. See MSDN for details, or the platform SDK. http://msdn2.microsoft.com/en-us/library/ms681924(VS.85).aspx http://msdn2.microsoft.com/en-us/library/ms686967(VS.85).aspx etc. > My Googles have left me fairly convinced that I can't do this without > including the VC++ libraries - is this true? These are the APIs provided by the operating system; they have nothing to do with Visual C++. The w32api package includes all the import libraries necessary to link against any of these Win32 API dlls. Brian From dpgood@gmail.com Thu Mar 8 00:59:00 2007 From: dpgood@gmail.com (Dana Good) Date: Thu, 08 Mar 2007 00:59:00 -0000 Subject: Alarm callbacks on Windows with Gnu or MinGW? In-Reply-To: <45EF483F.E35A0171@dessent.net> References: <45EF483F.E35A0171@dessent.net> Message-ID: Many thanks! On 3/7/07, Brian Dessent wrote: > Dana Good wrote: > > > Please excuse me if this is the wrong location for this post - I > > looked long and hard before I posted, and would be happy to be > > redirected! > > You'd get better responses on the MinGW list. > > > I am using C++ in Eclipse with CDT and MinGW on a Windows machine. > > I'd prefer not to use VC++. > > > > I would like to implement a simple alarm callback, a la 'C', where I > > set a timer to go off and use a signal catcher to catch the > > interrupt/exception/signal/whatever. > > For this you need to use the Win32 API. See for example > CreateWaitableTimer(), SetWaitableTimer(), WaitForSingleObject(), > CreateThread/_beginthreadex and so on. See MSDN for details, or the > platform SDK. > > http://msdn2.microsoft.com/en-us/library/ms681924(VS.85).aspx > http://msdn2.microsoft.com/en-us/library/ms686967(VS.85).aspx > etc. > > > My Googles have left me fairly convinced that I can't do this without > > including the VC++ libraries - is this true? > > These are the APIs provided by the operating system; they have nothing > to do with Visual C++. The w32api package includes all the import > libraries necessary to link against any of these Win32 API dlls. > > Brian > From baucom@msg.ucsf.edu Thu Mar 8 05:37:00 2007 From: baucom@msg.ucsf.edu (Albion Baucom) Date: Thu, 08 Mar 2007 05:37:00 -0000 Subject: Compiling gfortran Message-ID: Can anyone suggest how I can get gfortran to compile as part of gcc 4.1.2? I am trying to compile on a 64-bit Xeon based dual processor system running CentOS 4.4 running kernel version 2.6.9-42.0.2.ELsmp x86_64. My gcc configuration options are ./configure --prefix=/home2/baucom/Applications/gcc --enable- languages=c,c++,fortran --with-mpfr=/home2/baucom/Applications/mpfr -- with-gmp=/home2/baucom/Applications/gmp I am experiencing a problem with a certain "kinds.h" file. The error message is pasted below. I have done web searches on this and come across suggestions, none of which worked. Specifically I have made certain that gmp is specified at the command line when I configure, along with mpfr and set my LD_LIBRARY_PATH to point to the libraries, and even tried compiling gmp for 32-bit with the config option ABI=32. Any ideas? Thanks Albion make[2]: Entering directory `/mnt/home2/baucom/src/gcc-4.1.2/x86_64- unknown-linux-gnu/libgfortran' /bin/sh ../.././libgfortran/mk-kinds-h.sh '/home2/baucom/src/ gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc/gfortran -B/home2/baucom/ src/gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc/ -B/home2/baucom/ Applications/gcc/x86_64-unknown-linux-gnu/bin/ -B/home2/baucom/ Applications/gcc/x86_64-unknown-linux-gnu/lib/ -isystem /home2/baucom/ Applications/gcc/x86_64-unknown-linux-gnu/include -isystem /home2/ baucom/Applications/gcc/x86_64-unknown-linux-gnu/sys-include -I . - Wall -fno-repack-arrays -fno-underscoring ' > kinds.h || rm kinds.h ../.././libgfortran/mk-kinds-h.sh: Unknown type grep '^#' < kinds.h > kinds.inc /bin/sh: kinds.h: No such file or directory make[2]: *** [kinds.inc] Error 1 make[2]: Leaving directory `/mnt/home2/baucom/src/gcc-4.1.2/x86_64- unknown-linux-gnu/libgfortran' make[1]: *** [all-target-libgfortran] Error 2 make[1]: Leaving directory `/mnt/home2/baucom/src/gcc-4.1.2' make: *** [all] Error 2 From satyaakam@gmail.com Thu Mar 8 07:51:00 2007 From: satyaakam@gmail.com (satyaakam goswami) Date: Thu, 08 Mar 2007 07:51:00 -0000 Subject: errors while using -lgfortran instead of libg2c.a Message-ID: <6491e1350703072137v5ebda308sac1ed4f50de82699@mail.gmail.com> we getting undefined symbol:`d_sign', please suggest. /tsi71/pubref/liba/lnx86_gcc_ia32/liblapack.a /tsi71/pubref/liba/lnx86_gcc_ia32/libblas.a /tsi71/pubref/liba/lnx86_gcc_ia32/liblamatrix++.a -lm -lgfortran /tsi71/pubref/liba/lnx86_gcc_ia32/liblapack++.a(dtimmg.o): In function `dtimmg_': dtimmg.c:(.text+0xe47): undefined reference to `d_sign' dtimmg.c:(.text+0xf11): undefined reference to `d_sign' dtimmg.c:(.text+0x1004): undefined reference to `d_sign' dtimmg.c:(.text+0x10de): undefined reference to `d_sign' dtimmg.c:(.text+0x120d): undefined reference to `d_sign' Satya From vtorri@univ-evry.fr Thu Mar 8 09:57:00 2007 From: vtorri@univ-evry.fr (Vincent Torri) Date: Thu, 08 Mar 2007 09:57:00 -0000 Subject: order of directories passed with -L Message-ID: Hey, Suppose that I pass those arguments to gcc : -Lpath1 -llib1 -Lpath2 -llib2 -L path3 -llib3 In which directory(ies) will gcc search lib1, lib2 and lib3 ? (gcc man page didn't help me) thank you Vincent Torri From castillo@teisa.unican.es Thu Mar 8 10:07:00 2007 From: castillo@teisa.unican.es (Juan Castillo) Date: Thu, 08 Mar 2007 10:07:00 -0000 Subject: where can I get gcc optimizations information Message-ID: <200703081057.45511.castillo@teisa.unican.es> Hello everybody. I need some help with gcc optimizations and I don't know where I can get it. The objective of my work is to estimate how many machine instructions I can save in a program execution employing compiler optimizations. I am working with ARM architecture. Anyway, I have understood that main gcc optimizations are architecture-independent. In the gcc user's manual I have read that flags -O, -O1, -O2, -O3 and -Os activate different optimization flags (starting with "-f", I think), but not all of them are available individually. If I switch on all flags available individually for -O1 (-fdefer-pop, -fmerge-constants...) they have no effect in obtained machine code, but if I compile with -O1 option, there is a reduction of about 50% in machine instructions number with respect to basic compilation. With these results, I suppose that -O1 performs more actions that are not reported in any document I have found in The Internet. I have downloaded the gcc source-code but it is too difficult for me to understand it. My question is: where can I get full information about gcc optimizations and how they are performed? And another question: would be possible to get a benchmark or similar for compiler optimizations? That is, some set of programs that estimate the save that a compiler can achieve. I know it depends on the algotihms compiled, employed architecture and more (please, don't remember me that...). I just need an estimation. That would be great for my work. I hope your answer. Thank you very much. I really think you are developing a great job. From aph@redhat.com Thu Mar 8 11:00:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 08 Mar 2007 11:00:00 -0000 Subject: where can I get gcc optimizations information In-Reply-To: <200703081057.45511.castillo@teisa.unican.es> References: <200703081057.45511.castillo@teisa.unican.es> Message-ID: <17903.57444.43797.324340@zebedee.pink> Juan Castillo writes: > I need some help with gcc optimizations and I don't know where I > can get it. > > The objective of my work is to estimate how many machine > instructions I can save in a program execution employing compiler > optimizations. I am working with ARM architecture. Anyway, I have > understood that main gcc optimizations are > architecture-independent. > > In the gcc user's manual I have read that flags -O, -O1, -O2, -O3 > and -Os activate different optimization flags (starting with "-f", > I think), but not all of them are available individually. If I > switch on all flags available individually for -O1 (-fdefer-pop, > -fmerge-constants...) they have no effect in obtained machine code, > but if I compile with -O1 option, there is a reduction of about 50% > in machine instructions number with respect to basic compilation. > > With these results, I suppose that -O1 performs more actions that > are not reported in any document I have found in The Internet. I > have downloaded the gcc source-code but it is too difficult for me > to understand it. My question is: where can I get full information > about gcc optimizations and how they are performed? Full information is in the source. As Euclid (or someone else!) may once have said, "There is no royal road to mathematics". If you are really to understand, you'll have to get in there some time. However, some things will help you. -fverbose-asm produces a list of optimization passes. The dumps "-da" and "-fdump-tree-all" produce a lot of files, one per optimization pass, so you can see what each pass did. Once you know which pass does what, you can start to look at the code. > And another question: would be possible to get a benchmark or > similar for compiler optimizations? That is, some set of programs > that estimate the save that a compiler can achieve. I know it > depends on the algotihms compiled, employed architecture and more > (please, don't remember me that...). I just need an > estimation. That would be great for my work. SPEC is a standard, but it's unfree and therefore off-topic here. Andrew. From me@rupey.net Thu Mar 8 11:22:00 2007 From: me@rupey.net (Rupert Wood) Date: Thu, 08 Mar 2007 11:22:00 -0000 Subject: where can I get gcc optimizations information In-Reply-To: <200703081057.45511.castillo@teisa.unican.es> References: <200703081057.45511.castillo@teisa.unican.es> Message-ID: <023001c76170$f615e550$e241aff0$@net> Juan Castillo wrote: > And another question: would be possible to get a benchmark or similar for > compiler optimizations? That is, some set of programs that estimate the save > that a compiler can achieve. I know it depends on the algotihms compiled, > employed architecture and more (please, don't remember me that...). I just > need an estimation. That would be great for my work. You could try asking Scott Robert Ladd: he was developing a benchmark suite for his own acovea work (genetic search for optimal optimization settings): http://gcc.gnu.org/ml/gcc/2004-08/msg00664.html He did post an old version for download but I can't find the link now. Rup. ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ From jopen@gmx.net Thu Mar 8 12:16:00 2007 From: jopen@gmx.net (Sascha Alexander Jopen) Date: Thu, 08 Mar 2007 12:16:00 -0000 Subject: dump-translation-unit format Message-ID: <000101c76174$24c55040$6e4ff0c0$@net> Hi, I'm currently working on the output of gcc/g++ -fdump-translation-unit to do source code analysis. I found several references that the internal ast should include nodes for for, while and do constructs. But I can't find those nodes in the dumped files. Sometimes there are such FOR_STMT nodes when I compile large units, but when compiling a small test unit containing not much more than a for loop, this loop isn't included in the dump. Instead there is a GOTO_EXPR where I would expect the for loop. This holds for other loops and conditional expressions as well. All FOR_STMT nodes I encountered where not from my custom code, but from templates from system includes. Are there any optimizations done on the tree before dumping it, and how can I prevent this to get an unoptimized tree? Are there other possibilities to get those loop nodes? I need them to check whether function calls are done in loops or not. Without the bodies of loops I can get information about functions called from other functions using the chain links, but not whether they are called within loops. Another thing I don't understand is the following. This dumped function node contains two body definitions, one undefined and one with a proper node chain. Is this a dump error or has it special meaning? @1639 function_decl name: @2001 mngl: @2002 type: @2003 scpe: @812 srcp: char_traits.h:322 chan: @2004 note: member accs: pub args: @2005 body: undefined link: extern body: @2006 Maybe someone could help me or point me to other resources. Thanks in advance, Sascha Jopen From crazguy22@hotmail.com Thu Mar 8 12:30:00 2007 From: crazguy22@hotmail.com (Shane R) Date: Thu, 08 Mar 2007 12:30:00 -0000 Subject: Linux c++ opmization--- linux runs at half the speed of windows? Message-ID: Hi, I hope this is the appropriate forum. Please direct me to the correct one if it is not. I am trying to optimize a c++ application that I ported from a windows system to Linux. The app is a terminal based application that does some one time file io at the start then runs completely in memory. After the one time io the app runs successive timed epochs on the same data in Windows as Linux. The app is a program that runs some code for doing non-linear optmization (math stuff). The reason why I am posting is that I timed the time it takes for the application to complete an epoch. It take twice as long in Linux as windows?!?! My system is an Intel Centrino Duo with 2gigs of ram. The application is only using a fraction of available memory in windows and linux. The application is single-threaded in both. I am using Visual Studio 2003 in Windows and when I type gcc -v I get: Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-checking=release i486-linux-gnu Thread model: posix gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) I am currently using these g++ options: CFLAGS = -o3 -O3 -march=pentium4 -ffast-math -funroll-loops -Wall -Wno-return-type But I have tried every permutation of the above options to virtually no effect The average run time of an epoch in windows is about 3000 milliseconds while the average run time of an epoch in Linux is 6000! I don't know if it matters but I am doing calls to the rand() function in both my windows and linux apps. On another note does anyone have any experience with the Intel drop in replacement for GCC? Thanks in advance for any help, Shane _________________________________________________________________ Match.com - Click Here To Find Singles In Your Area Today! http://match.engb.msn.com/ From aph@redhat.com Thu Mar 8 15:01:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 08 Mar 2007 15:01:00 -0000 Subject: Linux c++ opmization--- linux runs at half the speed of windows? In-Reply-To: References: Message-ID: <17904.492.460648.266863@zebedee.pink> Shane R writes: > I hope this is the appropriate forum. Please direct me to the correct one if > it is not. > > I am trying to optimize a c++ application that I ported from a windows > system to Linux. OK. > The app is a terminal based application that does some one time file io at > the start then runs completely in memory. After the one time io the app runs > successive timed epochs on the same data in Windows as Linux. The app is a > program that runs some code for doing non-linear optmization (math stuff). > > The reason why I am posting is that I timed the time it takes for the > application to complete an epoch. It take twice as long in Linux as > windows?!?! That is fairly unusual. > My system is an Intel Centrino Duo with 2gigs of ram. The application is > only using a fraction of available memory in windows and linux. The > application is single-threaded in both. > > I am using Visual Studio 2003 in Windows and when I type gcc -v I get: > Target: i486-linux-gnu > Configured with: ../src/configure -v > --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr > --enable-shared --with-system-zlib --libexecdir=/usr/lib > --without-included-gettext --enable-threads=posix --enable-nls > --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu > --enable-libstdcxx-debug --enable-mpfr --enable-checking=release > i486-linux-gnu > Thread model: posix > gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) > > > > I am currently using these g++ options: > > CFLAGS = -o3 -O3 -march=pentium4 -ffast-math -funroll-loops -Wall > -Wno-return-type > > But I have tried every permutation of the above options to virtually no > effect > > The average run time of an epoch in windows is about 3000 milliseconds while > the average run time of an epoch in Linux is 6000! > > I don't know if it matters but I am doing calls to the rand() function in > both my windows and linux apps. It might matter, yes. I suspect that the right approach is to do some profiling. Make sure oprofile is installed, then sudo opcontrol --init sudo opcontrol --start sudo opcontrol --stop opreport -l Let us know how you get along. You might be surprised where the time goes. Andrew. From r.atwood@imperial.ac.uk Thu Mar 8 16:10:00 2007 From: r.atwood@imperial.ac.uk (Atwood, Robert C) Date: Thu, 08 Mar 2007 16:10:00 -0000 Subject: Linux c++ opmization--- linux runs at half the speed of windows? In-Reply-To: Message-ID: <2CB39EAF0E0EFF498ADEDA636B8C999F04C392B3@icex1.ic.ac.uk> > On another note does anyone have any experience with the > Intel drop in > replacement for GCC? > > Thanks in advance for any help, > > Shane Yes but not very good experience, perhaps mediocre. I had very annoying problems with a bug in the intel optimizer .. It seemed like my code was way faster, until I noticed that it was not giving the correct results, and observed that the optimizer was reducing precision when it should not. There was also some case where it kept optimizing a=b; b=c; into effectively a=b=c; not the same thing at all! THe recommended workaround was to reduce the optimization level , at which point it was no longer faster and I had lost my own time faffing about with it. Since then that bug was supposedly fixed in later release, but they lost my confidence and convinced me further that free software is the way to go, not only for political, but also practical reasons. From eschenb@cs.uni-frankfurt.de Thu Mar 8 17:10:00 2007 From: eschenb@cs.uni-frankfurt.de (Sven Eschenberg) Date: Thu, 08 Mar 2007 17:10:00 -0000 Subject: Linux c++ opmization--- linux runs at half the speed of windows? In-Reply-To: References: Message-ID: <45F035B0.1050809@cs.uni-frankfurt.de> Hi Shane, I am wondering if you are using large memory support in linux (since you got 2GB)? I am asking, because on my system I experienced the following strange behavior: Compiling a whole package, which is fairly big the compile time varies strongly between the setup of using large memory support and when not using it. As soon as I use large memory support the compile times grows by a factor between 2 and 3, I never did a profiling, what exactly causes the slow down, it just seems obvious that the large memory support causes a massive slowdown (certainly on memory access). I wonder if you are basically having the same problem. Maybe, after collecting some profiling data, you might come to the conclusion that memory access takes a lot of time, maybe you could check against a kernel without large memory support. I might be completely wrong, but it came across my mind, since you got 2 GB of RAM and might have large memory support enabled. Regards -Sven Shane R wrote: > Hi, > > I hope this is the appropriate forum. Please direct me to the correct > one if it is not. > > I am trying to optimize a c++ application that I ported from a windows > system to Linux. > The app is a terminal based application that does some one time file > io at the start then runs completely in memory. After the one time io > the app runs successive timed epochs on the same data in Windows as > Linux. The app is a program that runs some code for doing non-linear > optmization (math stuff). > > The reason why I am posting is that I timed the time it takes for the > application to complete an epoch. It take twice as long in Linux as > windows?!?! > > My system is an Intel Centrino Duo with 2gigs of ram. The application > is only using a fraction of available memory in windows and linux. The > application is single-threaded in both. > > I am using Visual Studio 2003 in Windows and when I type gcc -v I get: > Target: i486-linux-gnu > Configured with: ../src/configure -v > --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr > --enable-shared --with-system-zlib --libexecdir=/usr/lib > --without-included-gettext --enable-threads=posix --enable-nls > --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu > --enable-libstdcxx-debug --enable-mpfr --enable-checking=release > i486-linux-gnu > Thread model: posix > gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) From iant@google.com Thu Mar 8 17:12:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Thu, 08 Mar 2007 17:12:00 -0000 Subject: wrong-code in -ftree-ter on arm? In-Reply-To: <20070307.100454.131914938.kaminaga@sm.sony.co.jp> References: <20070306.170610.35008765.kaminaga@sm.sony.co.jp> <20070307.100454.131914938.kaminaga@sm.sony.co.jp> Message-ID: Hiroki Kaminaga writes: > From: Hiroki Kaminaga > > > > The attached codes, snipped from linux kernel source code produce > > wrong code above -O1. > > May I file this into bugzilla? Yes. At least, I don't see an obvious problem here. See http://gcc.gnu.org/bugs.html for everything we want to know. Thanks. Ian From iant@google.com Thu Mar 8 17:16:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Thu, 08 Mar 2007 17:16:00 -0000 Subject: G++ and constructors In-Reply-To: <45EEE953.3090409@informatik.uni-erlangen.de> References: <45EEE953.3090409@informatik.uni-erlangen.de> Message-ID: Daniel Lohmann writes: > John Love-Jensen schrieb: > > [...] Although you didn't ask for work-arounds, here's a work-around > > that works > > for GCC, but may not work in C++ in general*. > > GCC uses threading protection for static objects. > > So this variant of your routine, in GCC, should be thread safe: > > ---------------------------------------------------------------------- > > myclass* myclass::init_instance() // private: static > > { > > return new myclass(); > > } > > myclass* myclass::get_instance() // public: static > > { > > static myclass* instance = InitInstance(); > > return instance; > > } > > ---------------------------------------------------------------------- > > *GCC* does the threading protection? > > I really wonder how! > > How can GCC achieve this on every platform (especially embedded > targets such as AVR, H8, ARM) without help from the runtime? (I > haven't seen any dependencies to RTL functions in such case.) > > Is this implemented using interruption-transparent algorithms / atomic > operations or does the above simply hold only for some specific > platform? Processor specific details can be found in libstdc++-v3/config/cpu. That code is used by the guard code in libstdc++-v3/libsupc++. Ian From iant@google.com Thu Mar 8 17:26:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Thu, 08 Mar 2007 17:26:00 -0000 Subject: order of directories passed with -L In-Reply-To: References: Message-ID: Vincent Torri writes: > Suppose that I pass those arguments to gcc : > > -Lpath1 -llib1 -Lpath2 -llib2 -L path3 -llib3 > > In which directory(ies) will gcc search lib1, lib2 and lib3 ? > > (gcc man page didn't help me) The -L and -l options are simply passed to the linker. So, look at the linker documentation. The answer here is that all the -L options are gathered together. The linker will search for the -l options in all of the -L options, even the ones that follow the -l option. Ian From iant@google.com Thu Mar 8 19:14:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Thu, 08 Mar 2007 19:14:00 -0000 Subject: Folding built-in functions In-Reply-To: <20070306181652.9029.qmail@web27414.mail.ukl.yahoo.com> References: <20070306181652.9029.qmail@web27414.mail.ukl.yahoo.com> Message-ID: ranjith kumar writes: > Gcc manuals says all builtin functions are folded in > tree optimization passe(given below) that are run > after gimplification > http://gcc.gnu.org/onlinedocs/gccint/Tree_002dSSA-passes.html#Tree_002dSSA-passes > > >Folding built-in functions > > >This pass simplifies built-in functions, as > applicable, >with constant arguments or with > inferrable string >lengths. It is located in > tree-ssa-ccp.c and is >described by > pass_fold_builtins. > > 1)I find _builtin* functions in mmintrin.h, > xmmintrin.h and emmintrin.h........ > I think 'Folding built-in functions' is the pass that > replaces _builtin functions when a program is > compiled. Am I right? Sort of but not really. The __builtin* functions used by mmintrin.h and friends are not generally folded. They may be folded in some cases if they are called with constant arguments, as in the description of the pass. Those functions are usually expanded when translating GIMPLE into RTL. The code to do the expansion of these particular functions is ix86_expand_builtin. That function looks at the __builtin function code and generates the appropriate RTL. Ian From lemings@roguewave.com Thu Mar 8 20:10:00 2007 From: lemings@roguewave.com (Eric Lemings) Date: Thu, 08 Mar 2007 20:10:00 -0000 Subject: Strange Behavior Message-ID: Greetings, While writing a generic C++ algoririthm for base64 encoding, I came across some very strange behavior. If you take the following program (admittedly verbose for debugging purposes) and test it on some data, say the logo image from www.google.com, you may notice (depending on your platform) that the byte at offset 0230 (octal) is either read in with an incorrect value or is skipped entirely. template < class InputItor, class OutputItor > OutputItor encode (InputItor first, InputItor last, OutputItor out) { static const char s [] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789+/"; while (first != last) { unsigned char uc0 = *first++; int i0 = (uc0>>2) & 0x3f; char c0 = s [i0]; *out++ = c0; unsigned char uc1 = (first == last? 0: *first++); int i1 = ((uc0<<4) + (uc1>>4)) & 0x3f; char c1 = s [i1]; *out++ = c1; bool eof = (first == last); unsigned char uc2 = (eof? 0: *first++); int i2 = ((uc1<<2) + (uc2>>6)) & 0x3f; char c2 = (eof? '=': s [i2]); *out++ = c2; int i3 = uc2 & 0x3f; char c3 = (first == last? '=': s [i3]); *out++ = c3; } return out; } #include #include #include #include #include using namespace std; extern int main () { ifstream in ("logo.gif", ios_base::binary); istream_iterator< char > first (in); istream_iterator< char > last; string s; encode (first, last, back_inserter (s)); cout << s; return 0; } You can boil the while loop down to it's basic read operations and still see the same results. while (first != last) { unsigned char uc0 = *first++; unsigned char uc1 = (first == last? 0: *first++); unsigned char uc2 = (first == last? 0: *first++); } Just for sake of sanity, I wrote a quick version of the algorithm in C. Naturally, this program behaves as it should. #include #include extern int main (int argc, char* argv []) { FILE* in = fopen ("logo.gif", "rb"); if (in == NULL) { perror (argv[0]); exit (EXIT_FAILURE); } const char s [] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789+/"; while (!feof (in)) { unsigned char uc0 = fgetc (in); int i0 = (uc0>>2) & 0x3f; char c0 = s [i0]; putc (c0, stdout); unsigned char uc1 = (feof (in)? 0: fgetc (in)); int i1 = ((uc0<<4) + (uc1>>4)) & 0x3f; char c1 = s [i1]; putc (c1, stdout); int eof = feof (in); unsigned char uc2 = (eof? 0: fgetc (in)); int i2 = ((uc1<<2) + (uc2>>6)) & 0x3f; char c2 = (eof? '=': s [i2]); putc (c2, stdout); int i3 = uc2 & 0x3f; char c3 = (feof (in)? '=': s [i3]); putc (c3, stdout); } fclose (in); return 0; } If anyone can shed some light on the strange behavior in the C++ program, I would appreciate it very much. Thanks, Eric. From eljay@adobe.com Thu Mar 8 20:48:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Thu, 08 Mar 2007 20:48:00 -0000 Subject: Strange Behavior In-Reply-To: Message-ID: Hi Eric, The istream_iterator uses >> operator. You have the std::ios_base::skipws flag set in your ifstream named 'in' (since the ios_base::skipws is set by default, and you haven't cleared it). Add a line to your main() to clear the skipws flag: ifstream in ("logo.gif", ios_base::binary);: in.unsetf(ios_base::skipws); // <-- Add this line. The results still differ between your C++ and your C version. I'm not sure if the bug in your C++ or C version, though. HTH, --Eljay From mwgong@cs.utoronto.ca Thu Mar 8 21:39:00 2007 From: mwgong@cs.utoronto.ca (Michael Gong) Date: Thu, 08 Mar 2007 21:39:00 -0000 Subject: what does it mean: "line out of range" ? Message-ID: <034b01c761c3$1291a3c0$9e6511ac@mwgong> Hi, I have a file : foo.c, which is like: #line 20 "./.acc_dir/c-typeck.c" int main() { #line 39309 "./.acc_dir/c-typeck.c" <-- if change to 32767, no warning message below return 3; } >gcc -c foo.c -pedantic ./.acc_dir/c-typeck.c:22:7: warning: line number out of range. It seems that when the line number > 32767, which is the max of short int, the warning message is issued. So I assume gcc uses a short int to store the line number. Is it appropriate ? According to C99, # line digit-sequence new-line causes the implementation to behave as if the following sequence of source lines begins with a source line that has a line number as specified by the digit sequence (interpreted as a decimal integer). The digit sequence shall not specify zero, nor a number greater than 2147483647. there should not be such a limit of 32767. Can anyone clarify it ? Thanks. Mike From baucom@msg.ucsf.edu Thu Mar 8 21:49:00 2007 From: baucom@msg.ucsf.edu (Albion Baucom) Date: Thu, 08 Mar 2007 21:49:00 -0000 Subject: Compiling gfortran In-Reply-To: References: Message-ID: Well, it turns out that there was a path issue with GMP that makes GCC read one GMP header, and read another library to cause mk-kinds- h.sh to fail due to the following problems according to the MPFR website at this website http://www.mpfr.org/faq.html (3. I get undefined reference to __gmp_get_memory_functions). Redefining C_INCLUDE_PATH, LD_LIBRARY_PATH, and LIBRARY_PATH solved _that_ problem. Unfortunately I STILL can't compile gfortran. Why does this have to be so difficult on an Intel based computer? Very frustrating. On Mar 7, 2007, at 4:59 PM, Albion Baucom wrote: > Can anyone suggest how I can get gfortran to compile as part of gcc > 4.1.2? > > I am trying to compile on a 64-bit Xeon based dual processor system > running CentOS 4.4 running kernel version 2.6.9-42.0.2.ELsmp > x86_64. My gcc configuration options are > > ./configure --prefix=/home2/baucom/Applications/gcc --enable- > languages=c,c++,fortran --with-mpfr=/home2/baucom/Applications/mpfr > --with-gmp=/home2/baucom/Applications/gmp > > I am experiencing a problem with a certain "kinds.h" file. The > error message is pasted below. I have done web searches on this and > come across suggestions, none of which worked. Specifically I have > made certain that gmp is specified at the command line when I > configure, along with mpfr and set my LD_LIBRARY_PATH to point to > the libraries, and even tried compiling gmp for 32-bit with the > config option ABI=32. > > Any ideas? > > Thanks > > Albion > > make[2]: Entering directory `/mnt/home2/baucom/src/gcc-4.1.2/x86_64- > unknown-linux-gnu/libgfortran' > /bin/sh ../.././libgfortran/mk-kinds-h.sh '/home2/baucom/src/ > gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc/gfortran -B/home2/ > baucom/src/gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc/ -B/home2/ > baucom/Applications/gcc/x86_64-unknown-linux-gnu/bin/ -B/home2/ > baucom/Applications/gcc/x86_64-unknown-linux-gnu/lib/ -isystem / > home2/baucom/Applications/gcc/x86_64-unknown-linux-gnu/include - > isystem /home2/baucom/Applications/gcc/x86_64-unknown-linux-gnu/sys- > include -I . -Wall -fno-repack-arrays -fno-underscoring ' > kinds.h > || rm kinds.h > ../.././libgfortran/mk-kinds-h.sh: Unknown type > grep '^#' < kinds.h > kinds.inc > /bin/sh: kinds.h: No such file or directory > make[2]: *** [kinds.inc] Error 1 > make[2]: Leaving directory `/mnt/home2/baucom/src/gcc-4.1.2/x86_64- > unknown-linux-gnu/libgfortran' > make[1]: *** [all-target-libgfortran] Error 2 > make[1]: Leaving directory `/mnt/home2/baucom/src/gcc-4.1.2' > make: *** [all] Error 2 From baucom@msg.ucsf.edu Fri Mar 9 06:05:00 2007 From: baucom@msg.ucsf.edu (Albion Baucom) Date: Fri, 09 Mar 2007 06:05:00 -0000 Subject: More gfortran Compiling Problems Message-ID: <3A11FA03-4756-4621-A4E7-5DE4657667E7@msg.ucsf.edu> After solving my last problem with GMP and gfortran compilation, I am now encountering another issue shortly after the last. This issue has fewer web links and looks to be even more obscure. If you hadn't read my last post about my on-going drudgery of compiling here are the details: I am trying to compile gfortran on a 64-bit Xeon based dual processor system running CentOS 4.4 running kernel version 2.6.9-42.0.2.ELsmp x86_64. My gcc configuration options are ./configure --prefix=/home2/baucom/Applications/gcc --enable- languages=c,c++,fortran --with-mpfr=/home2/baucom/Applications/mpfr -- with-gmp=/home2/baucom/Applications/gmp Now I encounter errors with what appears to be type definitions which are listed below. Any suggestions? Albion /home2/baucom/src/gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc/xgcc -B/ home2/baucom/src/gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc/ -B/ home2/baucom/Applications/gcc/x86_64-unknown-linux-gnu/bin/ -B/home2/ baucom/Applications/gcc/x86_64-unknown-linux-gnu/lib/ -isystem /home2/ baucom/Applications/gcc/x86_64-unknown-linux-gnu/include -isystem / home2/baucom/Applications/gcc/x86_64-unknown-linux-gnu/sys-include - DHAVE_CONFIG_H -I. -I../.././libgfortran -I. -iquote../.././ libgfortran/io -I../.././libgfortran/../gcc -I../.././libgfortran/../ gcc/config -I../../host-x86_64-unknown-linux-gnu/gcc -D_GNU_SOURCE - std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style- definition -Wextra -Wwrite-strings -O2 -g -O2 -c ../.././libgfortran/ runtime/compile_options.c -fPIC -DPIC -o .libs/compile_options.o In file included from ../.././libgfortran/runtime/compile_options.c:32: ../.././libgfortran/libgfortran.h:205: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'gfc_charlen_type' ../.././libgfortran/libgfortran.h:273: error: expected specifier- qualifier-list before 'GFC_INTEGER_4' ../.././libgfortran/libgfortran.h:274: error: expected specifier- qualifier-list before 'GFC_INTEGER_8' ../.././libgfortran/libgfortran.h:278: error: expected specifier- qualifier-list before 'GFC_REAL_4' ../.././libgfortran/libgfortran.h:279: error: expected specifier- qualifier-list before 'GFC_REAL_8' ../.././libgfortran/libgfortran.h:286: error: expected specifier- qualifier-list before 'GFC_COMPLEX_4' ../.././libgfortran/libgfortran.h:287: error: expected specifier- qualifier-list before 'GFC_COMPLEX_8' ../.././libgfortran/libgfortran.h:294: error: expected specifier- qualifier-list before 'GFC_LOGICAL_4' ../.././libgfortran/libgfortran.h:295: error: expected specifier- qualifier-list before 'GFC_LOGICAL_8' ../.././libgfortran/libgfortran.h:476: error: expected ')' before 'char' ../.././libgfortran/libgfortran.h:477: error: 'gfc_itoa' undeclared here (not in a function) ../.././libgfortran/libgfortran.h:477: warning: type defaults to 'int' in declaration of 'gfc_itoa' ../.././libgfortran/libgfortran.h:479: error: expected ')' before 'char' ../.././libgfortran/libgfortran.h:480: error: 'xtoa' undeclared here (not in a function) ../.././libgfortran/libgfortran.h:480: warning: type defaults to 'int' in declaration of 'xtoa' ../.././libgfortran/libgfortran.h:570: warning: parameter names (without types) in function declaration .... From iant@google.com Fri Mar 9 06:56:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Fri, 09 Mar 2007 06:56:00 -0000 Subject: what does it mean: "line out of range" ? In-Reply-To: <034b01c761c3$1291a3c0$9e6511ac@mwgong> References: <034b01c761c3$1291a3c0$9e6511ac@mwgong> Message-ID: "Michael Gong" writes: > I have a file : foo.c, which is like: > > #line 20 "./.acc_dir/c-typeck.c" > int main() { > > #line 39309 "./.acc_dir/c-typeck.c" <-- if change to 32767, > no warning message below > return 3; > } > > > >gcc -c foo.c -pedantic > ./.acc_dir/c-typeck.c:22:7: warning: line number out of range. > > > It seems that when the line number > 32767, which is the max of short > int, the warning message is issued. So I assume gcc uses a short int > to store the line number. No. You will notice that you only get the warning with -pedantic. gcc is warning because C89 has a limit of 32767. > According to C99, > > # line digit-sequence new-line > > causes the implementation to behave as if the following sequence of > source lines begins with a source line that has a line number as > specified by the digit sequence (interpreted as a decimal > integer). The digit sequence shall not specify zero, nor a number > greater than 2147483647. Yes, C99 raised the limit. If you compile with -std=c99 or -std=gnu99, you will not get the warning. gcc defaults to gnu89 mode. Ian From manish_baphna@yahoo.com Fri Mar 9 10:14:00 2007 From: manish_baphna@yahoo.com (Manish Baphna) Date: Fri, 09 Mar 2007 10:14:00 -0000 Subject: MAC Machine : Compilation Issue Message-ID: <493939.63327.qm@web38915.mail.mud.yahoo.com> Hi , I am facing one strange problem ... I have two MAC machines A and B . Both have same versions of gcc/bin utils/ld gcc version 3.3.5 (Debian 1:3.3.5-13) GNU ld version 2.15 I have been trying to bulid some kernel for powerPC on these for e300/e500/e600 core. Now on 'A' everything builds on 'B' e300/e500 builds but e600 comes out with this error kernelPath/cpu/e600/e600.S:2119: Error: Unrecognized opcode: `dcba' While buliding kernel the only noticable difference is that there is this warning which comes while building (for each component) Warning: File `kernelPath/kernel_defs.h' has modification time 4.8e+02 s in the future and the other diffence is in the uname which for the local MAC machine is for A : Linux A 2.6.8-customsmp2 #1 SMP for B : Linux B 2.6.8-powerpc-smp I am surprised at this behavior. Gcc/binUtils versions are same , machines are natively MAC then why two different behaviors ? Any help would be greatly appreciated. Best Regards, Manish ____________________________________________________________________________________ Get your own web address. Have a HUGE year through Yahoo! Small Business. http://smallbusiness.yahoo.com/domains/?p=BESTDEAL From dreams_arpit@yahoo.co.in Fri Mar 9 11:15:00 2007 From: dreams_arpit@yahoo.co.in (arpit jain) Date: Fri, 09 Mar 2007 11:15:00 -0000 Subject: gnat-gcc for hp-ux Message-ID: <11416.23788.qm@web8411.mail.in.yahoo.com> Hiiii Can anyone tell me: 1. Which is the gcc (GNAT)version on HP-UX-10.2 that supports ADA language? 2. Where to find the rpm(binary) package for the same? Thanks Arpit __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/ From aph@redhat.com Fri Mar 9 12:43:00 2007 From: aph@redhat.com (Andrew Haley) Date: Fri, 09 Mar 2007 12:43:00 -0000 Subject: MAC Machine : Compilation Issue In-Reply-To: <493939.63327.qm@web38915.mail.mud.yahoo.com> References: <493939.63327.qm@web38915.mail.mud.yahoo.com> Message-ID: <17905.16832.15442.223565@zebedee.pink> Manish Baphna writes: > Hi , > > I am facing one strange problem ... > > I have two MAC machines A and B . Both have same > versions of gcc/bin utils/ld > > gcc version 3.3.5 (Debian 1:3.3.5-13) > GNU ld version 2.15 > > > I have been trying to bulid some kernel for powerPC on > these for e300/e500/e600 core. > > Now on 'A' everything builds > on 'B' e300/e500 builds but e600 comes out with this > error > > kernelPath/cpu/e600/e600.S:2119: Error: Unrecognized > opcode: `dcba' > > While buliding kernel the only noticable difference is > that there is this warning > which comes while building (for each component) > > Warning: File `kernelPath/kernel_defs.h' has > modification time 4.8e+02 s in the future > > and the other diffence is in the uname which for the > local MAC machine is > for A : Linux A 2.6.8-customsmp2 #1 SMP > for B : Linux B 2.6.8-powerpc-smp > > > I am surprised at this behavior. Gcc/binUtils versions > are same , machines are natively MAC then > why two different behaviors ? > > Any help would be greatly appreciated. This isn't really a gcc issue. kernelPath/cpu/e600/e600.S is an assembly language file, and the message is coming from the assembler. Better ask the questions on a kernel list, or a binutils list. Andrew. From Vladimir.Simonov@acronis.com Fri Mar 9 12:55:00 2007 From: Vladimir.Simonov@acronis.com (Vladimir Simonov) Date: Fri, 09 Mar 2007 12:55:00 -0000 Subject: gcc forgets to decrease esp after function call Message-ID: <45F15674.9000701@acronis.com> Hi all, Compiling some complex templated & inlined C++ code by gcc 4.1.1/4.1.2 I've met a problem with -O2 optimization. Objdump'ed text is below. In line 30 the code calls method which returns object via shadow pointer(in %esp). Calling function has "ret 4" at the end as it should be. But the problem code does not have "sub 0x4,%esp" to fix esp after the call. Obviously, codegenerator knows about calling function prototype(it creates shadow parameter). But by some reason it does not emit "sub 0x4,%esp" and uses esp in line 41 as if esp's value is not changed by called in line 30 function. If I "sub 0x4,%esp" in line 33 in gdb all is working fine. Any hints about workarround the problem will be very appritiated. Best regards Vladimir Simonov ----------------------------------------------- 00000000 : 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 57 push %edi 4: 56 push %esi 5: 53 push %ebx 6: 83 ec 3c sub $0x3c,%esp 9: 8b 45 08 mov 0x8(%ebp),%eax c: e8 fc ff ff ff call d d: R_386_PC32 __i686.get_pc_thunk.bx 11: 81 c3 02 00 00 00 add $0x2,%ebx 13: R_386_GOTPC _GLOBAL_OFFSET_TABLE_ #include "pragmas.h" FORCE_INLINE static typename PrototypeAnalyser::ReturnType Call(ObjectType* object, Func function, const ArgumentsType&) { return (object->*function)(); 17: 8b 10 mov (%eax),%edx 19: 8b 72 cc mov 0xffffffcc(%edx),%esi 1c: 8d 55 d4 lea 0xffffffd4(%ebp),%edx 1f: 89 55 d0 mov %edx,0xffffffd0(%ebp) 22: 01 f0 add %esi,%eax 24: 8b 10 mov (%eax),%edx 26: 89 44 24 04 mov %eax,0x4(%esp) 2a: 8b 45 d0 mov 0xffffffd0(%ebp),%eax 2d: 89 04 24 mov %eax,(%esp) 30: ff 52 08 call *0x8(%edx) LARGE AMOUNT OF INLINED TEMPLATED CODE } }; 33: 8b 4d 14 mov 0x14(%ebp),%ecx 36: 85 c9 test %ecx,%ecx 38: 74 7c je b6 <> } void* operator new(size_t itemSize) { char* mem = reinterpret_cast(FomatikAlloc(itemSize)); 3a: 8b 45 d8 mov 0xffffffd8(%ebp),%eax 3d: 8d 7c 00 18 lea 0x18(%eax,%eax,1),%edi 41: 89 3c 24 mov %edi,(%esp) 44: e8 fc ff ff ff call 45: R_386_PLT32 MyAlloc From aph@redhat.com Fri Mar 9 13:23:00 2007 From: aph@redhat.com (Andrew Haley) Date: Fri, 09 Mar 2007 13:23:00 -0000 Subject: gcc forgets to decrease esp after function call In-Reply-To: <45F15674.9000701@acronis.com> References: <45F15674.9000701@acronis.com> Message-ID: <17905.22833.766154.45450@zebedee.pink> Vladimir Simonov writes: > Compiling some complex templated & inlined C++ code by gcc > 4.1.1/4.1.2 I've met a problem with -O2 optimization. Objdump'ed > text is below. > > In line 30 the code calls method which returns object via shadow > pointer(in %esp). Calling function has "ret 4" at the end as it > should be. But the problem code does not have "sub 0x4,%esp" to > fix esp after the call. > > Obviously, codegenerator knows about calling function prototype(it > creates shadow parameter). But by some reason it does not emit > "sub 0x4,%esp" and uses esp in line 41 as if esp's value is not > changed by called in line 30 function. If I "sub 0x4,%esp" in line > 33 in gdb all is working fine. > > Any hints about workarround the problem will be very appritiated. I don't understand what you're complaining about. The stack pointer is not adjusted anywhere in the code you posted, except for the > 6: 83 ec 3c sub $0x3c,%esp at the beginning. The generated code uses offsets from the stack pointer, which doesn't change. Where is esp's value changed by the "called in line 30 function"? Please show it. Andrew. From Vladimir.Simonov@acronis.com Fri Mar 9 13:50:00 2007 From: Vladimir.Simonov@acronis.com (Vladimir Simonov) Date: Fri, 09 Mar 2007 13:50:00 -0000 Subject: gcc forgets to decrease esp after function call In-Reply-To: <17905.22833.766154.45450@zebedee.pink> References: <45F15674.9000701@acronis.com> <17905.22833.766154.45450@zebedee.pink> Message-ID: <45F15FDE.8010700@acronis.com> Hi, Here is gdb session dump. 0xb2e13570 is start of called function 0xb2e135a5 is the end. You can see "ret $0x4" at the end. But the caller doesn't fixups it. BTW. The called function also calls function returning object via shadow parameter. And we see correct "sub $0x4,%esp" in 0xb2e135a1. Best regards Vladimir Simonov ------------------ 0xb2e13570 <+0>: mov 0x8(%esp),%eax 0xb2e13574 <+4>: mov (%eax),%ecx 0xb2e13576 <+6>: add 0xffffffe4(%ecx),%eax 0xb2e13579 <+9>: mov %eax,0x8(%esp) 0xb2e1357d <+13>: jmp 0xb2e13580 <> 0xb2e1357f <+15>: nop 0xb2e13580 <+0>: push %ebp 0xb2e13581 <+1>: mov %esp,%ebp 0xb2e13583 <+3>: push %esi 0xb2e13584 <+4>: sub $0x14,%esp 0xb2e13587 <+7>: mov 0xc(%ebp),%eax 0xb2e1358a <+10>: mov 0x8(%ebp),%esi 0xb2e1358d <+13>: mov 0x4(%eax),%eax 0xb2e13590 <+16>: mov (%eax),%edx 0xb2e13592 <+18>: mov %eax,0x4(%esp) 0xb2e13596 <+22>: mov %esi,(%esp) 0xb2e13599 <+25>: call *0xc(%edx) 0xb2e1359c <+28>: mov %esi,%eax 0xb2e1359e <+30>: mov 0xfffffffc(%ebp),%esi 0xb2e135a1 <+33>: sub $0x4,%esp 0xb2e135a4 <+36>: leave 0xb2e135a5 <+37>: ret $0x4 Andrew Haley wrote: > Vladimir Simonov writes: > > > Compiling some complex templated & inlined C++ code by gcc > > 4.1.1/4.1.2 I've met a problem with -O2 optimization. Objdump'ed > > text is below. > > > > In line 30 the code calls method which returns object via shadow > > pointer(in %esp). Calling function has "ret 4" at the end as it > > should be. But the problem code does not have "sub 0x4,%esp" to > > fix esp after the call. > > > > Obviously, codegenerator knows about calling function prototype(it > > creates shadow parameter). But by some reason it does not emit > > "sub 0x4,%esp" and uses esp in line 41 as if esp's value is not > > changed by called in line 30 function. If I "sub 0x4,%esp" in line > > 33 in gdb all is working fine. > > > > Any hints about workarround the problem will be very appritiated. > > I don't understand what you're complaining about. The stack pointer > is not adjusted anywhere in the code you posted, except for the > > > 6: 83 ec 3c sub $0x3c,%esp > > at the beginning. The generated code uses offsets from the stack > pointer, which doesn't change. Where is esp's value changed by the > "called in line 30 function"? Please show it. > > Andrew. > From jopen@gmx.net Fri Mar 9 14:14:00 2007 From: jopen@gmx.net (Sascha Alexander Jopen) Date: Fri, 09 Mar 2007 14:14:00 -0000 Subject: dump-translation-unit format Message-ID: <000301c76251$e7081c90$b51855b0$@net> Hi, I'm currently working on the output of gcc/g++ -fdump-translation-unit to do source code analysis. I found several references that the internal ast should include nodes for for, while and do constructs. But I can't find those nodes in the dumped files. Sometimes there are such FOR_STMT nodes when I compile large units, but when compiling a small test unit containing not much more than a for loop, this loop isn't included in the dump. Instead there is a GOTO_EXPR where I would expect the for loop. This holds for other loops and conditional expressions as well. All FOR_STMT nodes I encountered where not from my custom code, but from templates from system includes. Are there any optimizations done on the tree before dumping it, and how can I prevent this to get an unoptimized tree? Are there other possibilities to get those loop nodes? I need them to check whether function calls are done in loops or not. Without the bodies of loops I can get information about functions called from other functions using the chain links, but not whether they are called within loops. Another thing I don't understand is the following. This dumped function node contains two body definitions, one undefined and one with a proper node chain. Is this a dump error or has it special meaning? @1639 function_decl name: @2001 mngl: @2002 type: @2003 scpe: @812 srcp: char_traits.h:322 chan: @2004 note: member accs: pub args: @2005 body: undefined link: extern body: @2006 Maybe someone could help me or point me to other resources. Thanks in advance, Sascha Jopen From mtrudel@gmx.ch Fri Mar 9 15:36:00 2007 From: mtrudel@gmx.ch (Marco Trudel) Date: Fri, 09 Mar 2007 15:36:00 -0000 Subject: --with-sysroot and --with-build-sysroot In-Reply-To: <45D96513.1080800@gmx.ch> References: <45D96513.1080800@gmx.ch> Message-ID: <45F16BD4.3050706@gmx.ch> Anyone? Marco Trudel wrote: > Hey all > > I don't really understand the meaning and difference of --with-sysroot > and --with-build-sysroot. From http://gcc.gnu.org/install/configure.html: > > > --with-sysroot=dir > > Tells GCC to consider dir as the root of a tree that contains a > > (subset of) the root filesystem of the target operating system. > > The GCC that is used to compile the current GCC source or the final > compiled GCC later at runtime? I assume for both. > > > > Target > > system headers, libraries and run-time object files will be searched > > in there. > > I'm compiling a build=i686-pc-linux-gnu host=i686-pc-linux-gnu > target=i686-pc-linux-gnu. I put glibc and glibc-devel into sysroot. This > worked with GCC 4.2 but fails with GCC 4.3 because "linux/limits.h" > can't be found [1]. > I'd say GCC 4.3 does the correct thing but how then was GCC 4.2 able to > compile the setup? I always assumed that "--with-sysroot" is for the > created compiler and "--with-build-sysroot" for the compiler compiling > the new compiler. > > Also I'm doing a build=i686-pc-linux-gnu host=i686-pc-mingw32 > target=i686-pc-linux-gnu compilation with also --with-sysroot set and > containing glibc and glibc-devel. That works with GCC 4.2 and GCC 4.3. I > would have assumed that GCC 4.3 also fails because it already fails for > a host=i686-pc-linux-gnu. > > > > --with-build-sysroot=dir > > Tells GCC to consider dir as the system root (see --with-sysroot) > > while building target libraries, instead of the directory specified > > with --with-sysroot. > > So this overwrites --with-sysroot for target libraries. What is > --with-sysroot then left to be used for? target binaries? Other things? > > > > This option is only useful when you are already > > using --with-sysroot. You can use --with-build-sysroot when you are > > configuring with --prefix set to a directory that is different from > > the one in which you are installing GCC and your target libraries. > > So assumed I have: > --prefix=/home/me/gcc-tmp > --with-sysroot=/home/me/gcc-tmp/sysroot > > But will finally install it into /home/me/gcc. What do I have to set > --with-build-sysroot to? What for? The sysroot will be found relative to > the GCC binaries because it is a subdirectory of the prefix. > > > > This option affects the system root for the compiler used to build > > target libraries (which runs on the build system); it does not affect > > the compiler which is used to build GCC itself. > > And --with-sysroot is used for both? Then for my setup (having sys-root > as a subdir of prefix) makes --with-build-sysroot superfluous? > Where then makes --with-build-sysroot sense? Assumed I do: > --prefix=/home/me/gcc-tmp > --with-sysroot=/home/me/sysroot > Won't it be found absolutely when moving gcc to /home/me/gcc? Or do I > still have to set build-sysroot to /home/me/sysroot? > > > thanks > Marco > > [1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30832 > From iant@google.com Fri Mar 9 15:43:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Fri, 09 Mar 2007 15:43:00 -0000 Subject: dump-translation-unit format In-Reply-To: <000301c76251$e7081c90$b51855b0$@net> References: <000301c76251$e7081c90$b51855b0$@net> Message-ID: "Sascha Alexander Jopen" writes: > I'm currently working on the output of gcc/g++ -fdump-translation-unit to do > source code analysis. I found several references that the internal ast > should include nodes for for, while and do constructs. But I can't find > those nodes in the dumped files. Sometimes there are such FOR_STMT nodes > when I compile large units, but when compiling a small test unit containing > not much more than a for loop, this loop isn't included in the dump. Instead > there is a GOTO_EXPR where I would expect the for loop. This holds for other > loops and conditional expressions as well. All FOR_STMT nodes I encountered > where not from my custom code, but from templates from system includes. > > Are there any optimizations done on the tree before dumping it, and how can > I prevent this to get an unoptimized tree? Are there other possibilities to > get those loop nodes? I need them to check whether function calls are done > in loops or not. Without the bodies of loops I can get information about > functions called from other functions using the chain links, but not whether > they are called within loops. Which version of gcc are you using? In mainline -fdump-translation-unit just dumps the global declarations. If you want to see FOR_STMT nodes, you need -fdump-tree-original. But that is pretty unsatisfactory these days since for_stmt nodes are not dumped in a useful way. And that only happens for C++; for C FOR_STMT nodes are never generated. > Another thing I don't understand is the following. This dumped function node > contains two body definitions, one undefined and one with a proper node > chain. Is this a dump error or has it special meaning? > > @1639 function_decl name: @2001 mngl: @2002 type: @2003 > scpe: @812 srcp: char_traits.h:322 > chan: @2004 note: member accs: pub > args: @2005 body: undefined > link: extern body: @2006 > > Maybe someone could help me or point me to other resources. The tree dump code prints out "body: undefined" for an external function which is not to be compiled by itself. But such a function can still have a body; this will be the case for a C++ inline function. This is somewhat confusing. Ian From Vladimir.Simonov@acronis.com Fri Mar 9 15:59:00 2007 From: Vladimir.Simonov@acronis.com (Vladimir Simonov) Date: Fri, 09 Mar 2007 15:59:00 -0000 Subject: gcc forgets to decrease esp after function call In-Reply-To: <17905.28252.856544.931176@zebedee.pink> References: <45F15674.9000701@acronis.com> <17905.22833.766154.45450@zebedee.pink> <45F1681A.6030307@acronis.com> <17905.28252.856544.931176@zebedee.pink> Message-ID: <45F180B3.50901@acronis.com> Hi again, Ok, thank you. I'll try to prepare minimal testcase. It is not so easy because the problem apears while handling complex templated code. But I need advices about workarround the problem. Say, How can I force gcc to use ebp instead of esp to address local variables? How can I force gcc to use "leave"(ebp) on function return instead of "add XXX, esp"? If above is possible incorrect esp hanling may be easy workarrounded. Thank you in advance Vladimir Simonov Andrew Haley wrote: > Vladimir Simonov writes: > > Hi > > > > To be distinct. > > Here is the problem function. > > OK, thanks, now it is clear. The "ret 4" removes a word from the > stack that belongs to the caller. > > This is, as you say, definitely a code generation bug. Now, we have a > problem. You would like it fixed, but you can't produce a test case > that a gcc maintainer can use for a bug report. If you can produce a > test case we can see if tis is fixed in other gcc versions. > > Andrew. > From aph@redhat.com Fri Mar 9 17:29:00 2007 From: aph@redhat.com (Andrew Haley) Date: Fri, 09 Mar 2007 17:29:00 -0000 Subject: gcc forgets to decrease esp after function call In-Reply-To: <45F180B3.50901@acronis.com> References: <45F15674.9000701@acronis.com> <17905.22833.766154.45450@zebedee.pink> <45F1681A.6030307@acronis.com> <17905.28252.856544.931176@zebedee.pink> <45F180B3.50901@acronis.com> Message-ID: <17905.33869.537927.207102@zebedee.pink> Vladimir Simonov writes: > Hi again, > > Ok, thank you. > I'll try to prepare minimal testcase. It is not so easy > because the problem apears while handling complex > templated code. > > But I need advices about workarround the problem. > Say, > How can I force gcc to use ebp instead of > esp to address local variables? -fno-omit-frame-pointer ought to do it. Andrew. From iprmaster@gmail.com Fri Mar 9 18:00:00 2007 From: iprmaster@gmail.com (max) Date: Fri, 09 Mar 2007 18:00:00 -0000 Subject: Internal representation of double variables - 3.4.6 vs 4.1.0 In-Reply-To: References: Message-ID: Hi gcc developers and users, I have discovered that my code gives different results if compiled with different gcc versions, namely 3.4.6 and 4.1.0. Since I wanted to understand why, I compile my code again w/o any optimization (-O0) and with debug symbols (-g). I have found that differences (very small, 10e-12 on a 32-bit machine) started to appear in the return value of a routine which performs vector-vector multiplication, i.d. double vecdot(double *v) { double sum = 0; for(i = 0; i < n; i++) sum += v[i] * v[i]; return sum; } even if elements of v[] are the same. Do these versions use different "internal" representation of doubles? I agree that the sum above is ill-conditioned, but why do different gccs give (w/o optimization) different results? Thanks for your help, Max From terry@chem.gu.se Fri Mar 9 18:33:00 2007 From: terry@chem.gu.se (Terry Frankcombe) Date: Fri, 09 Mar 2007 18:33:00 -0000 Subject: Internal representation of double variables - 3.4.6 vs 4.1.0 In-Reply-To: References: Message-ID: <1173463194.5215.5.camel@fkpc167> On Fri, 2007-03-09 at 18:29 +0100, max wrote: > Hi gcc developers and users, > > I have discovered that my code gives different results if compiled > with different gcc versions, namely 3.4.6 and 4.1.0. > Since I wanted to understand why, I compile my code again w/o any > optimization (-O0) and with debug symbols (-g). > I have found that differences (very small, 10e-12 on a 32-bit machine) > started to appear in the return value of a routine which performs > vector-vector multiplication, i.d. > > double vecdot(double *v) > { > double sum = 0; > for(i = 0; i < n; i++) > sum += v[i] * v[i]; > return sum; > } > > even if elements of v[] are the same. Do these versions use different > "internal" representation of doubles? > I agree that the sum above is ill-conditioned, but why do different > gccs give (w/o optimization) different results? > > Thanks for your help, > Max (Slightly off-topic. But only slightly!) After reading this, I went off looking for a gcc option enforcing IEEE floating point behaviour, assuming gcc was like the Intel compilers and by default sacrificed some exactness in the floating point model for speed, even with no optimisation. I could find none. So, does gcc use a well-defined and reproducible floating-point model by default? If not, can one turn on strict IEEE arithmetic? Ciao Terry -- Dr Terry Frankcombe Physical Chemistry, Department of Chemistry G??teborgs Universitet SE-412 96 G??teborg Sweden Ph: +46 76 224 0887 Skype: terry.frankcombe From brian@dessent.net Fri Mar 9 18:47:00 2007 From: brian@dessent.net (Brian Dessent) Date: Fri, 09 Mar 2007 18:47:00 -0000 Subject: Internal representation of double variables - 3.4.6 vs 4.1.0 References: <1173463194.5215.5.camel@fkpc167> Message-ID: <45F1A884.B239ACBC@dessent.net> Terry Frankcombe wrote: > After reading this, I went off looking for a gcc option enforcing IEEE > floating point behaviour, assuming gcc was like the Intel compilers and > by default sacrificed some exactness in the floating point model for > speed, even with no optimisation. I could find none. So, does gcc use > a well-defined and reproducible floating-point model by default? If > not, can one turn on strict IEEE arithmetic? That is not the problem. The problem is that the intel x86 processor uses an internal 80 bit representation for 'double', which normally has only 64 bits. This causes excess precision, which can appear as rounding errors in the ULP, but are not really errors, just misunderstandings of how IEE 754 works. You can work around this with -ffloat-store but this incurs a speed penalty as it means temporary values can't be kept in registers but repeatedly stored and loaded from memory. Or you can use SSE for fp math (-mfpmath=sse) instead of 387, if your architecture supports it. See gcc bug 323 for examples of this non-bug being reported over and over again dozens of times over the years. Brian From terry@chem.gu.se Fri Mar 9 18:55:00 2007 From: terry@chem.gu.se (Terry Frankcombe) Date: Fri, 09 Mar 2007 18:55:00 -0000 Subject: Internal representation of double variables - 3.4.6 vs 4.1.0 In-Reply-To: <45F1A884.B239ACBC@dessent.net> References: <1173463194.5215.5.camel@fkpc167> <45F1A884.B239ACBC@dessent.net> Message-ID: <1173466047.5215.11.camel@fkpc167> On Fri, 2007-03-09 at 10:33 -0800, Brian Dessent wrote: > Terry Frankcombe wrote: > > > After reading this, I went off looking for a gcc option enforcing IEEE > > floating point behaviour, assuming gcc was like the Intel compilers and > > by default sacrificed some exactness in the floating point model for > > speed, even with no optimisation. I could find none. So, does gcc use > > a well-defined and reproducible floating-point model by default? If > > not, can one turn on strict IEEE arithmetic? > > That is not the problem. The problem is that the intel x86 processor > uses an internal 80 bit representation for 'double', which normally has > only 64 bits. This causes excess precision, which can appear as > rounding errors in the ULP, but are not really errors, just > misunderstandings of how IEE 754 works. You can work around this with > -ffloat-store but this incurs a speed penalty as it means temporary > values can't be kept in registers but repeatedly stored and loaded from > memory. Or you can use SSE for fp math (-mfpmath=sse) instead of 387, > if your architecture supports it. > > See gcc bug 323 for > examples of this non-bug being reported over and over again dozens of > times over the years. > > Brian So the short answers are "No" and "No", right? ;-) My understanding of -ffloat-store is that it only works when there's actually a variable involved. Is that right? (I'm used to working with Compaq and Intel Fortran compilers, where you can set flags that say, effectively, "Use a standard, well-defined and portable floating point arithmetic model irrespective of what the CPU's trying to do.") Ciao Terry From brian@dessent.net Fri Mar 9 19:08:00 2007 From: brian@dessent.net (Brian Dessent) Date: Fri, 09 Mar 2007 19:08:00 -0000 Subject: Internal representation of double variables - 3.4.6 vs 4.1.0 References: <1173463194.5215.5.camel@fkpc167> <45F1A884.B239ACBC@dessent.net> <1173466047.5215.11.camel@fkpc167> Message-ID: <45F1AD7C.CE30AC9A@dessent.net> Terry Frankcombe wrote: > My understanding of -ffloat-store is that it only works when there's > actually a variable involved. Is that right? Right, it's not a guaranteed fix. > (I'm used to working with Compaq and Intel Fortran compilers, where you > can set flags that say, effectively, "Use a standard, well-defined and > portable floating point arithmetic model irrespective of what the CPU's > trying to do.") I'd say you pretty much get that with -mfpmath=sse. The only reason anyone should ever use 387 is if binary compatibility with ancient pre-SSE pentiums/K6s is required. Otherwise, it's an ancient and creaky fp architecture that would be best obsoleted (which they finally did in x86_64 AFAIK.) Brian From terry@chem.gu.se Fri Mar 9 19:27:00 2007 From: terry@chem.gu.se (Terry Frankcombe) Date: Fri, 09 Mar 2007 19:27:00 -0000 Subject: Internal representation of double variables - 3.4.6 vs 4.1.0 In-Reply-To: <45F1AD7C.CE30AC9A@dessent.net> References: <1173463194.5215.5.camel@fkpc167> <45F1A884.B239ACBC@dessent.net> <1173466047.5215.11.camel@fkpc167> <45F1AD7C.CE30AC9A@dessent.net> Message-ID: <1173467304.5215.19.camel@fkpc167> On Fri, 2007-03-09 at 10:54 -0800, Brian Dessent wrote: > Terry Frankcombe wrote: > > > My understanding of -ffloat-store is that it only works when there's > > actually a variable involved. Is that right? > > Right, it's not a guaranteed fix. > > > (I'm used to working with Compaq and Intel Fortran compilers, where you > > can set flags that say, effectively, "Use a standard, well-defined and > > portable floating point arithmetic model irrespective of what the CPU's > > trying to do.") > > I'd say you pretty much get that with -mfpmath=sse. The only reason > anyone should ever use 387 is if binary compatibility with ancient > pre-SSE pentiums/K6s is required. Otherwise, it's an ancient and creaky > fp architecture that would be best obsoleted (which they finally did in > x86_64 AFAIK.) > > Brian For the world at large: Is there any sensible reason that these options seem to buried in processor-specific sections? Surely the hardware floating point model varies on more than just the x86 family and friends. Why isn't there a simple, global option to get a portable floating point model? (Particularly now that gfortran is becoming more popular!) Tying the floating point model to a particular hardware feature/instruction set (SSE) seems absolutely absurd to me. It should be abstracted to a much higher level. Terry From eljay@adobe.com Sat Mar 10 18:37:00 2007 From: eljay@adobe.com (John (Eljay) Love-Jensen) Date: Sat, 10 Mar 2007 18:37:00 -0000 Subject: Internal representation of double variables - 3.4.6 vs 4.1.0 References: <1173467304.5215.19.camel@fkpc167> Message-ID: Hi Terry, > Is there any sensible reason that these options seem to buried in processor-specific sections? My guess is because they are processor-specific options. > Surely the hardware floating point model varies on more than just the x86 family and friends. Yes. For example, not all 680x0 machines has a FPU. > Why isn't there a simple, global option to get a portable floating point model? Because there are different FPU facilities on different platforms that may have a different, non-portable floating-point model. > Particularly now that gfortran is becoming more popular! If the Fortran users express a desire for some Fortran level floating-point compliance to a portable floating-point model, perhaps the maintainer of the gfortran front-end tool-chain driver will add a flag to that effect. I imagine such a flag would have these guarantees: + behind the scenes, specifies the processor-specific option to insure floating-point portability + may impose severe performance penalties (one-to-two orders of magnitude) on some platforms + may cause the compile to fail if the floating-point constraint cannot be fulfilled (which is probably a good thing) > Tying the floating point model to a particular hardware feature/instruction set (SSE) seems absolutely absurd to me. It should be abstracted to a much higher level. It's a trade-off, without a doubt. Java has a facility that allows strong guarantees on floating-point fidelity. And Mathematica allows very powerful expression of symbolic and mathematical manipulation and expression. And there's always Lisp. Sincerely, --Eljay From jopen@gmx.net Sat Mar 10 21:47:00 2007 From: jopen@gmx.net (Sascha Alexander Jopen) Date: Sat, 10 Mar 2007 21:47:00 -0000 Subject: AW: dump-translation-unit format Message-ID: <000101c76343$409f9f70$c1dede50$@net> Hi, Sorry for my double posts on this list and answering to the wrong persons. I had/have major trouble with my mail client and anti-spam. I hope that everything works as expected now. > > I'm currently working on the output of gcc/g++ -fdump-translation- > unit > > to do source code analysis. I found several references that the > > internal ast should include nodes for for, while and do constructs. > > But I can't find those nodes in the dumped files. Sometimes there > > are such FOR_STMT nodes when I compile large units, but when > > compiling a small test unit containing not much more than a for > > loop, this loop isn't included in the dump. Instead there is a > > GOTO_EXPR where I > would > > expect the for loop. This holds for other loops and conditional > > expressions as well. All FOR_STMT nodes I encountered where not from > my custom code, but from templates from system includes. > > > > Are there any optimizations done on the tree before dumping it, and > > how can I prevent this to get an unoptimized tree? Are there other > > possibilities to get those loop nodes? I need them to check whether > > function calls are done in loops or not. Without the bodies of loops > I > > can get information about functions called from other functions > > using the chain links, but not whether they are called within loops. > > Which version of gcc are you using? In mainline -fdump-translation- > unit just dumps the global declarations. If you want to see FOR_STMT > nodes, you need -fdump-tree-original. But that is pretty > unsatisfactory these days since for_stmt nodes are not dumped in a > useful way. And that only happens for C++; for C FOR_STMT nodes are > never generated. > I'm using recent gcc-4.1.2. I used -fdump-tree-original-raw to obtain all declarations from within functions. It seems that I can find all loop constructs there, although there are many other nodes dumped, which I do not understand completely by now. To do automatic parsing of the output seems to be not as simple as I hoped initially. But thank you for the -fdump-tree-original hint, anyway. > > > Another thing I don't understand is the following. This dumped > > function node contains two body definitions, one undefined and one > > with a proper node chain. Is this a dump error or has it special > meaning? > > > > @1639 function_decl name: @2001 mngl: @2002 type: @2003 > > scpe: @812 srcp: char_traits.h:322 > > chan: @2004 note: member accs: pub > > args: @2005 body: undefined > > link: extern body: @2006 > > > > Maybe someone could help me or point me to other resources. > > The tree dump code prints out "body: undefined" for an external > function which is not to be compiled by itself. But such a function > can still have a body; this will be the case for a C++ inline function. > This is somewhat confusing. > > Ian I do not understand the link: external. All my own functions are also marked as external, though they are defined, declared and used within the same compilation unit. Additionally I do only have one compilation unit for testing. Why are those functions marked as externally linked? Sascha From facundofc@gmail.com Sun Mar 11 06:22:00 2007 From: facundofc@gmail.com (Facundo Ciccioli) Date: Sun, 11 Mar 2007 06:22:00 -0000 Subject: Clobbered registers Message-ID: <56aed05a0703101346l21869a0epf9033da335ce638e@mail.gmail.com> I wrote a function which modifies esp register through some asm instructions (it pushes things to the stack). Everything works perfect for now because the function takes care of restauring the content of esp issuing an add instruction too so that it can return allright. But reading GCC docs I found this: "If you refer to a particular hardware register from the assembler code, you will probably have to list the register after the third colon to tell the compiler the register's value is modified." Ok, so I do that. But looking at the assembler code generated by the compiler I notice that it is exactly the same than before I did what the docs say. So I wonder, why does the compiler needs to know if I execute an instruction that modifies some register? And also (maybe the answer to the former would respond this) why does the code doesn't change? Thanks a lot, FaQ From vishnu_m_menon@yahoo.com Sun Mar 11 14:46:00 2007 From: vishnu_m_menon@yahoo.com (Vishnu M Menon) Date: Sun, 11 Mar 2007 14:46:00 -0000 Subject: Reserving the same virtual address space range in several programs Message-ID: <803480.85995.qm@web38906.mail.mud.yahoo.com> Hi, I am trying to solve this problem: reserve the same virtual memory address range in a given set of programs so that no addresses falling within this range will be used by the processes for any other purpose. Later I'll map a shared memory region to this address using mmap(.) or shmat(.). My question is: is there a way I can use GCC to achieve this VM address reservation? The programs are fully in my control and are extremely specialized, so I am at liberty to use techniques sane people would balk at. To give a clearer idea of what I'm getting at, reserving 10 MB of memory space might be achieved through something like: char g_MemArray[ 10 * ( 1 << 20 ) ]; int main() { printf("Starts at %p\n", g_MemArray ); return 0; } But of course, layout of global variables will vary from program to program. I am trying to see if somehow the layout can be specified so that VM addresses are guaranteed to be the same. TIA for the replies. I would also welcome any solutions that do not involve gcc, though I realize this would be off-topic (for which I apologize in advance!). Regards, Vishnu From sadri.sarray@gmail.com Sun Mar 11 14:51:00 2007 From: sadri.sarray@gmail.com (Sadri SARRAY) Date: Sun, 11 Mar 2007 14:51:00 -0000 Subject: How to Install GCC Message-ID: <92e033780703110745p60d734dfm4aff466d7a14f390@mail.gmail.com> Dear Madam, Sir Please, Would you like to send me a procedure to install the GCC compiler on a Linux-Ubuntu OS ? Regards, From cdp_doomed@gmx.net Sun Mar 11 15:03:00 2007 From: cdp_doomed@gmx.net (Steffen Wendzel) Date: Sun, 11 Mar 2007 15:03:00 -0000 Subject: How to Install GCC In-Reply-To: <92e033780703110745p60d734dfm4aff466d7a14f390@mail.gmail.com> References: <92e033780703110745p60d734dfm4aff466d7a14f390@mail.gmail.com> Message-ID: <20070311155148.35752c89.cdp_doomed@gmx.net> as root: # apt-get install gcc regards steffen -- website: http://cdp.doomed-reality.org hardened linux: http://hardenedlinux.sourceforge.net From tschwinge@gnu.org Sun Mar 11 15:58:00 2007 From: tschwinge@gnu.org (Thomas Schwinge) Date: Sun, 11 Mar 2007 15:58:00 -0000 Subject: How to Install GCC In-Reply-To: <92e033780703110745p60d734dfm4aff466d7a14f390@mail.gmail.com> References: <92e033780703110745p60d734dfm4aff466d7a14f390@mail.gmail.com> Message-ID: <20070311150107.GQ4439@fencepost.gnu.org> Hello! On Sun, Mar 11, 2007 at 10:45:53AM -0400, Sadri SARRAY wrote: > Please, Would you like to send me a procedure to install the GCC > compiler on a Linux-Ubuntu OS ? With a power screwdriver. Regards, Thomas -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 191 bytes Desc: Digital signature URL: From lopezibanez@gmail.com Sun Mar 11 16:22:00 2007 From: lopezibanez@gmail.com (=?ISO-8859-1?Q?Manuel_L=F3pez-Ib=E1=F1ez?=) Date: Sun, 11 Mar 2007 16:22:00 -0000 Subject: How to Install GCC In-Reply-To: <92e033780703110745p60d734dfm4aff466d7a14f390@mail.gmail.com> References: <92e033780703110745p60d734dfm4aff466d7a14f390@mail.gmail.com> Message-ID: <6c33472e0703110858x659e794ev5eb3595f09f3ace4@mail.gmail.com> On 11/03/07, Sadri SARRAY wrote: > Dear Madam, Sir > > Please, Would you like to send me a procedure to install the GCC > compiler on a Linux-Ubuntu OS ? > http://www.google.com/search?&q=how%20to%20install%20gcc%20in%20ubuntu Or in short: sudo apt-get install gcc build-essential Next time: http://www.catb.org/~esr/faqs/smart-questions.html Cheers, Manuel. From bdavis9659@sbcglobal.net Sun Mar 11 17:37:00 2007 From: bdavis9659@sbcglobal.net (Bud Davis) Date: Sun, 11 Mar 2007 17:37:00 -0000 Subject: Reserving the same virtual address space range in several programs In-Reply-To: <803480.85995.qm@web38906.mail.mud.yahoo.com> Message-ID: <37955.19203.qm@web81213.mail.mud.yahoo.com> --- Vishnu M Menon wrote: > Hi, > > I am trying to solve this problem: reserve the same > virtual memory address range in a given set of > programs so that no addresses falling within this > range will be used by the processes for any other > purpose. Later I'll map a shared memory region to > this > address using mmap(.) or shmat(.). > > My question is: is there a way I can use GCC to > achieve this VM address reservation? The programs > are > fully in my control and are extremely specialized, > so > I am at liberty to use techniques sane people would > balk at. > > To give a clearer idea of what I'm getting at, > reserving 10 MB of memory space might be achieved > through something like: > > char g_MemArray[ 10 * ( 1 << 20 ) ]; > > int > main() > { > printf("Starts at %p\n", g_MemArray ); > return 0; > } > > But of course, layout of global variables will vary > from program to program. I am trying to see if > somehow > the layout can be specified so that VM addresses are > guaranteed to be the same. > > TIA for the replies. I would also welcome any > solutions that do not involve gcc, though I realize > this would be off-topic (for which I apologize in > advance!). > > Regards, > Vishnu > there is an example on the web showing how to do this on a unix system (it concerns fortran common blocks, but the concepts are the same). http://gfortran.info/pmwiki.php?n=CodeSnippets From aph@redhat.com Mon Mar 12 04:28:00 2007 From: aph@redhat.com (Andrew Haley) Date: Mon, 12 Mar 2007 04:28:00 -0000 Subject: Clobbered registers In-Reply-To: <56aed05a0703101346l21869a0epf9033da335ce638e@mail.gmail.com> References: <56aed05a0703101346l21869a0epf9033da335ce638e@mail.gmail.com> Message-ID: <17908.15942.408305.73060@zebedee.pink> Facundo Ciccioli writes: > I wrote a function which modifies esp register through some asm > instructions (it pushes things to the stack). Everything works perfect > for now because the function takes care of restauring the content of > esp issuing an add instruction too so that it can return allright. Right. Good. asms shouldn't clobber SP. SP is controlled by the compiler. > But reading GCC docs I found this: > > "If you refer to a particular hardware register from the assembler > code, you will probably have to list the register after the third > colon to tell the compiler the register's value is modified." > > Ok, so I do that. But looking at the assembler code generated by the > compiler I notice that it is exactly the same than before I did what > the docs say. So I wonder, why does the compiler needs to know if I > execute an instruction that modifies some register? And also (maybe > the answer to the former would respond this) why does the code doesn't > change? If you use a specific hardware register, say R7, then you need to tell the compiler you have done so, so that the compiler doesn't use that register to store a temporary. Andrew. From eyna2911@yahoo.com Mon Mar 12 08:12:00 2007 From: eyna2911@yahoo.com (Erna Yusnida) Date: Mon, 12 Mar 2007 08:12:00 -0000 Subject: error while install gcc Message-ID: <20070312042832.70348.qmail@web32713.mail.mud.yahoo.com> linux:/home/erna/gcc-4.1.2/gcc # configure --prefix=/usr bash: configure: command not found linux:/home/erna/gcc-4.1.2/gcc # ./configure cat: ./BASE-VER: No such file or directory configure: error: cannot run /bin/sh ./config.sub can someone help me solve this problem????? pls show me a details step to install gcc. I'm using SuSE 9.1 pro.i hv install gcc in Yast. But when i want to install ndiswrapper, the error tell that gcc 3.3 or newer version should be used. i hv read the articles in suse forum that to fix the problem should update the gcc.but when i install the gcc, i got the error..pls...someone..help me out!!!! pls give a details instruction to make this work.. ____________________________________________________________________________________ 8:00? 8:25? 8:40? Find a flick in no time with the Yahoo! Search movie showtime shortcut. http://tools.search.yahoo.com/shortcuts/#news From castillo@teisa.unican.es Mon Mar 12 10:46:00 2007 From: castillo@teisa.unican.es (Juan Castillo) Date: Mon, 12 Mar 2007 10:46:00 -0000 Subject: where can I get gcc optimizations information In-Reply-To: <17903.57444.43797.324340@zebedee.pink> References: <200703081057.45511.castillo@teisa.unican.es> <17903.57444.43797.324340@zebedee.pink> Message-ID: <200703120912.33753.castillo@teisa.unican.es> > Juan Castillo writes: > > I need some help with gcc optimizations and I don't know where I > > can get it. > > > > The objective of my work is to estimate how many machine > > instructions I can save in a program execution employing compiler > > optimizations. I am working with ARM architecture. Anyway, I have > > understood that main gcc optimizations are > > architecture-independent. > > > > In the gcc user's manual I have read that flags -O, -O1, -O2, -O3 > > and -Os activate different optimization flags (starting with "-f", > > I think), but not all of them are available individually. If I > > switch on all flags available individually for -O1 (-fdefer-pop, > > -fmerge-constants...) they have no effect in obtained machine code, > > but if I compile with -O1 option, there is a reduction of about 50% > > in machine instructions number with respect to basic compilation. > > > > With these results, I suppose that -O1 performs more actions that > > are not reported in any document I have found in The Internet. I > > have downloaded the gcc source-code but it is too difficult for me > > to understand it. My question is: where can I get full information > > about gcc optimizations and how they are performed? > > Full information is in the source. As Euclid (or someone else!) may > once have said, "There is no royal road to mathematics". If you are > really to understand, you'll have to get in there some time. > > However, some things will help you. -fverbose-asm produces a list of > optimization passes. The dumps "-da" and "-fdump-tree-all" produce a > lot of files, one per optimization pass, so you can see what each pass > did. Once you know which pass does what, you can start to look at the > code. > Thanks for your answer. When using "-fverbose-asm" flag in the commmand line to produce the list of optimization passes, I suppose you mean adding the "-S" flag to see the assemble file, don't you? I say this because using the flag in a common compilation doesn't produce any change. Anyway, taking a look at the assemble file, I can see the flags employed when I compile with -O1 option, but if I introduce them all in the command line instead of -O1 (it is supposed that the executable file would be the same), optimizations are not performed. What am I doing wrong? I have read source code and -O1 flag activates some other flags and it seems it does not any more. > > And another question: would be possible to get a benchmark or > > similar for compiler optimizations? That is, some set of programs > > that estimate the save that a compiler can achieve. I know it > > depends on the algotihms compiled, employed architecture and more > > (please, don't remember me that...). I just need an > > estimation. That would be great for my work. > > SPEC is a standard, but it's unfree and therefore off-topic here. > > Andrew. Thank you very much. -------------------------------------------------------------------- Juan Castillo Microelectronics Engineering Group. Dep. TEISA University of Cantabria. Spain. E-mail: castillo@teisa.unican.es -------------------------------------------------------------------- From sunil@qualcorelogic.com Mon Mar 12 10:56:00 2007 From: sunil@qualcorelogic.com (Parmar Sunil) Date: Mon, 12 Mar 2007 10:56:00 -0000 Subject: help to includes header files Message-ID: <45F57C32.7060806@qualcorelogic.com> Hi, I am a new user of gcc. I have written a simple program in which I am using stdio.h file. But compiler could not locate the path for the header files and it is giving error. stdio.h: No such file or directory When I included the $GCC/include using option -I$GCC/include, it was giving error about the files (header) which were included in the stdio.h file. stdio.h:7: sys/feature_tests.h: No such file or directory stdio.h:15: stdio_iso_SUNWCC.h: No such file or directory Is there any option which look at all the directories for headers ? If I am not wrong, this option can be given during installation. Can it be? Are these header files linked with libraries ? Please give me suggestion to solve this problem. Thanks -- Parmar Sunil From mikael.debie@student.uclouvain.be Mon Mar 12 11:53:00 2007 From: mikael.debie@student.uclouvain.be (Mikael De Bie) Date: Mon, 12 Mar 2007 11:53:00 -0000 Subject: Problem using libraries Message-ID: <1173696940.9242.6.camel@ptitbeuk> Hi everybody, I'm trying to create a UNO component for openoffice. In this component, I would use gecode libraries. But I get an error hwen I compile the whole component whith this class. Here's the errors I get : 1. ---- If I'm using the -c option, the linking is not done and the component library loading failes : Warning : g++: -lgecodeint: linker input file unused because linking not done g++: -lgecodeset: linker input file unused because linking not done g++: -lgecodeminimodel: linker input file unused because linking not done g++: -lgecodekernel: linker input file unused because linking not done g++: -lgecodesearch: linker input file unused because linking not done Erreur : error (CannotRegisterImplementationException): loading component library failed: scsolver.uno.so 2. ---- If I don't use the -c option, here's the error I get : /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib/crt1.o: In function `_start': (.text+0x18): undefined reference to `main' But I don't have any main function, since it's a uno component for openoffice This is the part of the Makefile to compile the class gecode.cxx : gecode.o : $(HEADER) $(NUMDIR)/gecode.cxx /usr/bin/g++ `pkg-config --libs --cflags gecode gecode-minimodel gecode-search` -DDEBUG -Os -mtune=pentium4 -I../../../source/inc -I. -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3 -DHAVE_GCC_VISIBILITY_FEATURE -DENABLE_SCSOLVER_UNO_ALGORITHM \ -o gecode.o -fPIC -fno-rtti -fno-common -export-dynamic -fvisibility=hidden -c ../../../source/numeric/gecode.cxx Have anyone any idea to help me ? Thanks in advance ! Mikael De Bie From eljay@adobe.com Mon Mar 12 11:57:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Mon, 12 Mar 2007 11:57:00 -0000 Subject: error while install gcc In-Reply-To: <20070312042832.70348.qmail@web32713.mail.mud.yahoo.com> Message-ID: Hi Erna, > pls give a details instruction to make this work.. http://gcc.gnu.org/install/configure.html HTH, --Eljay From eljay@adobe.com Mon Mar 12 12:43:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Mon, 12 Mar 2007 12:43:00 -0000 Subject: where can I get gcc optimizations information In-Reply-To: <200703120912.33753.castillo@teisa.unican.es> Message-ID: Hi Juan, > When using "-fverbose-asm" flag in the commmand line to produce the list of > optimization passes, I suppose you mean adding the "-S" flag to see the > assemble file, don't you? I say this because using the flag in a common > compilation doesn't produce any change. > Anyway, taking a look at the assemble file, I can see the flags employed when > I compile with -O1 option, but if I introduce them all in the command line > instead of -O1 (it is supposed that the executable file would be the same), > optimizations are not performed. What am I doing wrong? I have read source > code and -O1 flag activates some other flags and it seems it does not any > more. -O0 (which is the default if not specified) disables optimizations. So introducing specific flagged optimizations in the context of optimizations disabled has no effect. HTH, --Eljay From aph@redhat.com Mon Mar 12 13:20:00 2007 From: aph@redhat.com (Andrew Haley) Date: Mon, 12 Mar 2007 13:20:00 -0000 Subject: where can I get gcc optimizations information In-Reply-To: <200703120912.33753.castillo@teisa.unican.es> References: <200703081057.45511.castillo@teisa.unican.es> <17903.57444.43797.324340@zebedee.pink> <200703120912.33753.castillo@teisa.unican.es> Message-ID: <17909.19183.456194.255564@zebedee.pink> Juan Castillo writes: > > Juan Castillo writes: > > > I need some help with gcc optimizations and I don't know where I > > > can get it. > > > > > > The objective of my work is to estimate how many machine > > > instructions I can save in a program execution employing compiler > > > optimizations. I am working with ARM architecture. Anyway, I have > > > understood that main gcc optimizations are > > > architecture-independent. > > > > > > In the gcc user's manual I have read that flags -O, -O1, -O2, -O3 > > > and -Os activate different optimization flags (starting with "-f", > > > I think), but not all of them are available individually. If I > > > switch on all flags available individually for -O1 (-fdefer-pop, > > > -fmerge-constants...) they have no effect in obtained machine code, > > > but if I compile with -O1 option, there is a reduction of about 50% > > > in machine instructions number with respect to basic compilation. > > > > > > With these results, I suppose that -O1 performs more actions that > > > are not reported in any document I have found in The Internet. I > > > have downloaded the gcc source-code but it is too difficult for me > > > to understand it. My question is: where can I get full information > > > about gcc optimizations and how they are performed? > > > > Full information is in the source. As Euclid (or someone else!) may > > once have said, "There is no royal road to mathematics". If you are > > really to understand, you'll have to get in there some time. > > > > However, some things will help you. -fverbose-asm produces a list of > > optimization passes. The dumps "-da" and "-fdump-tree-all" produce a > > lot of files, one per optimization pass, so you can see what each pass > > did. Once you know which pass does what, you can start to look at the > > code. > > > Thanks for your answer. > When using "-fverbose-asm" flag in the commmand line to produce the list of > optimization passes, I suppose you mean adding the "-S" flag to see the > assemble file, don't you? I say this because using the flag in a common > compilation doesn't produce any change. You have to use -save-temps to get the assembly file. The dumps are probably the most interesting part. > Anyway, taking a look at the assemble file, I can see the flags > employed when I compile with -O1 option, but if I introduce them > all in the command line instead of -O1 (it is supposed that the > executable file would be the same) It won't be. Without -O, you won't get any optimization. > optimizations are not performed. What am I doing wrong? I have read > source code and -O1 flag activates some other flags and it seems it > does not any more. Andrew. From feradz@gmail.com Mon Mar 12 16:02:00 2007 From: feradz@gmail.com (Ferad Zyulkyarov) Date: Mon, 12 Mar 2007 16:02:00 -0000 Subject: help to includes header files In-Reply-To: <45F57C32.7060806@qualcorelogic.com> References: <45F57C32.7060806@qualcorelogic.com> Message-ID: Hi, Probably there is a problem with the installation of your gcc, particularly stdlibc.. These header files should be in /usr/include. In this case I just install a clean gcc - there is no fixing hassles. On 3/12/07, Parmar Sunil wrote: > Hi, > I am a new user of gcc. I have written a simple program in which I am > using stdio.h file. But compiler could not locate the path for the > header files and it is giving error. > stdio.h: No such file or directory > When I included the $GCC/include using option -I$GCC/include, it was > giving error about the files (header) which were included in the stdio.h > file. > stdio.h:7: sys/feature_tests.h: No such file or directory > stdio.h:15: stdio_iso_SUNWCC.h: No such file or directory > > Is there any option which look at all the directories for headers ? If I > am not wrong, this option can be given during installation. Can it be? > Are these header files linked with libraries ? > Please give me suggestion to solve this problem. > Thanks > > -- > Parmar Sunil > > > -- Ferad Zyulkyarov Barcelona Supercomputing Center From aph@redhat.com Mon Mar 12 16:06:00 2007 From: aph@redhat.com (Andrew Haley) Date: Mon, 12 Mar 2007 16:06:00 -0000 Subject: where can I get gcc optimizations information In-Reply-To: References: <200703081057.45511.castillo@teisa.unican.es> <17903.57444.43797.324340@zebedee.pink> <200703120912.33753.castillo@teisa.unican.es> <17909.19183.456194.255564@zebedee.pink> Message-ID: <17909.31117.108756.319594@zebedee.pink> Sunzir Deepur writes: > Hi > > On 3/12/07, Andrew Haley wrote: > > Juan Castillo writes: > > > > Juan Castillo writes: > > > > However, some things will help you. -fverbose-asm produces a list of > > > > optimization passes. The dumps "-da" and "-fdump-tree-all" produce a > > > > lot of files, one per optimization pass, so you can see what each pass > > > > did. Once you know which pass does what, you can start to look at the > > > > code. > > What is the difference between -fdump-tree-all and -fdump-rtl-all ? What differences did you see when you looked? > what does the -da annotations mean ? I don't understand this question. Andrew. From sunzird@gmail.com Mon Mar 12 16:21:00 2007 From: sunzird@gmail.com (Sunzir Deepur) Date: Mon, 12 Mar 2007 16:21:00 -0000 Subject: where can I get gcc optimizations information In-Reply-To: <17909.19183.456194.255564@zebedee.pink> References: <200703081057.45511.castillo@teisa.unican.es> <17903.57444.43797.324340@zebedee.pink> <200703120912.33753.castillo@teisa.unican.es> <17909.19183.456194.255564@zebedee.pink> Message-ID: Hi On 3/12/07, Andrew Haley wrote: > Juan Castillo writes: > > > Juan Castillo writes: > > > However, some things will help you. -fverbose-asm produces a list of > > > optimization passes. The dumps "-da" and "-fdump-tree-all" produce a > > > lot of files, one per optimization pass, so you can see what each pass > > > did. Once you know which pass does what, you can start to look at the > > > code. What is the difference between -fdump-tree-all and -fdump-rtl-all ? what does the -da annotations mean ? Thanks sunzir From sunzird@gmail.com Mon Mar 12 16:21:00 2007 From: sunzird@gmail.com (Sunzir Deepur) Date: Mon, 12 Mar 2007 16:21:00 -0000 Subject: where can I get gcc optimizations information In-Reply-To: <17909.31117.108756.319594@zebedee.pink> References: <200703081057.45511.castillo@teisa.unican.es> <17903.57444.43797.324340@zebedee.pink> <200703120912.33753.castillo@teisa.unican.es> <17909.19183.456194.255564@zebedee.pink> <17909.31117.108756.319594@zebedee.pink> Message-ID: Hello > > On 3/12/07, Andrew Haley wrote: > > What is the difference between -fdump-tree-all and -fdump-rtl-all ? > > What differences did you see when you looked? well, fdump-rtl produced a lot of files in RTL syntax, and i guess each file corresponds to a different PASS. when used with -dv it also produces VCG graphes, but not to them all. why doesn't it produce a vcg file to the last five passes too ? when i tried fdump-tree-all, it produced files with numbers that are prefixed with 't'. i guess it stands for 'tree' but the syntax of these files was unclear to me. are those files correspons to passes, too ? where can i learn about their syntax ? > > what does the -da annotations mean ? > > I don't understand this question. I just didn't understand what does the -da does. it says it adds annotations but i couldn't understand where.. Thank You !!!! sunzir. From David.CARTER-HITCHIN@rbos.com Mon Mar 12 16:24:00 2007 From: David.CARTER-HITCHIN@rbos.com (CARTER-HITCHIN, David, GBM) Date: Mon, 12 Mar 2007 16:24:00 -0000 Subject: where can I get gcc optimizations information Message-ID: <3B4C77997DD0254B86D3C9454476B6BC0F03EC1D@lonms00812.fm.rbsgrp.net> Hi GCC'ers > > > > Juan Castillo writes: > > > > However, some things will help you. -fverbose-asm > produces a list of > > > > optimization passes. The dumps "-da" and > "-fdump-tree-all" produce a > > > > lot of files, one per optimization pass, so you can > see what each pass Forgive me if I've missed something obvious, but does anyone know if the output from -fdump-tree-all is documented somewhere? I was trying to understand a vexing C++ parse the other day and having such documents would have helped. Many Thanks, David. *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our websites at: www.rbs.com www.rbsgc.com www.rbsmarkets.com *********************************************************************************** From aph@redhat.com Mon Mar 12 16:36:00 2007 From: aph@redhat.com (Andrew Haley) Date: Mon, 12 Mar 2007 16:36:00 -0000 Subject: where can I get gcc optimizations information In-Reply-To: <3B4C77997DD0254B86D3C9454476B6BC0F03EC1D@lonms00812.fm.rbsgrp.net> References: <3B4C77997DD0254B86D3C9454476B6BC0F03EC1D@lonms00812.fm.rbsgrp.net> Message-ID: <17909.32414.881087.533133@zebedee.pink> CARTER-HITCHIN, David, GBM writes: > *********************************************************************************** > The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. > Authorised and regulated by the Financial Services Authority > > This e-mail message is confidential and for use by the > addressee only. Please do not send such attachments to this list. We cannot read your mails. If there is no way you can send mail from your location without such attachments, there are web-based services you can use. Andrew. From David.CARTER-HITCHIN@rbos.com Mon Mar 12 16:40:00 2007 From: David.CARTER-HITCHIN@rbos.com (CARTER-HITCHIN, David, GBM) Date: Mon, 12 Mar 2007 16:40:00 -0000 Subject: Signatures Was: where can I get gcc optimizations information Message-ID: <3B4C77997DD0254B86D3C9454476B6BC0F03EC1E@lonms00812.fm.rbsgrp.net> Hi Andrew et al., > > This e-mail message is confidential and for use by the > > addressee only. > Please do not send such attachments to this list. We cannot read your > mails. Why not? The addressee is the list and all the members of that list. I dont' see anything at odds with the legal signature. Also, you evidently can read my mails, as you have done so and are now responding to me! I am writing in confidence to this list, that is - I am confident that my words are going to end up with the list's recipients. > If there is no way you can send mail from your location without such > attachments, there are web-based services you can use. You're right - there's nothing I can do about it. If you feel so strongly about this then I can use a web gateway if they are not prohibited here, but it's never been a problem before - either on this list or many of the others to which I belong. I can always reply from my home account and remove all signs of a signature, but what of people who only have access at work? Regards, David. From aph@redhat.com Mon Mar 12 16:47:00 2007 From: aph@redhat.com (Andrew Haley) Date: Mon, 12 Mar 2007 16:47:00 -0000 Subject: Signatures Was: where can I get gcc optimizations information In-Reply-To: <3B4C77997DD0254B86D3C9454476B6BC0F03EC1E@lonms00812.fm.rbsgrp.net> References: <3B4C77997DD0254B86D3C9454476B6BC0F03EC1E@lonms00812.fm.rbsgrp.net> Message-ID: <17909.33368.751048.296437@zebedee.pink> CARTER-HITCHIN, David, GBM writes: > Hi Andrew et al., > > > > This e-mail message is confidential and for use by the > > > addressee only. > > > Please do not send such attachments to this list. We cannot read your > > mails. > > Why not? The addressee is the list and all the members of that list. http://gcc.gnu.org/lists.html: Policies Please do not include or reference confidentiality notices, like: The referring document contains privileged and confidential information. If you are not the intended recipient you must not disseminate, copy or take any action in reliance on it, and we request that you notify companyname immediately. Such disclaimers are inappropriate for mail sent to public lists. If your company automatically adds something like this to outgoing mail, and you can't convince them to stop, you might consider using a free web-based e-mail account. Andrew. From David.CARTER-HITCHIN@rbos.com Mon Mar 12 19:10:00 2007 From: David.CARTER-HITCHIN@rbos.com (CARTER-HITCHIN, David, GBM) Date: Mon, 12 Mar 2007 19:10:00 -0000 Subject: Signatures Was: where can I get gcc optimizations information Message-ID: <3B4C77997DD0254B86D3C9454476B6BC0F03EC20@lonms00812.fm.rbsgrp.net> Hello Andrew (once again), > Such disclaimers are inappropriate for mail sent to public lists. If > your company automatically adds something like this to outgoing mail, > and you can't convince them to stop, you might consider using a free > web-based e-mail account. I have at least two of these, and they're both banned here at work, hence my point about people not being able to interact with the list, who work in such organisations. Regards, David. > -----Original Message----- > From: Andrew Haley [mailto:aph@redhat.com] > Sent: 12 March 2007 16:40 > To: CARTER-HITCHIN, David, GBM > Cc: 'Sunzir Deepur'; gcc-help@gcc.gnu.org > Subject: RE: Signatures Was: where can I get gcc > optimizations information > > CARTER-HITCHIN, David, GBM writes: > > Hi Andrew et al., > > > > > > This e-mail message is confidential and for use by the > > > > addressee only. > > > > > Please do not send such attachments to this list. We > cannot read your > > > mails. > > > > Why not? The addressee is the list and all the members of > that list. > > http://gcc.gnu.org/lists.html: > > > Policies > > Please do not include or reference confidentiality notices, like: > > The referring document contains privileged and confidential > information. If you are not the intended recipient you must not > disseminate, copy or take any action in reliance on it, and we > request that you notify companyname immediately. > > > Andrew. > From mw_triad@users.sourceforge.net Mon Mar 12 20:32:00 2007 From: mw_triad@users.sourceforge.net (Matthew Woehlke) Date: Mon, 12 Mar 2007 20:32:00 -0000 Subject: how to cast away 'volatile'? Message-ID: I have a code snippet that looks roughly like this: extern void my_free(void* ptr); int foo() { volatile long * bar; ... my_free(bar); } This generates the warning 'cast discards qualifiers from pointer target type' at my_free() (gcc 3.4.3). Other than disabling the flag that generates the warning (in general I want these warnings!), how do I suppress this? my_free is of course a free() wrapper, i.e. I don't see any problems discarding the qualifier at this point. I already tried this, which seems like it used to work (I am moving the code from one project to another): my_free(void*)bar); ...and it doesn't help. -- Matthew Emacs is a nice OS - but it lacks a good text editor. That's why I am using Vim. -- Anonymous From jeffreyholle@bellsouth.net Mon Mar 12 21:18:00 2007 From: jeffreyholle@bellsouth.net (Jeffrey Holle) Date: Mon, 12 Mar 2007 21:18:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: Message-ID: Matthew Woehlke wrote: > my_free(void*)bar); Should be: my_free((void*)bar); From mw_triad@users.sourceforge.net Mon Mar 12 21:42:00 2007 From: mw_triad@users.sourceforge.net (Matthew Woehlke) Date: Mon, 12 Mar 2007 21:42:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: Message-ID: Jeffrey Holle wrote: > Matthew Woehlke wrote: > >> my_free(void*)bar); > > Should be: > my_free((void*)bar); ...excusing the typo. :-) The point was I have tried what you suggested (i.e. what I wrote, sans the obvious typo), and I get the same warning. I'm attaching a file that demonstrates the problem when built with '-Wcast-qual'. Note that it builds with the warning (cast.c:8), but no errors. (Runs OK too...) -- Matthew Emacs is a nice OS - but it lacks a good text editor. That's why I am using Vim. -- Anonymous -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: cast.c URL: From crowl@google.com Mon Mar 12 22:06:00 2007 From: crowl@google.com (Lawrence Crowl) Date: Mon, 12 Mar 2007 22:06:00 -0000 Subject: Linux c++ opmization--- linux runs at half the speed of windows? In-Reply-To: References: Message-ID: <29bd08b70703121442t199859d7h3c0159c2dc1a4c15@mail.gmail.com> Is your windows compiler doing automatic parallelization by chance? Twice as fast on a dual core processor is a bit too coincidental. :-) On 3/8/07, Shane R wrote: > Hi, > > I hope this is the appropriate forum. Please direct me to the correct one if > it is not. > > I am trying to optimize a c++ application that I ported from a windows > system to Linux. > The app is a terminal based application that does some one time file io at > the start then runs completely in memory. After the one time io the app runs > successive timed epochs on the same data in Windows as Linux. The app is a > program that runs some code for doing non-linear optmization (math stuff). > > The reason why I am posting is that I timed the time it takes for the > application to complete an epoch. It take twice as long in Linux as > windows?!?! > > My system is an Intel Centrino Duo with 2gigs of ram. The application is > only using a fraction of available memory in windows and linux. The > application is single-threaded in both. > > I am using Visual Studio 2003 in Windows and when I type gcc -v I get: > Target: i486-linux-gnu > Configured with: ../src/configure -v > --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr > --enable-shared --with-system-zlib --libexecdir=/usr/lib > --without-included-gettext --enable-threads=posix --enable-nls > --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu > --enable-libstdcxx-debug --enable-mpfr --enable-checking=release > i486-linux-gnu > Thread model: posix > gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) > > > > I am currently using these g++ options: > > CFLAGS = -o3 -O3 -march=pentium4 -ffast-math -funroll-loops -Wall > -Wno-return-type > > But I have tried every permutation of the above options to virtually no > effect > > The average run time of an epoch in windows is about 3000 milliseconds while > the average run time of an epoch in Linux is 6000! > > I don't know if it matters but I am doing calls to the rand() function in > both my windows and linux apps. > > On another note does anyone have any experience with the Intel drop in > replacement for GCC? > > Thanks in advance for any help, > > Shane > > _________________________________________________________________ > Match.com - Click Here To Find Singles In Your Area Today! > http://match.engb.msn.com/ > > -- Lawrence Crowl From arturas.moskvinas@gmail.com Mon Mar 12 23:13:00 2007 From: arturas.moskvinas@gmail.com (=?UTF-8?B?QXJ0xatyYXMgTW9za3ZpbmFz?=) Date: Mon, 12 Mar 2007 23:13:00 -0000 Subject: Linux c++ opmization--- linux runs at half the speed of windows? In-Reply-To: <29bd08b70703121442t199859d7h3c0159c2dc1a4c15@mail.gmail.com> References: <29bd08b70703121442t199859d7h3c0159c2dc1a4c15@mail.gmail.com> Message-ID: <45F5CECE.7060605@gmail.com> Hi, You should try profiling, it should help you to find the place were program is taking longest (gprof). Maybe you use some floating point operations??? Commercial compilers often like to use non IEEE compliant floating operations, try -ffast-math... > Is your windows compiler doing automatic parallelization by chance? > Twice as fast on a dual core processor is a bit too coincidental. :-) > > On 3/8/07, Shane R wrote: >> Hi, >> >> I hope this is the appropriate forum. Please direct me to the correct >> one if >> it is not. >> >> I am trying to optimize a c++ application that I ported from a windows >> system to Linux. >> The app is a terminal based application that does some one time file >> io at >> the start then runs completely in memory. After the one time io the >> app runs >> successive timed epochs on the same data in Windows as Linux. The app >> is a >> program that runs some code for doing non-linear optmization (math >> stuff). >> >> The reason why I am posting is that I timed the time it takes for the >> application to complete an epoch. It take twice as long in Linux as >> windows?!?! >> >> My system is an Intel Centrino Duo with 2gigs of ram. The application is >> only using a fraction of available memory in windows and linux. The >> application is single-threaded in both. >> >> I am using Visual Studio 2003 in Windows and when I type gcc -v I get: >> Target: i486-linux-gnu >> Configured with: ../src/configure -v >> --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr >> --enable-shared --with-system-zlib --libexecdir=/usr/lib >> --without-included-gettext --enable-threads=posix --enable-nls >> --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu >> --enable-libstdcxx-debug --enable-mpfr --enable-checking=release >> i486-linux-gnu >> Thread model: posix >> gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) >> >> >> >> I am currently using these g++ options: >> >> CFLAGS = -o3 -O3 -march=pentium4 -ffast-math -funroll-loops -Wall >> -Wno-return-type >> >> But I have tried every permutation of the above options to virtually no >> effect >> >> The average run time of an epoch in windows is about 3000 milliseconds >> while >> the average run time of an epoch in Linux is 6000! >> >> I don't know if it matters but I am doing calls to the rand() function in >> both my windows and linux apps. >> >> On another note does anyone have any experience with the Intel drop in >> replacement for GCC? >> >> Thanks in advance for any help, >> >> Shane >> >> _________________________________________________________________ >> Match.com - Click Here To Find Singles In Your Area Today! >> http://match.engb.msn.com/ >> >> > > From john.carter@tait.co.nz Mon Mar 12 23:49:00 2007 From: john.carter@tait.co.nz (John Carter) Date: Mon, 12 Mar 2007 23:49:00 -0000 Subject: Linux c++ opmization--- linux runs at half the speed of windows? In-Reply-To: References: Message-ID: On Thu, 8 Mar 2007, Shane R wrote: > I am trying to optimize a c++ application that I ported from a windows system > to Linux. 1. Do you use gcc under windows as well? If so which version on windows and which on Linux? gcc is not the best optimizer in the world.... 2. Run... vmstat 5 for a half a page whilst your app is running and post that. 3. Watch "top", is your CPU running at 100%? Is it very near 100% in user mode? Is your particular app running at very near 100% in user mode? 4. Run your app under "strace" and see what it's doing. 5. -O3 and -funroll-loops does not necessarily improve things if it destroys the cache utility. 6. -O2 -fomit-frame-pointer -march=WHATEVERAPPROPRIATE may do better. 7. My general experience is Linux Apps run significantly faster than windows. 8. Fire up gkrellm. Hmm you say you have a centrino duo, does that mean it has dual cores? Does gkrellm show you have two CPU's running? ie. Do you have the right kernel for your Dual core? > The app is a terminal based application that does some one time file io at > the start then runs completely in memory. Does it read/write lots to any file / device eg. terminal? John Carter Phone : (64)(3) 358 6639 Tait Electronics Fax : (64)(3) 359 4632 PO Box 1645 Christchurch Email : john.carter@tait.co.nz New Zealand From david@carter-hitchin.clara.co.uk Tue Mar 13 03:28:00 2007 From: david@carter-hitchin.clara.co.uk (DCH) Date: Tue, 13 Mar 2007 03:28:00 -0000 Subject: -fdump-tree-all documentation. In-Reply-To: <3B4C77997DD0254B86D3C9454476B6BC0F03EC1D@lonms00812.fm.rbs grp.net> References: <3B4C77997DD0254B86D3C9454476B6BC0F03EC1D@lonms00812.fm.rbsgrp.net> Message-ID: Hi GCC'ers Forgive me if I've missed something obvious, but does anyone know if the output from -fdump-tree-all is documented somewhere? I was trying to understand a vexing C++ parse the other day and having such documents would have helped. Many Thanks, David. From clumsguy@gmail.com Tue Mar 13 07:03:00 2007 From: clumsguy@gmail.com (mike xu) Date: Tue, 13 Mar 2007 07:03:00 -0000 Subject: Does gcc-2.95 support such function? In-Reply-To: <7103aeea0703122022k2d050e55n5ed17f539af923be@mail.gmail.com> References: <7103aeea0703122022k2d050e55n5ed17f539af923be@mail.gmail.com> Message-ID: <7103aeea0703122028o21273170m7b384f890f8dcf10@mail.gmail.com> Hello, I want to use gcc to collect all the parameter's value used by one function in all my source code during compile time. But I am not sure of that gcc supports this or not? Below is an example: $grep ConfigGetParam * -r src/addon_util.c:789: ConfigGetParam("T1", chParamValue, CONFIG_MAXPARAMLENGTH); src/bdgporttable.c:128: ConfigGetParam(Name, tempBuf, CONFIG_MAXPARAMLENGTH); src/agent.c:2534: ConfigStatus = ConfigGetParam("SNMP", oBuffer, MAX_MAXPARAMLENGTH); ... The result I expected is a list of the values of ConfigGetParam function's first parameter, if src/bdgporttable.c:128: Name="WHOAMI", then the list is: "T1" "WHOAMI" "SNMP" ... Does gcc have such feature? If it supports, which parameter I shall assign to gcc during compile time? Thanks a lot, Mike From lordgalloth@gmail.com Tue Mar 13 08:57:00 2007 From: lordgalloth@gmail.com (Galloth) Date: Tue, 13 Mar 2007 08:57:00 -0000 Subject: Linux c++ opmization--- linux runs at half the speed of windows? In-Reply-To: <29bd08b70703121442t199859d7h3c0159c2dc1a4c15@mail.gmail.com> References: <29bd08b70703121442t199859d7h3c0159c2dc1a4c15@mail.gmail.com> Message-ID: <5abcb5650703130003q4669159fx3d04a97f016e275d@mail.gmail.com> hi, is it possible, that Your windows compiler is able to optimize for Core or Core2 processors? Pentium4 is not Dual Core. Intel rebuild the whole processor. Jan K 2007/3/12, Lawrence Crowl : > Is your windows compiler doing automatic parallelization by chance? > Twice as fast on a dual core processor is a bit too coincidental. :-) > > On 3/8/07, Shane R wrote: > > Hi, > > > > I hope this is the appropriate forum. Please direct me to the correct one if > > it is not. > > > > I am trying to optimize a c++ application that I ported from a windows > > system to Linux. > > The app is a terminal based application that does some one time file io at > > the start then runs completely in memory. After the one time io the app runs > > successive timed epochs on the same data in Windows as Linux. The app is a > > program that runs some code for doing non-linear optmization (math stuff). > > > > The reason why I am posting is that I timed the time it takes for the > > application to complete an epoch. It take twice as long in Linux as > > windows?!?! > > > > My system is an Intel Centrino Duo with 2gigs of ram. The application is > > only using a fraction of available memory in windows and linux. The > > application is single-threaded in both. > > > > I am using Visual Studio 2003 in Windows and when I type gcc -v I get: > > Target: i486-linux-gnu > > Configured with: ../src/configure -v > > --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr > > --enable-shared --with-system-zlib --libexecdir=/usr/lib > > --without-included-gettext --enable-threads=posix --enable-nls > > --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu > > --enable-libstdcxx-debug --enable-mpfr --enable-checking=release > > i486-linux-gnu > > Thread model: posix > > gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) > > > > > > > > I am currently using these g++ options: > > > > CFLAGS = -o3 -O3 -march=pentium4 -ffast-math -funroll-loops -Wall > > -Wno-return-type > > > > But I have tried every permutation of the above options to virtually no > > effect > > > > The average run time of an epoch in windows is about 3000 milliseconds while > > the average run time of an epoch in Linux is 6000! > > > > I don't know if it matters but I am doing calls to the rand() function in > > both my windows and linux apps. > > > > On another note does anyone have any experience with the Intel drop in > > replacement for GCC? > > > > Thanks in advance for any help, > > > > Shane > > > > _________________________________________________________________ > > Match.com - Click Here To Find Singles In Your Area Today! > > http://match.engb.msn.com/ > > > > > > > -- > Lawrence Crowl > -- Jan Kastil galloth@jabbim.cz From aph@redhat.com Tue Mar 13 09:41:00 2007 From: aph@redhat.com (Andrew Haley) Date: Tue, 13 Mar 2007 09:41:00 -0000 Subject: -fdump-tree-all documentation. In-Reply-To: <200703122349.l2CNnjOg000953@mx1.redhat.com> References: <3B4C77997DD0254B86D3C9454476B6BC0F03EC1D@lonms00812.fm.rbsgrp.net> <200703122349.l2CNnjOg000953@mx1.redhat.com> Message-ID: <17910.26477.347058.814071@zebedee.pink> DCH writes: > Forgive me if I've missed something obvious, but does anyone > know if the output from -fdump-tree-all is documented somewhere? It's C, more or less, except for a few additions such as Phi nodes. Which part are you having difficulty with? Andrew. From aph@redhat.com Tue Mar 13 14:51:00 2007 From: aph@redhat.com (Andrew Haley) Date: Tue, 13 Mar 2007 14:51:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: Message-ID: <17910.29117.938526.285262@zebedee.pink> Matthew Woehlke writes: > I have a code snippet that looks roughly like this: > > extern void my_free(void* ptr); > > int foo() > { > volatile long * bar; > ... > my_free(bar); > } > > This generates the warning 'cast discards qualifiers from pointer target > type' at my_free() (gcc 3.4.3). Other than disabling the flag that > generates the warning (in general I want these warnings!), how do I > suppress this? my_free is of course a free() wrapper, i.e. I don't see > any problems discarding the qualifier at this point. I already tried > this, which seems like it used to work (I am moving the code from one > project to another): > > my_free(void*)bar); > > ...and it doesn't help. I think this is bad practice. You'd be far better advised to malloc() the memory, keep a void* pointer to it, but cast to volatile long * when volatile is actually required. Andrew. From ndenmark@googlemail.com Tue Mar 13 15:21:00 2007 From: ndenmark@googlemail.com (Nate Denmark) Date: Tue, 13 Mar 2007 15:21:00 -0000 Subject: Optimisation puzzle Message-ID: Hello all, I have a question about the optimiser in GCC. Take this bit of code: for(x = 0; x != 10; x++) puts("Hello"); When compiled with full optimisations (-O3, -fexpensive-optimizations etc.) it generates the following loop in assembly: .L2: incl %ebx movl $.LC0, (%esp) call puts cmpl $10, %ebx jne .L2 .LC0 points to the "Hello" string. I'm wondering why GCC puts that 'movl' line inside the loop, so that it's executed each time, when it could go before the loop? As I understand it, 'puts' shouldn't do anything to the stack, and the return value is passed back in eax, so I'm not sure why it's doing the 'movl' each time. If I force loop unrolling the same thing happens -- the 'movl' each iteration. That said, I don't know much about compiler design so I'm probably missing something here! Thanks, Nate From iant@google.com Tue Mar 13 15:25:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Tue, 13 Mar 2007 15:25:00 -0000 Subject: Optimisation puzzle In-Reply-To: References: Message-ID: "Nate Denmark" writes: > I have a question about the optimiser in GCC. Take this bit of code: > > for(x = 0; x != 10; x++) > puts("Hello"); > > When compiled with full optimisations (-O3, -fexpensive-optimizations > etc.) it generates the following loop in assembly: > > .L2: > incl %ebx > movl $.LC0, (%esp) > call puts > cmpl $10, %ebx > jne .L2 > > .LC0 points to the "Hello" string. I'm wondering why GCC puts that > 'movl' line inside the loop, so that it's executed each time, when it > could go before the loop? As I understand it, 'puts' shouldn't do > anything to the stack, and the return value is passed back in eax, so > I'm not sure why it's doing the 'movl' each time. If I force loop > unrolling the same thing happens -- the 'movl' each iteration. Technically the parameters pushed on the stack become the property of the function being called. For example, code like this: int foo (int a) { int *p = &a; *p = 1; return *p; } could be compiled to change the value pushed on the stack. Since gcc doesn't know how puts is implemented, it can't assume that puts does not change the value on the stack. So it has to restore the value before each call, just in case. Ian From iant@google.com Tue Mar 13 15:27:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Tue, 13 Mar 2007 15:27:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <17910.29117.938526.285262@zebedee.pink> References: <17910.29117.938526.285262@zebedee.pink> Message-ID: Andrew Haley writes: > Matthew Woehlke writes: > > I have a code snippet that looks roughly like this: > > > > extern void my_free(void* ptr); > > > > int foo() > > { > > volatile long * bar; > > ... > > my_free(bar); > > } > > > > This generates the warning 'cast discards qualifiers from pointer target > > type' at my_free() (gcc 3.4.3). Other than disabling the flag that > > generates the warning (in general I want these warnings!), how do I > > suppress this? my_free is of course a free() wrapper, i.e. I don't see > > any problems discarding the qualifier at this point. I already tried > > this, which seems like it used to work (I am moving the code from one > > project to another): > > > > my_free(void*)bar); > > > > ...and it doesn't help. > > I think this is bad practice. You'd be far better advised to malloc() > the memory, keep a void* pointer to it, but cast to volatile long * > when volatile is actually required. Note that this is also somewhat dubious on a strict reading of the C standard. The standard discusss access to volatile qualified objects, and it says that casting away volatile is undefined. The standard says absolutely nothing about volatile qualified pointers to non-volatile objects. So you should not expect any particular semantics from a volatile-qualified pointer which points to a non-volatile-qualified object. Ian From aph@redhat.com Tue Mar 13 15:51:00 2007 From: aph@redhat.com (Andrew Haley) Date: Tue, 13 Mar 2007 15:51:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: <17910.29117.938526.285262@zebedee.pink> Message-ID: <17910.49874.908961.521088@zebedee.pink> Ian Lance Taylor writes: > Andrew Haley writes: > > > Matthew Woehlke writes: > > > I have a code snippet that looks roughly like this: > > > > > > extern void my_free(void* ptr); > > > > > > int foo() > > > { > > > volatile long * bar; > > > ... > > > my_free(bar); > > > } > > > > > > This generates the warning 'cast discards qualifiers from pointer target > > > type' at my_free() (gcc 3.4.3). Other than disabling the flag that > > > generates the warning (in general I want these warnings!), how do I > > > suppress this? my_free is of course a free() wrapper, i.e. I don't see > > > any problems discarding the qualifier at this point. I already tried > > > this, which seems like it used to work (I am moving the code from one > > > project to another): > > > > > > my_free(void*)bar); > > > > > > ...and it doesn't help. > > > > I think this is bad practice. You'd be far better advised to malloc() > > the memory, keep a void* pointer to it, but cast to volatile long * > > when volatile is actually required. > > Note that this is also somewhat dubious on a strict reading of the C > standard. The standard discusss access to volatile qualified objects, > and it says that casting away volatile is undefined. The standard > says absolutely nothing about volatile qualified pointers to > non-volatile objects. So you should not expect any particular > semantics from a volatile-qualified pointer which points to a > non-volatile-qualified object. Mmmm, but let's say you want a dynamic shared buffer between threads. How else would you do it, other than a malloc() and a cast? Andrew. From iant@google.com Tue Mar 13 15:58:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Tue, 13 Mar 2007 15:58:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <17910.49874.908961.521088@zebedee.pink> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> Message-ID: Andrew Haley writes: > Ian Lance Taylor writes: > > Note that this is also somewhat dubious on a strict reading of the C > > standard. The standard discusss access to volatile qualified objects, > > and it says that casting away volatile is undefined. The standard > > says absolutely nothing about volatile qualified pointers to > > non-volatile objects. So you should not expect any particular > > semantics from a volatile-qualified pointer which points to a > > non-volatile-qualified object. > > Mmmm, but let's say you want a dynamic shared buffer between threads. > How else would you do it, other than a malloc() and a cast? volatile won't help you there anyhow. If you follow the standard, there is exactly one thing you can reliably do with volatile: use it to access a memory mapped device register. volatile doesn't help when sharing a memory buffer between threads because volatile carries no implication of a read/write memory barrier. If you are on a multi-core SMP system, and the threads are running on different cores, and you don't use any explicit memory fence machine instructions, then the processors are completely free to rearrange the memory accesses with respect to each other. That is, each processor will provide a consistent view of memory within the processor, but the two processors will not provide consistent views of memory with respect to each other. This happens in practice, not just in theory, because each processor has its own local cache. That means that the only correct way to share a memory buffer between threads is to use a mutex, and it means that the mutex code can not be written in standard conformant C. The mutex code must use asm statements to insert memory barriers as required (on the x86 a lock prefix serves as a memory barrier (except that some specific x86 processors have bugs, but I digress...)). And once you are using a mutex, there is no reason to use volatile. Using volatile will give you no extra protection, it will merely cost you some efficiency. Ian From aph@redhat.com Tue Mar 13 16:01:00 2007 From: aph@redhat.com (Andrew Haley) Date: Tue, 13 Mar 2007 16:01:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> Message-ID: <17910.51750.756198.304591@zebedee.pink> Ian Lance Taylor writes: > Andrew Haley writes: > > > Ian Lance Taylor writes: > > > > Note that this is also somewhat dubious on a strict reading of the C > > > standard. The standard discusss access to volatile qualified objects, > > > and it says that casting away volatile is undefined. The standard > > > says absolutely nothing about volatile qualified pointers to > > > non-volatile objects. So you should not expect any particular > > > semantics from a volatile-qualified pointer which points to a > > > non-volatile-qualified object. > > > > Mmmm, but let's say you want a dynamic shared buffer between threads. > > How else would you do it, other than a malloc() and a cast? > > volatile won't help you there anyhow. If you follow the standard, > there is exactly one thing you can reliably do with volatile: use it > to access a memory mapped device register. > > volatile doesn't help when sharing a memory buffer between threads > because volatile carries no implication of a read/write memory > barrier. If you are on a multi-core SMP system, and the threads are > running on different cores, and you don't use any explicit memory > fence machine instructions, then the processors are completely free to > rearrange the memory accesses with respect to each other. That is, > each processor will provide a consistent view of memory within the > processor, but the two processors will not provide consistent views of > memory with respect to each other. This happens in practice, not just > in theory, because each processor has its own local cache. > > That means that the only correct way to share a memory buffer between > threads is to use a mutex, and it means that the mutex code can not be > written in standard conformant C. The mutex code must use asm > statements to insert memory barriers as required (on the x86 a lock > prefix serves as a memory barrier (except that some specific x86 > processors have bugs, but I digress...)). > > And once you are using a mutex, there is no reason to use volatile. > Using volatile will give you no extra protection, it will merely cost > you some efficiency. I didn't mean to suggest that volatile would necessarily be sufficient, but that it would be necessary. Surely the compiler needs to know that the buffer is volatile, or what's to stop it re-ordering accesses around the asm statements that are the memory barriers? I know that in gcc we add a memory clobber to such asms, but that isn't generally true. OK, if we have POSIX threads we also have POSIX mutexes... I suppse we have to ask the OP why he's using volatile. Andrew. From kpfleming@starnetworks.us Tue Mar 13 16:02:00 2007 From: kpfleming@starnetworks.us (Kevin P. Fleming) Date: Tue, 13 Mar 2007 16:02:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> Message-ID: <45F6CAB2.1050008@starnetworks.us> Ian Lance Taylor wrote: > That means that the only correct way to share a memory buffer between > threads is to use a mutex, and it means that the mutex code can not be > written in standard conformant C. The mutex code must use asm > statements to insert memory barriers as required (on the x86 a lock > prefix serves as a memory barrier (except that some specific x86 > processors have bugs, but I digress...)). This comment makes me curious, since I see (and work on) plenty of code that shares data structures between threads using only a mutex for protection and no memory barrier instructions of any kind. This code is using standard POSIX threading constructs and seems to work fine on multi-CPU and multi-core systems, both x86 and other flavors. Are you referring to a specific sort of memory sharing between threads here, or are you saying that you think that _all_ objects shared between threads need to be protected in this way? From iant@google.com Tue Mar 13 16:06:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Tue, 13 Mar 2007 16:06:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <17910.51750.756198.304591@zebedee.pink> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <17910.51750.756198.304591@zebedee.pink> Message-ID: Andrew Haley writes: > I didn't mean to suggest that volatile would necessarily be > sufficient, but that it would be necessary. Surely the compiler needs > to know that the buffer is volatile, or what's to stop it re-ordering > accesses around the asm statements that are the memory barriers? I > know that in gcc we add a memory clobber to such asms, but that isn't > generally true. OK, if we have POSIX threads we also have POSIX > mutexes... Right: you have to use a mutex for correctness, and the mutex has to be magic. And once you use a magic mutex, using volatile doesn't make any difference. Ian From iant@google.com Tue Mar 13 16:09:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Tue, 13 Mar 2007 16:09:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <45F6CAB2.1050008@starnetworks.us> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> Message-ID: "Kevin P. Fleming" writes: > Ian Lance Taylor wrote: > > That means that the only correct way to share a memory buffer between > > threads is to use a mutex, and it means that the mutex code can not be > > written in standard conformant C. The mutex code must use asm > > statements to insert memory barriers as required (on the x86 a lock > > prefix serves as a memory barrier (except that some specific x86 > > processors have bugs, but I digress...)). > > This comment makes me curious, since I see (and work on) plenty of code > that shares data structures between threads using only a mutex for > protection and no memory barrier instructions of any kind. This code is > using standard POSIX threading constructs and seems to work fine on > multi-CPU and multi-core systems, both x86 and other flavors. The mutex code itself, assuming it is written correctly, provides the required memory barriers. > Are you referring to a specific sort of memory sharing between threads > here, or are you saying that you think that _all_ objects shared between > threads need to be protected in this way? All objects shared between threads need to protected by a mutex, or by some other type of memory barrier. Ian From aph@redhat.com Tue Mar 13 16:13:00 2007 From: aph@redhat.com (Andrew Haley) Date: Tue, 13 Mar 2007 16:13:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> Message-ID: <17910.52394.276700.319625@zebedee.pink> Ian Lance Taylor writes: > > All objects shared between threads need to protected by a mutex, or by > some other type of memory barrier. It's an interesting contention -- that in GNU/Linux userspace there are essentially no legitimate uses for volatile. Hmmmm... Andrew. From noel.yap@gmail.com Tue Mar 13 16:23:00 2007 From: noel.yap@gmail.com (Noel Yap) Date: Tue, 13 Mar 2007 16:23:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <17910.52394.276700.319625@zebedee.pink> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> Message-ID: <70d0a1130703130913y490dff72x2434dde69203cfb9@mail.gmail.com> IIRC, volatile is used when the memory is outside of the program's control (eg written to by external hardware). Noel On 3/13/07, Andrew Haley wrote: > Ian Lance Taylor writes: > > > > All objects shared between threads need to protected by a mutex, or by > > some other type of memory barrier. > > It's an interesting contention -- that in GNU/Linux userspace there > are essentially no legitimate uses for volatile. Hmmmm... > > Andrew. > From iant@google.com Tue Mar 13 16:25:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Tue, 13 Mar 2007 16:25:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <17910.52394.276700.319625@zebedee.pink> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> Message-ID: Andrew Haley writes: > Ian Lance Taylor writes: > > > > All objects shared between threads need to protected by a mutex, or by > > some other type of memory barrier. > > It's an interesting contention -- that in GNU/Linux userspace there > are essentially no legitimate uses for volatile. Hmmmm... There is one legitimate use: the C standard blesses the specific case of "volatile sig_atomic_t". A signal handler can reliably access a variable of that type. I don't think there is any other reason to use volatile in userspace. It simply does not mean what it seems to mean. Ian From kpfleming@starnetworks.us Tue Mar 13 16:33:00 2007 From: kpfleming@starnetworks.us (Kevin P. Fleming) Date: Tue, 13 Mar 2007 16:33:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> Message-ID: <45F6D063.4090506@starnetworks.us> Ian Lance Taylor wrote: > The mutex code itself, assuming it is written correctly, provides the > required memory barriers. OK, that's what I hoped you would say :-) Thanks for the clarification. From iant@google.com Tue Mar 13 16:52:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Tue, 13 Mar 2007 16:52:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <70d0a1130703130913y490dff72x2434dde69203cfb9@mail.gmail.com> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> <70d0a1130703130913y490dff72x2434dde69203cfb9@mail.gmail.com> Message-ID: "Noel Yap" writes: > IIRC, volatile is used when the memory is outside of the program's > control (eg written to by external hardware). Yes--which can not happen in GNU/Linux userspace. Ian From eager@eagercon.com Tue Mar 13 16:54:00 2007 From: eager@eagercon.com (Michael Eager) Date: Tue, 13 Mar 2007 16:54:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <17910.52394.276700.319625@zebedee.pink> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> Message-ID: <45F6D6A6.2000300@eagercon.com> Andrew Haley wrote: > Ian Lance Taylor writes: > > > > All objects shared between threads need to protected by a mutex, or by > > some other type of memory barrier. > > It's an interesting contention -- that in GNU/Linux userspace there > are essentially no legitimate uses for volatile. Hmmmm... I think that is an over-generalization. There are uses for volatile in user code, but they are limited. Volatile is needed in the code which implements a mutex. Volatile is needed when accessing a machine register, or an OS variable (e.g., system time, errno) so that the latest value is fetched or set, rather than being optimized away. It can also be used to share data between threads, but it becomes problematic if accesses are not atomic. It's reasonable to use a shared volatile sig_atomic_t to communicate between threads, to say "I'm done" or "Start processing". Non-atomic operations may pick up data which is inconsistent. Using a volatile pointer to a shared memory guarantees that each read/write of the buffer will be generated, even when it appears to the compiler that there are redundant accesses. But, and I think this is Ian's point, unless access to this shared buffer is protected by a mutex, the data may be garbled. -- Michael Eager eager@eagercon.com 1960 Park Blvd., Palo Alto, CA 94306 650-325-8077 From aph@redhat.com Tue Mar 13 16:58:00 2007 From: aph@redhat.com (Andrew Haley) Date: Tue, 13 Mar 2007 16:58:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> Message-ID: <17910.55089.390780.927653@zebedee.pink> Ian Lance Taylor writes: > Andrew Haley writes: > > > Ian Lance Taylor writes: > > > > > > All objects shared between threads need to protected by a mutex, or by > > > some other type of memory barrier. > > > > It's an interesting contention -- that in GNU/Linux userspace there > > are essentially no legitimate uses for volatile. Hmmmm... > > There is one legitimate use: the C standard blesses the specific case > of "volatile sig_atomic_t". A signal handler can reliably access a > variable of that type. > > I don't think there is any other reason to use volatile in userspace. I just thought of another one -- auto variables that are local to a function that contains the invocation of a setjmp macro. Andrew. From aph@redhat.com Tue Mar 13 17:32:00 2007 From: aph@redhat.com (Andrew Haley) Date: Tue, 13 Mar 2007 17:32:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <45F6D6A6.2000300@eagercon.com> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> <45F6D6A6.2000300@eagercon.com> Message-ID: <17910.55346.39652.519778@zebedee.pink> Michael Eager writes: > Andrew Haley wrote: > > Ian Lance Taylor writes: > > > > > > All objects shared between threads need to protected by a mutex, or by > > > some other type of memory barrier. > > > > It's an interesting contention -- that in GNU/Linux userspace there > > are essentially no legitimate uses for volatile. Hmmmm... > > I think that is an over-generalization. > > There are uses for volatile in user code, but they are limited. > Volatile is needed in the code which implements a mutex. I think that falls into Ian's category of "magic". > Volatile is needed when accessing a machine register, or an OS > variable (e.g., system time, errno) so that the latest value is > fetched or set, rather than being optimized away. > > It can also be used to share data between threads, but it becomes > problematic if accesses are not atomic. It's reasonable to use a > shared volatile sig_atomic_t to communicate between threads, to say > "I'm done" or "Start processing". Is that really safe, though? There's nothing to stop the machine from reordering memory writes, even if the compiler doesn't. Andrew. From osv@javad.com Tue Mar 13 19:29:00 2007 From: osv@javad.com (Sergei Organov) Date: Tue, 13 Mar 2007 19:29:00 -0000 Subject: how to cast away 'volatile'? References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> Message-ID: Ian Lance Taylor writes: [...] > And once you are using a mutex, there is no reason to use volatile. > Using volatile will give you no extra protection, it will merely cost > you some efficiency. Yes, that's how it is intended to work. However practice may vary. Some time ago there was an interesting example posted in a newsgroup[1]. The initial program was: for (...) { if (...) pthread_mutex_lock(...); x = ... x ... if (...) pthread_mutex_unlock(...); } and compiler did the following transformation that breaks thread-safety ('r' is register): r = x; for (...) { if (...) { x = r; pthread_mutex_lock(...); r = x; } r = ... r ... if (...) { x = r; pthread_mutex_unlock(...); r = x; } } x = r; This transformation seems to be OK both from the C language POV and from pthread standard POV (though the latter obviously was not intentional), but it creates accesses to 'x' outside of the mutex-protected section that in turn breaks thread-safety. Making 'x' volatile would prevent such an optimization in practice, isn't it? [1] See for details. -- Sergei. From mw_triad@users.sourceforge.net Tue Mar 13 19:30:00 2007 From: mw_triad@users.sourceforge.net (Matthew Woehlke) Date: Tue, 13 Mar 2007 19:30:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <17910.55346.39652.519778@zebedee.pink> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> <45F6D6A6.2000300@eagercon.com> <17910.55346.39652.519778@zebedee.pink> Message-ID: Andrew Haley wrote: > Michael Eager writes: >> It can also be used to share data between threads, but it becomes >> problematic if accesses are not atomic. It's reasonable to use a >> shared volatile sig_atomic_t to communicate between threads, to say >> "I'm done" or "Start processing". > > Is that really safe, though? There's nothing to stop the machine from > reordering memory writes, even if the compiler doesn't. ...my understanding is that is exactly what 'fence' is for. (Although I have yet to meet a processor that doesn't SIGILL when I try to use it :-). So I stick with e.g. 'lock or 0,%sp'...) -- Matthew HIPPOS feel unacknowledged. HIPPOS get angry. > PRAISE HIPPOS HIPPOS seem somewhat placated. From mw_triad@users.sourceforge.net Tue Mar 13 19:50:00 2007 From: mw_triad@users.sourceforge.net (Matthew Woehlke) Date: Tue, 13 Mar 2007 19:50:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <17910.51750.756198.304591@zebedee.pink> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <17910.51750.756198.304591@zebedee.pink> Message-ID: Andrew Haley wrote: > I suppse we have to ask the OP why he's using volatile. Ok, I guess I should answer that. It's part of a typedef that is essentially 'typedef volatile long atom_t', i.e. the type that is passed to atomicAdd, atomicSwap, etc functions (which are of course written with inline assembler using 'lock' - the memory barriers are handled). Also because atomicRead is a no-op to simply read the value, since this is safe. So I'm expecting 'volatile' to a: discourage compilers from doing stupid reordering to the code, like say putting the read before a call to atomicXyz, and b: force a re-read from memory (in case some other thread is changing the value) rather than using a cached value. Now I'm wondering if maybe I should just drop the volatile, but I'm not sure I trust doing that...? Michael Eager's post makes it sound like I am in exactly the few cases where use of 'volatile' is appropriate. Oh, and did I mention I'm actually implementing lightweight mutexes? :-) I can't use pthread mutexes; this code is supposed to build on Windows and Solaris also (Solaris has pthread mutexes but not the FAST/ADAPTIVE type AFAIK). -- Matthew HIPPOS feel unacknowledged. HIPPOS get angry. > PRAISE HIPPOS HIPPOS seem somewhat placated. From eager@eagercon.com Tue Mar 13 20:41:00 2007 From: eager@eagercon.com (Michael Eager) Date: Tue, 13 Mar 2007 20:41:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <17910.55346.39652.519778@zebedee.pink> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> <45F6D6A6.2000300@eagercon.com> <17910.55346.39652.519778@zebedee.pink> Message-ID: <45F70096.3020504@eagercon.com> Andrew Haley wrote: > Michael Eager writes: > > It can also be used to share data between threads, but it becomes > > problematic if accesses are not atomic. It's reasonable to use a > > shared volatile sig_atomic_t to communicate between threads, to say > > "I'm done" or "Start processing". > > Is that really safe, though? There's nothing to stop the machine from > reordering memory writes, even if the compiler doesn't. Yes, it's safe. It doesn't matter which microsecond that the flag is set. (Or if it does, then your code should be using a mutex or some other form of synchronization.) Say you have one thread which performs some process when it sees a shared flag set. It checks this flag every second. If another process sets this flag, the service thread will notice and take action. If the signaling process and the receiving process both try to access the shared memory at the same time, the processor may reorder the operations as it chooses. The worst case is that the server will check and see that the flag is not set, then the signaling process will set the flag. The result is a short delay in the receiving process noticing that the flag is set. Note that there is a race condition which is problematic. If the receiving process clears the flag, at the same time that the signaling process sets it, then these may be reordered. So you need to insure that only one of the processes ever writes to the flag. -- Michael Eager eager@eagercon.com 1960 Park Blvd., Palo Alto, CA 94306 650-325-8077 From aph@redhat.com Tue Mar 13 20:41:00 2007 From: aph@redhat.com (Andrew Haley) Date: Tue, 13 Mar 2007 20:41:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> <45F6D6A6.2000300@eagercon.com> <17910.55346.39652.519778@zebedee.pink> Message-ID: <17911.3175.828023.748009@zebedee.pink> Matthew Woehlke writes: > Andrew Haley wrote: > > Michael Eager writes: > >> It can also be used to share data between threads, but it becomes > >> problematic if accesses are not atomic. It's reasonable to use a > >> shared volatile sig_atomic_t to communicate between threads, to say > >> "I'm done" or "Start processing". > > > > Is that really safe, though? There's nothing to stop the machine from > > reordering memory writes, even if the compiler doesn't. > > ...my understanding is that is exactly what 'fence' is for. That's my understanding too. Here, we're really talking about non-x86 processors which have much weaker ordering guarantees. Andrew. From david@carter-hitchin.clara.co.uk Tue Mar 13 20:44:00 2007 From: david@carter-hitchin.clara.co.uk (DCH) Date: Tue, 13 Mar 2007 20:44:00 -0000 Subject: -fdump-tree-all documentation. In-Reply-To: <17910.26477.347058.814071@zebedee.pink> References: <3B4C77997DD0254B86D3C9454476B6BC0F03EC1D@lonms00812.fm.rbsgrp.net> <200703122349.l2CNnjOg000953@mx1.redhat.com> <17910.26477.347058.814071@zebedee.pink> Message-ID: Hi Andrew et alumni, At 08:57 13/03/2007, Andrew Haley wrote: >DCH writes: > > > Forgive me if I've missed something obvious, but does anyone > > know if the output from -fdump-tree-all is documented somewhere? > >It's C, more or less, except for a few additions such as Phi nodes. I guess that means no :-) Looks nothing like C to me, but there again I'm used to looking a normal type C, not some kind of parsed C. >Which part are you having difficulty with? Well, most of it really. Basically someone posted this to ACCU-general a while ago: ==================================================== struct no_default_ctor { no_default_ctor(int i) : m_i(i) { }; ~no_default_ctor() { }; private: no_default_ctor(); const int m_i; }; // Why is `no_default_ctor(Anint)' below a syntax error? const int Anint = 3; int foo() { no_default_ctor name(Anint); // This works. no_default_ctor(Anint); // This gives me a syntax error. no_default_ctor(3); // But this does not. (no_default_ctor)(Anint); // And neither does this. } ==================================================== It provoked some discussion, the outcome of that was rather unclear. I thought at least I could pass it into GCC to see how no_default_ctor(Anint) is parsed and got the following output. I think I decided at the time that it was being interpreted as a function-style cast, but then I wasn't sure, and now I can't even see that for some reason. There was some discussion if it was a cast or a declaration. There are a couple of references in the output below to line 13 but I don't know the syntax here to unwind it. ;; Function int foo() (_Z3foov) ;; enabled by -fdump-tree-original @1 function_decl name: @2 mngl: @3 type: @4 srcp: ctors_orig.cpp:12 extern body: @5 @2 identifier_node strg: foo lngt: 3 @3 identifier_node strg: _Z3foov lngt: 7 @4 function_type size: @6 algn: 64 retn: @7 prms: @8 @5 compound_stmt line: 17 body: @9 @6 integer_cst type: @10 low : 64 @7 integer_type name: @11 size: @12 algn: 32 prec: 32 min : @13 max : @14 @8 tree_list valu: @15 @9 scope_stmt line: 12 begn clnp next: @16 @10 integer_type name: @17 size: @6 algn: 64 prec: 36 unsigned min : @18 max : @19 @11 type_decl name: @20 type: @7 srcp: :0 artificial @12 integer_cst type: @10 low : 32 @13 integer_cst type: @7 high: -1 low : -2147483648 @14 integer_cst type: @7 low : 2147483647 @15 void_type name: @21 algn: 8 @16 compound_stmt line: 12 body: @22 next: @23 @17 identifier_node strg: bit_size_type lngt: 13 @18 integer_cst type: @10 low : 0 @19 integer_cst type: @10 low : -1 @20 identifier_node strg: int lngt: 3 @21 type_decl name: @24 type: @15 srcp: :0 artificial @22 scope_stmt line: 12 begn clnp next: @25 @23 scope_stmt line: 17 end clnp @24 identifier_node strg: void lngt: 4 @25 decl_stmt line: 13 decl: @26 next: @27 @26 var_decl name: @28 type: @29 scpe: @1 srcp: ctors_orig.cpp:13 size: @30 algn: 32 used: 1 @27 expr_stmt line: 13 expr: @31 next: @32 @28 identifier_node strg: name lngt: 4 @29 record_type name: @33 size: @30 algn: 32 struct flds: @34 fncs: @35 binf: @36 @30 integer_cst type: @10 low : 32 @31 stmt_expr type: @15 stmt: @37 @32 cleanup_stmt line: 13 decl: @26 expr: @38 next: @39 @33 type_decl name: @40 type: @29 srcp: ctors_orig.cpp:1 artificial @34 field_decl name: @41 type: @42 scpe: @29 srcp: ctors_orig.cpp:6 private size: @43 algn: 32 bpos: @44 @35 function_decl name: @40 type: @45 scpe: @29 srcp: ctors_orig.cpp:2 member public constructor args: @46 extern @36 binfo type: @29 bases: 0 @37 compound_stmt line: 13 body: @47 @38 call_expr type: @15 fn : @48 args: @49 @39 decl_stmt line: 14 decl: @50 next: @51 @40 identifier_node strg: no_default_ctor lngt: 15 @41 identifier_node strg: m_i lngt: 3 @42 integer_type qual: c name: @11 unql: @7 size: @52 algn: 32 prec: 32 min : @53 max : @54 @43 integer_cst type: @10 low : 32 @44 integer_cst type: @10 low : 0 @45 method_type size: @6 algn: 64 clas: @29 retn: @15 prms: @55 @46 parm_decl name: @56 type: @57 scpe: @35 srcp: ctors_orig.cpp:2 artificial argt: @57 size: @58 algn: 32 used: 0 @47 expr_stmt line: 13 expr: @59 @48 addr_expr type: @60 op 0: @61 @49 tree_list valu: @62 @50 var_decl name: @63 type: @29 scpe: @1 srcp: ctors_orig.cpp:14 size: @30 algn: 32 used: 1 @51 expr_stmt line: 14 expr: @64 next: @65 @52 integer_cst type: @10 low : 32 @53 integer_cst type: @7 high: -1 low : -2147483648 @54 integer_cst type: @7 low : 2147483647 @55 tree_list valu: @66 chan: @67 @56 identifier_node strg: this lngt: 4 @57 pointer_type qual: c unql: @66 size: @68 algn: 32 ptd : @29 @58 integer_cst type: @10 low : 32 @59 call_expr type: @15 fn : @69 args: @70 @60 pointer_type size: @58 algn: 32 ptd : @71 @61 function_decl name: @72 mngl: @73 type: @71 scpe: @29 srcp: ctors_orig.cpp:3 member public destructor args: @74 extern @62 nop_expr type: @66 op 0: @75 @63 identifier_node strg: Anint lngt: 5 @64 stmt_expr type: @15 stmt: @76 @65 cleanup_stmt line: 14 decl: @50 expr: @77 next: @78 @66 pointer_type size: @58 algn: 32 ptd : @29 @67 tree_list valu: @7 chan: @8 @68 integer_cst type: @10 low : 32 @69 addr_expr type: @79 op 0: @80 @70 tree_list valu: @81 chan: @82 @71 method_type size: @6 algn: 64 clas: @29 retn: @15 prms: @83 @72 identifier_node strg: __comp_dtor lngt: 11 @73 identifier_node strg: _ZN15no_default_ctorD1Ev lngt: 24 @74 parm_decl name: @56 type: @57 scpe: @61 srcp: ctors_orig.cpp:3 artificial argt: @57 size: @58 algn: 32 used: 0 @75 nop_expr type: @66 op 0: @84 @76 compound_stmt line: 14 body: @85 @77 call_expr type: @15 fn : @86 args: @87 @78 expr_stmt line: 15 expr: @88 next: @89 @79 pointer_type size: @58 algn: 32 ptd : @45 @80 function_decl name: @90 mngl: @91 type: @45 scpe: @29 srcp: ctors_orig.cpp:2 member public constructor args: @92 extern @81 addr_expr type: @66 op 0: @26 @82 tree_list valu: @93 @83 tree_list valu: @66 chan: @8 @84 addr_expr type: @66 op 0: @26 @85 expr_stmt line: 14 expr: @94 @86 addr_expr type: @60 op 0: @61 @87 tree_list valu: @95 @88 convert_expr type: @15 op 0: @96 @89 expr_stmt line: 16 expr: @97 next: @98 @90 identifier_node strg: __comp_ctor lngt: 11 @91 identifier_node strg: _ZN15no_default_ctorC1Ei lngt: 24 @92 parm_decl name: @56 type: @57 scpe: @80 srcp: ctors_orig.cpp:2 artificial argt: @57 size: @58 algn: 32 used: 0 @93 integer_cst type: @7 low : 3 @94 call_expr type: @15 fn : @99 args: @100 @95 nop_expr type: @66 op 0: @101 @96 target_expr type: @29 decl: @102 init: @103 clnp: @104 @97 convert_expr type: @15 op 0: @105 @98 scope_stmt line: 17 end clnp @99 addr_expr type: @60 op 0: @106 @100 tree_list valu: @107 @101 nop_expr type: @66 op 0: @108 @102 var_decl type: @29 scpe: @1 srcp: ctors_orig.cpp:15 artificial size: @30 algn: 32 used: 0 @103 compound_expr type: @29 op 0: @109 op 1: @102 @104 call_expr type: @15 fn : @110 args: @111 @105 target_expr type: @29 decl: @112 init: @50 clnp: @113 @106 function_decl name: @90 mngl: @114 type: @71 scpe: @29 srcp: ctors_orig.cpp:5 member private constructor args: @115 undefined extern @107 addr_expr type: @66 op 0: @50 @108 addr_expr type: @66 op 0: @50 @109 call_expr type: @15 fn : @116 args: @117 @110 addr_expr type: @60 op 0: @61 @111 tree_list valu: @118 @112 var_decl type: @29 scpe: @1 srcp: ctors_orig.cpp:16 artificial size: @30 algn: 32 used: 0 @113 call_expr type: @15 fn : @119 args: @120 @114 identifier_node strg: _ZN15no_default_ctorC1Ev lngt: 24 @115 parm_decl name: @56 type: @57 scpe: @106 srcp: ctors_orig.cpp:5 artificial argt: @57 size: @58 algn: 32 used: 0 @116 addr_expr type: @79 op 0: @80 @117 tree_list valu: @121 chan: @122 @118 nop_expr type: @66 op 0: @123 @119 addr_expr type: @60 op 0: @61 @120 tree_list valu: @124 @121 addr_expr type: @66 op 0: @102 @122 tree_list valu: @125 @123 nop_expr type: @66 op 0: @126 @124 nop_expr type: @66 op 0: @127 @125 integer_cst type: @7 low : 3 @126 addr_expr type: @66 op 0: @102 @127 nop_expr type: @66 op 0: @128 @128 addr_expr type: @66 op 0: @112 Is this clear to anyone? Is there a doc somewhere which tells me how to read this output? Many thank-yous, David From mw_triad@users.sourceforge.net Tue Mar 13 20:51:00 2007 From: mw_triad@users.sourceforge.net (Matthew Woehlke) Date: Tue, 13 Mar 2007 20:51:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <17911.3175.828023.748009@zebedee.pink> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> <45F6D6A6.2000300@eagercon.com> <17910.55346.39652.519778@zebedee.pink> <17911.3175.828023.748009@zebedee.pink> Message-ID: Andrew Haley wrote: > Matthew Woehlke writes: > > Andrew Haley wrote: > > > Michael Eager writes: > > >> It can also be used to share data between threads, but it becomes > > >> problematic if accesses are not atomic. It's reasonable to use a > > >> shared volatile sig_atomic_t to communicate between threads, to say > > >> "I'm done" or "Start processing". > > > > > > Is that really safe, though? There's nothing to stop the machine from > > > reordering memory writes, even if the compiler doesn't. > > > > ...my understanding is that is exactly what 'fence' is for. > > That's my understanding too. Here, we're really talking about non-x86 > processors which have much weaker ordering guarantees. On non-x86 processors I actually resort to pthread mutexes :-) (at least until/unless I have inline assembly implementations for those...) So far no one has successfully answered my original question; how do I suppress these dang warnings? :-) -- Matthew HIPPOS feel unacknowledged. HIPPOS get angry. > PRAISE HIPPOS HIPPOS seem somewhat placated. From mw_triad@users.sourceforge.net Tue Mar 13 21:33:00 2007 From: mw_triad@users.sourceforge.net (Matthew Woehlke) Date: Tue, 13 Mar 2007 21:33:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: Message-ID: Matthew Woehlke wrote: > I have a code snippet that looks roughly like this: > > extern void my_free(void* ptr); > > int foo() > { > volatile long * bar; > ... > my_free(bar); > } > > This generates the warning 'cast discards qualifiers from pointer target > type' at my_free() (gcc 3.4.3). Other than disabling the flag that > generates the warning (in general I want these warnings!), how do I > suppress this? my_free is of course a free() wrapper, i.e. I don't see > any problems discarding the qualifier at this point. I already tried > this, which seems like it used to work (I am moving the code from one > project to another): > > my_free((void*)bar); > > ...and it doesn't help. Hmm, maybe the problem is -Wcast-qual... does that cover both implicit *and* explicit casts, or just explicit ones? Is there a way (like, I guess, const_cast in C++) to selectively disable a -Wcast-qual warning? -- Matthew HIPPOS feel unacknowledged. HIPPOS get angry. > PRAISE HIPPOS HIPPOS seem somewhat placated. From crowl@google.com Tue Mar 13 21:56:00 2007 From: crowl@google.com (Lawrence Crowl) Date: Tue, 13 Mar 2007 21:56:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> Message-ID: <29bd08b70703131432v57a9cff6qf628ba4834d1c538@mail.gmail.com> On 13 Mar 2007 08:50:25 -0700, Ian Lance Taylor wrote: > volatile doesn't help when sharing a memory buffer between threads > because volatile carries no implication of a read/write memory > barrier. The C++ standards committee has adopted the same view; existing volatile semantics will remain unchanged and there will be separate semantics for communicating between threads. The C standards committee is only now beginning to address these issues, and so (to my knowledge) has not yet formed an opinion. In the meantime, there is POSIX. -- Lawrence Crowl From iant@google.com Wed Mar 14 01:12:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Wed, 14 Mar 2007 01:12:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <45F70096.3020504@eagercon.com> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> <45F6D6A6.2000300@eagercon.com> <17910.55346.39652.519778@zebedee.pink> <45F70096.3020504@eagercon.com> Message-ID: Michael Eager writes: > > There's nothing to stop the machine from > > reordering memory writes, even if the compiler doesn't. > > Yes, it's safe. It doesn't matter which microsecond that the flag is set. > (Or if it does, then your code should be using a mutex or some other > form of synchronization.) > > Say you have one thread which performs some process when it sees > a shared flag set. It checks this flag every second. If another > process sets this flag, the service thread will notice and take action. > > If the signaling process and the receiving process both try to > access the shared memory at the same time, the processor may > reorder the operations as it chooses. The worst case is that > the server will check and see that the flag is not set, then > the signaling process will set the flag. The result is a short > delay in the receiving process noticing that the flag is set. > > Note that there is a race condition which is problematic. If the > receiving process clears the flag, at the same time that the > signaling process sets it, then these may be reordered. So you > need to insure that only one of the processes ever writes to the > flag. I think that will be OK in practice provided the only memory shared between the two processes is the signalling flag itself. Ian From iant@google.com Wed Mar 14 04:20:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Wed, 14 Mar 2007 04:20:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> Message-ID: Sergei Organov writes: > Ian Lance Taylor writes: > [...] > > And once you are using a mutex, there is no reason to use volatile. > > Using volatile will give you no extra protection, it will merely cost > > you some efficiency. > > Yes, that's how it is intended to work. However practice may vary. Some > time ago there was an interesting example posted in a newsgroup[1]. > > The initial program was: > > for (...) { > if (...) pthread_mutex_lock(...); > x = ... x ... > if (...) pthread_mutex_unlock(...); > } > > and compiler did the following transformation that breaks thread-safety > ('r' is register): > > r = x; > for (...) { > if (...) { x = r; pthread_mutex_lock(...); r = x; } > r = ... r ... > if (...) { x = r; pthread_mutex_unlock(...); r = x; } > } > x = r; > > This transformation seems to be OK both from the C language POV and from > pthread standard POV (though the latter obviously was not intentional), > but it creates accesses to 'x' outside of the mutex-protected section > that in turn breaks thread-safety. > > Making 'x' volatile would prevent such an optimization in practice, > isn't it? That is an interesting example. The question is whether declaring x volatile would prevent the compiler from moving a load or store to x across the call to pthread_mutex_lock or pthread_mutex_unlock. I guess I agree that it would. x must have the correct value when the functions are called. The use of volatile would ensure that x can only be read and written once. So there is no way to move the load or store. Interesting. Thanks. Ian From olecom@flower.upol.cz Wed Mar 14 10:07:00 2007 From: olecom@flower.upol.cz (Oleg Verych) Date: Wed, 14 Mar 2007 10:07:00 -0000 Subject: how to cast away 'volatile'? References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <45F6D063.4090506@starnetworks.us> Message-ID: > From: "Kevin P. Fleming" > Newsgroups: gmane.comp.gcc.help > Subject: Re: how to cast away 'volatile'? > Date: Tue, 13 Mar 2007 11:25:07 -0500 > > Ian Lance Taylor wrote: >> The mutex code itself, assuming it is written correctly, provides the >> required memory barriers. > > OK, that's what I hoped you would say :-) Thanks for the clarification. > Maybe articles by Paul McKenney will be helpful on this topic, but they mainly a hardware/kernel thing: "Memory Ordering in Modern Microprocessors" ____ From aph@redhat.com Wed Mar 14 12:21:00 2007 From: aph@redhat.com (Andrew Haley) Date: Wed, 14 Mar 2007 12:21:00 -0000 Subject: -fdump-tree-all documentation. In-Reply-To: <200703132042.l2DKg4P5026776@mx1.redhat.com> References: <3B4C77997DD0254B86D3C9454476B6BC0F03EC1D@lonms00812.fm.rbsgrp.net> <200703122349.l2CNnjOg000953@mx1.redhat.com> <17910.26477.347058.814071@zebedee.pink> <200703132042.l2DKg4P5026776@mx1.redhat.com> Message-ID: <17911.51534.977035.359224@zebedee.pink> DCH writes: > Hi Andrew et alumni, > > At 08:57 13/03/2007, Andrew Haley wrote: > >DCH writes: > > > > > Forgive me if I've missed something obvious, but does anyone > > > know if the output from -fdump-tree-all is documented somewhere? > > > >It's C, more or less, except for a few additions such as Phi nodes. > > I guess that means no :-) Looks nothing like C to me, but there again > I'm used to looking a normal type C, not some kind of parsed C. Oh, you mean the front end dump. Most of the dumps look like this: () (D.779) { struct * #ref#1#2.24; { struct * D.782; void *[] * D.784; void * #ref#0#0; struct * D.786; void * #ref#1#2; ... etc. Only _one_ of the dumps looks like the one below, and that's the original translation unit. > Well, most of it really. Basically someone posted this to ACCU-general > a while ago: > > ==================================================== > struct no_default_ctor { > no_default_ctor(int i) : m_i(i) { }; > ~no_default_ctor() { }; > private: > no_default_ctor(); > const int m_i; > }; > > // Why is `no_default_ctor(Anint)' below a syntax error? > > const int Anint = 3; > int foo() { > no_default_ctor name(Anint); // This works. > no_default_ctor(Anint); // This gives me a syntax error. > no_default_ctor(3); // But this does not. > (no_default_ctor)(Anint); // And neither does this. > } > ==================================================== > > It provoked some discussion, the outcome of that was rather > unclear. I thought at least I could pass it into GCC to see how > no_default_ctor(Anint) is parsed and got the following output. I > think I decided at the time that it was being interpreted as a > function-style cast, but then I wasn't sure, and now I can't even > see that for some reason. There was some discussion if it was a > cast or a declaration. There are a couple of references in the > output below to line 13 but I don't know the syntax here to unwind > it. > > ;; Function int foo() (_Z3foov) > ;; enabled by -fdump-tree-original > > @1 function_decl name: @2 mngl: @3 type: @4 > srcp: ctors_orig.cpp:12 extern > body: @5 > @2 identifier_node strg: foo lngt: 3 > @3 identifier_node strg: _Z3foov lngt: 7 > @4 function_type size: @6 algn: 64 retn: @7 > prms: @8 > @5 compound_stmt line: 17 body: @9 > @6 integer_cst type: @10 low : 64 > @7 integer_type name: @11 size: @12 algn: 32 > prec: 32 min : @13 max : @14 > @8 tree_list valu: @15 > @9 scope_stmt line: 12 begn clnp > next: @16 > @10 integer_type name: @17 size: @6 algn: 64 > prec: 36 unsigned min : @18 > max : @19 Each one of these is a tree node, and links are replaced by numbers of the form @N. After that, it's just tree nodes. Most of the meaning of these nodes is documented in gcc/tree.def, but a few nodes are language-specific and are documented in the language front ends. > Is this clear to anyone? Is there a doc somewhere which tells me > how to read this output? Andrew. From aph@redhat.com Wed Mar 14 12:57:00 2007 From: aph@redhat.com (Andrew Haley) Date: Wed, 14 Mar 2007 12:57:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> <45F6D6A6.2000300@eagercon.com> <17910.55346.39652.519778@zebedee.pink> <17911.3175.828023.748009@zebedee.pink> Message-ID: <17911.59556.878450.4390@zebedee.pink> Matthew Woehlke writes: > Andrew Haley wrote: > > Matthew Woehlke writes: > > > Andrew Haley wrote: > > > > Michael Eager writes: > > > >> It can also be used to share data between threads, but it becomes > > > >> problematic if accesses are not atomic. It's reasonable to use a > > > >> shared volatile sig_atomic_t to communicate between threads, to say > > > >> "I'm done" or "Start processing". > > > > > > > > Is that really safe, though? There's nothing to stop the machine from > > > > reordering memory writes, even if the compiler doesn't. > > > > > > ...my understanding is that is exactly what 'fence' is for. > > > > That's my understanding too. Here, we're really talking about non-x86 > > processors which have much weaker ordering guarantees. > > On non-x86 processors I actually resort to pthread mutexes :-) (at least > until/unless I have inline assembly implementations for those...) > > So far no one has successfully answered my original question; how do I > suppress these dang warnings? :-) I did. Maybe you didn't see it, or maybe you didn't like the suggestion. Andrew. From rodrigo.benenson@inria.fr Wed Mar 14 14:22:00 2007 From: rodrigo.benenson@inria.fr (rodrigo benenson) Date: Wed, 14 Mar 2007 14:22:00 -0000 Subject: Template class heritance strange behaviour Message-ID: I have a question about the namespace management when heriting a templated class. Given the following code, why the member variable 'c' is managed differently than the member method 'set_c' ? Thanks for you explanations. rodrigob. http://www-rocq.inria.fr/~benenson/ The following code compiles. ////////////////////////////////////////// template class Parent { public: T1 c; void set_c(T1 &val) { c = val; } }; template class Child : Parent { T2 d; public: void set_d(T2 _d) { d = _d; //c = _d; // <<< this line generates error : 'c' was not declared in this scope this->c = _d; // this access work fine Parent::c = _d; // this access work fine too set_c(_d); // there is no problem in finding 'set_c' in the scope } }; int main(void) { Child the_child; the_child.set_d(5); return 0; } ////////////////////////////////////////// Command: g++ test.cpp -o test && ./test g++ --version g++ (GCC) 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) From eljay@adobe.com Wed Mar 14 14:43:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Wed, 14 Mar 2007 14:43:00 -0000 Subject: Template class heritance strange behaviour In-Reply-To: Message-ID: Hi rodrigob, > //c = _d; // <<< this line generates error : 'c' was not declared > in this scope Yep, that is an error. That line (if uncommented) is bad C++. > this->c = _d; // this access work fine Yep, that is correct. That's C++. > Parent::c = _d; // this access work fine too Yep, that is correct. That's C++, too. In Child, I think you can also use something like: using Parent::c; Google for "Koenig lookup" (two phase lookup) if you want details. Here's one URL: http://h21007.www2.hp.com/dspp/tech/tech_TechDocumentDetailPage_IDX/1,1701,9 90,00.html HTH, --Eljay From mw_triad@users.sourceforge.net Wed Mar 14 15:08:00 2007 From: mw_triad@users.sourceforge.net (Matthew Woehlke) Date: Wed, 14 Mar 2007 15:08:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <17911.59556.878450.4390@zebedee.pink> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> <45F6D6A6.2000300@eagercon.com> <17910.55346.39652.519778@zebedee.pink> <17911.3175.828023.748009@zebedee.pink> <17911.59556.878450.4390@zebedee.pink> Message-ID: Andrew Haley wrote: > Matthew Woehlke writes: >> So far no one has successfully answered my original question; how do I >> suppress these dang warnings? :-) > > I did. Maybe you didn't see it, or maybe you didn't like the > suggestion. "Didn't see it"? I just re-read your posts; the only thing I see that might be a suggestion is "don't use volatile". So if there was something else, I must apologize, because I'm not finding it. :-) Actually I realized the problem might be -Wcast-qual, does that cover implicit casts, explicit casts, or both? I probably added it to my old code because I didn't write most of it, and so don't trust it. :-) It may be that I have to live with it, and turn it off once I am satisfied that all the warnings it produces are innocuous? (Unless there is a way to tell gcc to make an exception?) -- Matthew "unsubscribe me plz!!" -- Newbies From aph@redhat.com Wed Mar 14 15:17:00 2007 From: aph@redhat.com (Andrew Haley) Date: Wed, 14 Mar 2007 15:17:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> <45F6D6A6.2000300@eagercon.com> <17910.55346.39652.519778@zebedee.pink> <17911.3175.828023.748009@zebedee.pink> <17911.59556.878450.4390@zebedee.pink> Message-ID: <17912.4054.948921.54599@zebedee.pink> Matthew Woehlke writes: > Andrew Haley wrote: > > Matthew Woehlke writes: > >> So far no one has successfully answered my original question; how do I > >> suppress these dang warnings? :-) > > > > I did. Maybe you didn't see it, or maybe you didn't like the > > suggestion. > > "Didn't see it"? I just re-read your posts; the only thing I see that > might be a suggestion is "don't use volatile". So if there was something > else, I must apologize, because I'm not finding it. :-) I suggested keeping a non-volatile pointer (to the alloc'd memory) and a volatile pointer to the same memory, and using whichever was appropriate. I still think that's a good idea. The warning from gcc *is* correct: you're casting away volatile. Sure, you might be able to find a way to shut up the warning, but is it not surely better to fix the code instead? Andrew. From Vladimir.Simonov@acronis.com Wed Mar 14 15:26:00 2007 From: Vladimir.Simonov@acronis.com (Vladimir Simonov) Date: Wed, 14 Mar 2007 15:26:00 -0000 Subject: gcc forgets to decrease esp after function call In-Reply-To: <17910.58546.897282.378139@zebedee.pink> References: <45F15674.9000701@acronis.com> <17905.22833.766154.45450@zebedee.pink> <45F1681A.6030307@acronis.com> <17905.28252.856544.931176@zebedee.pink> <45F180B3.50901@acronis.com> <17905.33869.537927.207102@zebedee.pink> <45F1A223.6060406@acronis.com> <17905.42424.400663.138838@zebedee.pink> <45F292DA.30804@acronis.com> <17908.16759.282405.262830@zebedee.pink> <45F653D5.8070500@acronis.com> <17910.32685.453760.827798@zebedee.pink> <45F6E269.1050201@acronis.com> <17910.58546.897282.378139@zebedee.pink> Message-ID: <45F80E6C.5090601@acronis.com> Andrew Haley wrote: > Vladimir Simonov writes: > > > > Andrew Haley wrote: > > > Unfortunately, this does not produce a test case. > > > > > > To be clear: if you want this bug to be addressed, oy must produce a > > > test case that someone can run. You must also provide the expected > > > output. > > > > Sorry for delay with answer. I union both your letters. > > > > Are you able to reproduce my results using > > gcc 4.1.2/4.1.1? > > I didn't look in deatil. Once I have a test case I will do so. > > > Do you agree with my analysis? > > > > Do you mean I must add "main", body of called > > function, script to build executable and show that > > it crashes instead of print "Hello word"? > > That will do. > > > > Well, yeah, but that would break lots of other people's prgrams too, > > > and we know that doesn't happen. So I want to know what is so special > > > about yours. > > > > If you take a look at source you'll see that it is quite complex > > templated code. > > We have lots of that too. > > > I think the difference is in its complexity. Say, gcc 4.0.2 can't > > compile our projects at all due to "internal compiler error'. > > Well, that's an easy test case too. But really, I wouldn't use gcc > 4.0.x. > > > And we made some efforts to make gcc 4.1.1 to compile the > > sources. Now it can compile without internal crash but produced > > code is incorrect :( > > Sure, but once I have a test case I can try a bunch of different > compilers. And then we can figure out why the error is occurring, > etc... > > Andrew. > Hi The attached test case can be built by compile.sh. It produces two binaries - test_bin_bad & test_bin_good. test_bin_good prints "Hello word" before exit. test_bin_bad crashes. The difference is the only -O2 used while test_bin_bad build. The symptoms are the same - incorrect esp usage in caller after call function returning object. We reproduced the bug in gcc 4.1.0/4.1.1/4.1.2 gcc 3.x can't compile the sources. Regards Vladimir -------------- next part -------------- A non-text attachment was scrubbed... Name: gcc_bug.tgz Type: application/x-gzip Size: 191273 bytes Desc: not available URL: From mw_triad@users.sourceforge.net Wed Mar 14 17:57:00 2007 From: mw_triad@users.sourceforge.net (Matthew Woehlke) Date: Wed, 14 Mar 2007 17:57:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <17912.4054.948921.54599@zebedee.pink> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> <45F6D6A6.2000300@eagercon.com> <17910.55346.39652.519778@zebedee.pink> <17911.3175.828023.748009@zebedee.pink> <17911.59556.878450.4390@zebedee.pink> <17912.4054.948921.54599@zebedee.pink> Message-ID: Andrew Haley wrote: > Matthew Woehlke writes: >> Andrew Haley wrote: >>> Matthew Woehlke writes: >>>> So far no one has successfully answered my original question; how do I >>>> suppress these dang warnings? :-) >>> >>> I did. Maybe you didn't see it, or maybe you didn't like the >>> suggestion. >> >> "Didn't see it"? I just re-read your posts; the only thing I see that >> might be a suggestion is "don't use volatile". So if there was something >> else, I must apologize, because I'm not finding it. :-) > > I suggested keeping a non-volatile pointer (to the alloc'd memory) and > a volatile pointer to the same memory, and using whichever was > appropriate. I still think that's a good idea. The warning from gcc > *is* correct: you're casting away volatile. Sure, you might be able > to find a way to shut up the warning, but is it not surely better to > fix the code instead? Hmm... the problem is that this is from an API, the code using the API would have to keep track of both. Conversely, since the type is meant to be opaque, callers don't need to know that it is volatile. So I can do sneaky things like this: typedef struct { volatile long a; } atom_t; ...whenever it is accesses, m->a is used, which is volatile. But the struct as a whole (which is not volatile) can be passed to free(). This way the caller is "tricked" into keeping both a volatile and non-volatile around at the same time. :-) See, it took someone to force me to think about a different approach to solve this... thanks! :-) (The 'keep both' part was the important part; your original suggestion wasn't worded quite the same. This way I'm not "casting as needed", which is the part of your original suggestion that made me nervous. The actual data is *always* volatile, but it is wrapped in something that gcc doesn't complain about when the container is passed to free().) -- Matthew "unsubscribe me plz!!" -- Newbies From olanglois@quazal.com Wed Mar 14 19:14:00 2007 From: olanglois@quazal.com (Olivier Langlois) Date: Wed, 14 Mar 2007 19:14:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> <45F6D6A6.2000300@eagercon.com> <17910.55346.39652.519778@zebedee.pink> <17911.3175.828023.748009@zebedee.pink> <17911.59556.878450.4390@zebedee.pink> <17912.4054.948921.54599@zebedee.pink> Message-ID: <400BDC416E2A0042AA35DF3919BB8A518DA21C@mail.mtl.proksim.com> Hi, I am finding this thread very interesting to follow but I am surprised that nobody mentioned const_cast<> as it is the official way to cast away the volatile specifier. Is this because the problem is in C? Greetings, Olivier Langlois http://www.olivierlanglois.net From mw_triad@users.sourceforge.net Wed Mar 14 23:54:00 2007 From: mw_triad@users.sourceforge.net (Matthew Woehlke) Date: Wed, 14 Mar 2007 23:54:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: <400BDC416E2A0042AA35DF3919BB8A518DA21C@mail.mtl.proksim.com> References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <45F6CAB2.1050008@starnetworks.us> <17910.52394.276700.319625@zebedee.pink> <45F6D6A6.2000300@eagercon.com> <17910.55346.39652.519778@zebedee.pink> <17911.3175.828023.748009@zebedee.pink> <17911.59556.878450.4390@zebedee.pink> <17912.4054.948921.54599@zebedee.pink> <400BDC416E2A0042AA35DF3919BB8A518DA21C@mail.mtl.proksim.com> Message-ID: Olivier Langlois wrote: > I am finding this thread very interesting to follow So am I! It's fun to see what a lively (and informative!) discussion my simple question caused. :-) > but I am surprised > that nobody mentioned const_cast<> as it is the official way to cast > away the volatile specifier. Is this because the problem is in C? Since const_cast is not supported in C, and I am writing in C, that seems likely. :-) I think at some point I actually asked 'what is the C equivalent of const_cast<>' (but I'm not sure if I actually posted that or just thought it...). -- Matthew "unsubscribe me plz!!" -- Newbies From g.kubik@resco.com.pl Thu Mar 15 09:16:00 2007 From: g.kubik@resco.com.pl (Grzegorz !Kubik) Date: Thu, 15 Mar 2007 09:16:00 -0000 Subject: mixing C with AS - example needed Message-ID: <01d701c76694$0bf161b0$0300a8c0@ibm7a3o17v27i2> Hello, I am trying to combine part of software written in C with another part written in AS. Example is needed, how to: - call assembler procedure from C program, - define and use RAM buffer common for C and assembler programs. I am using WinAVR, my target controller is AT90USB1287. Thank you for any help, Regards, Greg Kubik From osv@javad.com Thu Mar 15 09:50:00 2007 From: osv@javad.com (Sergei Organov) Date: Thu, 15 Mar 2007 09:50:00 -0000 Subject: how to cast away 'volatile'? In-Reply-To: (Matthew Woehlke's message of "Tue, 13 Mar 2007 14:29:15 -0500") References: <17910.29117.938526.285262@zebedee.pink> <17910.49874.908961.521088@zebedee.pink> <17910.51750.756198.304591@zebedee.pink> Message-ID: <87y7ly3m0h.fsf@javad.com> Matthew Woehlke writes: > Ok, I guess I should answer that. It's part of a typedef that is > essentially 'typedef volatile long atom_t', i.e. the type that is > passed to atomicAdd, atomicSwap, etc functions (which are of course > written with inline assembler using 'lock' - the memory barriers are > handled). Also because atomicRead is a no-op to simply read the value, > since this is safe. So I'm expecting 'volatile' to a: discourage > compilers from doing stupid reordering to the code, like say putting > the read before a call to atomicXyz, and b: force a re-read from > memory (in case some other thread is changing the value) rather than > using a cached value. > > Now I'm wondering if maybe I should just drop the volatile, but I'm > not sure I trust doing that...? Michael Eager's post makes it sound > like I am in exactly the few cases where use of 'volatile' is > appropriate. I think you may consider to remove 'volatile' from your interfaces, and cast *to* 'volatile' whenever you need volatile access, e.g.: int foo(int *p) { int volatile *vp = p; *vp = 10; return *vp; } -- Sergei. From aph@redhat.com Thu Mar 15 11:32:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 15 Mar 2007 11:32:00 -0000 Subject: gcc forgets to decrease esp after function call In-Reply-To: <45F80E6C.5090601@acronis.com> References: <45F15674.9000701@acronis.com> <17905.22833.766154.45450@zebedee.pink> <45F1681A.6030307@acronis.com> <17905.28252.856544.931176@zebedee.pink> <45F180B3.50901@acronis.com> <17905.33869.537927.207102@zebedee.pink> <45F1A223.6060406@acronis.com> <17905.42424.400663.138838@zebedee.pink> <45F292DA.30804@acronis.com> <17908.16759.282405.262830@zebedee.pink> <45F653D5.8070500@acronis.com> <17910.32685.453760.827798@zebedee.pink> <45F6E269.1050201@acronis.com> <17910.58546.897282.378139@zebedee.pink> <45F80E6C.5090601@acronis.com> Message-ID: <17913.5853.465646.305627@zebedee.pink> Vladimir Simonov writes: > The attached test case can be built by compile.sh. > It produces two binaries - test_bin_bad & test_bin_good. > > test_bin_good prints "Hello word" before exit. > test_bin_bad crashes. > > The difference is the only -O2 used while test_bin_bad build. > > The symptoms are the same - incorrect esp usage in caller > after call function returning object. > > We reproduced the bug in gcc 4.1.0/4.1.1/4.1.2 > gcc 3.x can't compile the sources. OK, we're getting closer. Unfortunately, your test case includes a ton of system headers for one particular system/version of gcc, and it also includes a lot of library code not used in your test case. Fillet that, and you will have a test case that can be submitted. Andrew. From Vladimir.Simonov@acronis.com Thu Mar 15 11:37:00 2007 From: Vladimir.Simonov@acronis.com (Vladimir Simonov) Date: Thu, 15 Mar 2007 11:37:00 -0000 Subject: gcc forgets to decrease esp after function call In-Reply-To: <17913.5853.465646.305627@zebedee.pink> References: <45F15674.9000701@acronis.com> <17905.22833.766154.45450@zebedee.pink> <45F1681A.6030307@acronis.com> <17905.28252.856544.931176@zebedee.pink> <45F180B3.50901@acronis.com> <17905.33869.537927.207102@zebedee.pink> <45F1A223.6060406@acronis.com> <17905.42424.400663.138838@zebedee.pink> <45F292DA.30804@acronis.com> <17908.16759.282405.262830@zebedee.pink> <45F653D5.8070500@acronis.com> <17910.32685.453760.827798@zebedee.pink> <45F6E269.1050201@acronis.com> <17910.58546.897282.378139@zebedee.pink> <45F80E6C.5090601@acronis.com> <17913.5853.465646.305627@zebedee.pink> Message-ID: <45F92EC7.2000106@acronis.com> Andrew Haley wrote: > Vladimir Simonov writes: > > The attached test case can be built by compile.sh. > > It produces two binaries - test_bin_bad & test_bin_good. > > > > test_bin_good prints "Hello word" before exit. > > test_bin_bad crashes. > > > > The difference is the only -O2 used while test_bin_bad build. > > > > The symptoms are the same - incorrect esp usage in caller > > after call function returning object. > > > > We reproduced the bug in gcc 4.1.0/4.1.1/4.1.2 > > gcc 3.x can't compile the sources. > > OK, we're getting closer. Hi Are you capable to reproduce the bug? > Unfortunately, your test case includes a > ton of system headers for one particular system/version of gcc, But it doesn't contain any #include directive. It is self consistent. Do you mean that I should add "#include" for system headers? I think this way we may made the bug less obvious. > and it > also includes a lot of library code not used in your test case. I understood it from the start of discussion :) I hoped: 1. GCC delelopers have some tools or methods to automatically remove text which does not affect codegeneration. Or some compile stage which contans intermediate data without unused by codegeneration prototypes, classes, etc. 2. GCC developers are smart enough to localize and try to fix gcc having such obvious indication as this - codegenerator "forgets" that it called function returning object. Is it impossible to find thin place/places taking into account above, fix it and check by our test? In such a case the test size has no defference in my opinion. > Fillet that, and you will have a test case that can be submitted. > It requires a lot of mannual work - remove a peace of code, then check that the test can be built, the check that the bug did not disappear, etc. We'll try. Regards Vladimir From vlibrado@bioingenieria.es Thu Mar 15 11:38:00 2007 From: vlibrado@bioingenieria.es (Victor Librado) Date: Thu, 15 Mar 2007 11:38:00 -0000 Subject: arm 9260ej-s dsp functions AS problems Message-ID: <45F92FFB.4050408@bioingenieria.es> Hello all, I`m working with an ATMEL arm at91sam9260 (core 9260EJ-S) under Linux (Linux kernel 2.6.15; armv5l-linux toolchain). I want to implement a FFT function in C code and I would like to take advantage of the asm DSP like functions the core provides. Compiler don??t uses them (in the .S file generated), can it be configured (a directive include in the makefile, in the source...) the gcc to use these asm DSP functions automatically providing so a much efficient and better arm code? Another option I have tried is to write these pieces of code in assembler using these functions... but the assembler returns error (assembler function not known). I updated to gcc4.1.2 version and compile this way: arm-linux-gnu-gcc-4.1 -v -msoft-float -mcpu=arm926ej-s -S mul.c -o mul.o Version 4.1.2 accepts the arm core as option but function doesn't assemble... Any idea or configuration of the gcc to get it working efficiently and optimized for this arm core? Thanks in advance. Victor Librado Sancho Departamento I+D ------------------------------------------------------------------------ ------------------------------------------------------------------------ From aph@redhat.com Thu Mar 15 11:42:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 15 Mar 2007 11:42:00 -0000 Subject: gcc forgets to decrease esp after function call In-Reply-To: <45F92EC7.2000106@acronis.com> References: <45F15674.9000701@acronis.com> <17905.22833.766154.45450@zebedee.pink> <45F1681A.6030307@acronis.com> <17905.28252.856544.931176@zebedee.pink> <45F180B3.50901@acronis.com> <17905.33869.537927.207102@zebedee.pink> <45F1A223.6060406@acronis.com> <17905.42424.400663.138838@zebedee.pink> <45F292DA.30804@acronis.com> <17908.16759.282405.262830@zebedee.pink> <45F653D5.8070500@acronis.com> <17910.32685.453760.827798@zebedee.pink> <45F6E269.1050201@acronis.com> <17910.58546.897282.378139@zebedee.pink> <45F80E6C.5090601@acronis.com> <17913.5853.465646.305627@zebedee.pink> <45F92EC7.2000106@acronis.com> Message-ID: <17913.12323.646294.479431@zebedee.pink> Vladimir Simonov writes: > Andrew Haley wrote: > > Vladimir Simonov writes: > > > The attached test case can be built by compile.sh. > > > It produces two binaries - test_bin_bad & test_bin_good. > > > > > > test_bin_good prints "Hello word" before exit. > > > test_bin_bad crashes. > > > > > > The difference is the only -O2 used while test_bin_bad build. > > > > > > The symptoms are the same - incorrect esp usage in caller > > > after call function returning object. > > > > > > We reproduced the bug in gcc 4.1.0/4.1.1/4.1.2 > > > gcc 3.x can't compile the sources. > > > > OK, we're getting closer. > > Hi > > Are you capable to reproduce the bug? Yes. > > Unfortunately, your test case includes a > > ton of system headers for one particular system/version of gcc, > But it doesn't contain any #include directive. > It is self consistent. > > Do you mean that I should > add "#include" for system headers? Yes. Otherwise it's not possible to compile it with any other version of gcc than the one you built it on. A test case should be standalone and not depend on a particulat gcc version. > I think this way we may made the bug less obvious. > > and it > > also includes a lot of library code not used in your test case. > > I understood it from the start of discussion :) > I hoped: > 1. GCC delelopers have some tools or methods to automatically > remove text which does not affect codegeneration. Or some compile > stage which contans intermediate data without unused by > codegeneration prototypes, classes, etc. > 2. GCC developers are smart enough to localize and try to fix gcc > having such obvious indication as this - codegenerator "forgets" > that it called function returning object. Is it impossible to find > thin place/places taking into account above, fix it and check by > our test? It's up to you, really. The more self-contained a test case you provide, the more likely someone is to fix your problem. Remember that they are, in this case, volunteers, and not highly motivated to spend a lot of time to try to remove all the extraneous code. > In such a case the test size has no defference in my opinion. > > > > Fillet that, and you will have a test case that can be submitted. > > It requires a lot of mannual work - remove a peace of code, then > check that the test can be built, the check that the bug did not > disappear, etc. It's your code, so presumably you are familiar with it. I stepped though the code in gdb, and it seemed that not many routines were actually involved. Andrew. From ITZHACK@il.ibm.com Thu Mar 15 13:57:00 2007 From: ITZHACK@il.ibm.com (Itzhack Goldberg) Date: Thu, 15 Mar 2007 13:57:00 -0000 Subject: Error: expected expression before return Message-ID: The following program doesn't pass compliation: #include int izik() { ( 1 == 1 ) && return 0 || return 1 ; } int main() { int rtrn = izik(); } The error is: error: expected expression before 'return' Please advise. - Itzhack From dwilliss@microimages.com Thu Mar 15 16:17:00 2007 From: dwilliss@microimages.com (Dave Williss) Date: Thu, 15 Mar 2007 16:17:00 -0000 Subject: Error: expected expression before return In-Reply-To: References: Message-ID: <45F95132.4050902@microimages.com> Itzhack Goldberg wrote: > The following program doesn't pass compliation: > > #include > int izik() > { > ( 1 == 1 ) && return 0 || return 1 ; > } > int main() > { > int rtrn = izik(); > } > > > The error is: error: expected expression before 'return' > > int izik() { return ( 1 == 1) ? 0 : 1; } This is C, not Perl :-) Shalom From jteran@mcmtelecom.com.mx Thu Mar 15 16:23:00 2007 From: jteran@mcmtelecom.com.mx (Teran Jesus) Date: Thu, 15 Mar 2007 16:23:00 -0000 Subject: Problem with java Message-ID: <52F9F54F025401488996B9795D659D8E108907@mcmmx012.mcm.mexico> Hello, I am using the java for a provisioning system and when i execute my program i get the next error, i have the libgcj-3.4.6-3.1 version, if i put an older version libgcj-3.2.2-5, the error doesn't appears, do you know what do i need with the new version to my program runs? Exception in thread "main" java.lang.NoClassDefFoundError: while resolving class: com.broadsoft.clients.oci.OCIClient at java.lang.VMClassLoader.resolveClass(java.lang.Class) (/usr/lib/libgcj.so.5.0.0) at java.lang.Class.initializeClass() (/usr/lib/libgcj.so.5.0.0) at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (/usr/lib/libgcj.so.5.0.0) at java.lang.Class.forName(java.lang.String) (/usr/lib/libgcj.so.5.0.0) at gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.5.0.0) at _Jv_ThreadRun(java.lang.Thread) (/usr/lib/libgcj.so.5.0.0) at _Jv_RunMain(java.lang.Class, byte const, int, byte const, boolean) (/usr/lib/libgcj.so.5.0.0) at __gcj_personality_v0 (/var/www/html/symphony/java.version=1.4.2) at __libc_start_main (/lib/tls/libc-2.3.4.so) at _Jv_RegisterClasses (/var/www/html/symphony/java.version=1.4.2) Caused by: java.lang.ClassNotFoundException: java.lang.StringBuilder not found in [file:/var/www/html/symphony/asociclient/build/classes/, file:/usr/share/java/libgcj-3.4.6.jar, file:./, core:/] at java.net.URLClassLoader.findClass(java.lang.String) (/usr/lib/libgcj.so.5.0.0) at gnu.gcj.runtime.VMClassLoader.findClass(java.lang.String) (/usr/lib/libgcj.so.5.0.0) at java.lang.ClassLoader.loadClass(java.lang.String, boolean) (/usr/lib/libgcj.so.5.0.0) at _Jv_FindClass(_Jv_Utf8Const, java.lang.ClassLoader) (/usr/lib/libgcj.so.5.0.0) at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (/usr/lib/libgcj.so.5.0.0) at _Jv_BytecodeVerifier.verify_instructions_0() (/usr/lib/libgcj.so.5.0.0) at _Jv_VerifyMethod(_Jv_InterpMethod) (/usr/lib/libgcj.so.5.0.0) at _Jv_PrepareClass(java.lang.Class) (/usr/lib/libgcj.so.5.0.0) at _Jv_WaitForState(java.lang.Class, int) (/usr/lib/libgcj.so.5.0.0) at java.lang.VMClassLoader.linkClass0(java.lang.Class) (/usr/lib/libgcj.so.5.0.0) at java.lang.VMClassLoader.resolveClass(java.lang.Class) (/usr/lib/libgcj.so.5.0.0) Atentamente: Ing. Jes?s Ter?n Bl?squez MCM Telecomunicaciones 53.50.00.57 Planeaci?n From aph@redhat.com Thu Mar 15 17:01:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 15 Mar 2007 17:01:00 -0000 Subject: Problem with java In-Reply-To: <52F9F54F025401488996B9795D659D8E108907@mcmmx012.mcm.mexico> References: <52F9F54F025401488996B9795D659D8E108907@mcmmx012.mcm.mexico> Message-ID: <17913.29449.206734.668339@zebedee.pink> Teran Jesus writes: > Hello, I am using the java for a provisioning system and when i > execute my program i get the next error, i have the > libgcj-3.4.6-3.1 version, if i put an older version libgcj-3.2.2-5, > the error doesn't appears, do you know what do i need with the new > version to my program runs? You need gcj Version 4.3 (not yet released) to run Java 1.5 code which uses java.lang.StringBuilder. Alternatively, if you're running on Fedora there's a new test RPM at http://download.fedoraproject.org/pub/fedora/linux/core/development/x86_64/os/Fedora/libgcj-4.1.2-4.x86_64.rpm http://download.fedoraproject.org/pub/fedora/linux/core/development/x86_64/os/Fedora/libgcj-4.1.2-4.i386.rpm Andrew. From jteran@mcmtelecom.com.mx Thu Mar 15 17:20:00 2007 From: jteran@mcmtelecom.com.mx (Teran Jesus) Date: Thu, 15 Mar 2007 17:20:00 -0000 Subject: Problem with java Message-ID: <52F9F54F025401488996B9795D659D8E108983@mcmmx012.mcm.mexico> Hello Andrew, I am using the red hat enterprise 4, why when i use the libgcj-3.2.2-5 version it works, do you have another solution? -----Original Message----- From: Andrew Haley [mailto:aph@redhat.com] Sent: Jueves, 15 de Marzo de 2007 10:24 a.m. To: Teran Jesus Cc: gcc-help@gcc.gnu.org Subject: Re: Problem with java Teran Jesus writes: > Hello, I am using the java for a provisioning system and when i > execute my program i get the next error, i have the > libgcj-3.4.6-3.1 version, if i put an older version libgcj-3.2.2-5, > the error doesn't appears, do you know what do i need with the new > version to my program runs? You need gcj Version 4.3 (not yet released) to run Java 1.5 code which uses java.lang.StringBuilder. Alternatively, if you're running on Fedora there's a new test RPM at http://download.fedoraproject.org/pub/fedora/linux/core/development/x86_64/o s/Fedora/libgcj-4.1.2-4.x86_64.rpm http://download.fedoraproject.org/pub/fedora/linux/core/development/x86_64/o s/Fedora/libgcj-4.1.2-4.i386.rpm Andrew. From aph@redhat.com Thu Mar 15 17:39:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 15 Mar 2007 17:39:00 -0000 Subject: Problem with java In-Reply-To: <52F9F54F025401488996B9795D659D8E108983@mcmmx012.mcm.mexico> References: <52F9F54F025401488996B9795D659D8E108983@mcmmx012.mcm.mexico> Message-ID: <17913.32852.791735.80366@zebedee.pink> Please don't top-post. Teran Jesus writes: > Hello Andrew, I am using the red hat enterprise 4, why when i use the > libgcj-3.2.2-5 version it works, do you have another solution? OK, my dates were wrong, sorry. We've had StringBuilder since May 2005, and it is in a couple of released versions. However, I don't know why this program works with libgcj 3.2.2. Maybe the program tries to "autodetect" which version of Java it's running on. Andrew. From Vladimir.Simonov@acronis.com Thu Mar 15 23:14:00 2007 From: Vladimir.Simonov@acronis.com (Vladimir Simonov) Date: Thu, 15 Mar 2007 23:14:00 -0000 Subject: gcc forgets to decrease esp after function call In-Reply-To: <17913.12323.646294.479431@zebedee.pink> References: <45F15674.9000701@acronis.com> <17905.22833.766154.45450@zebedee.pink> <45F1681A.6030307@acronis.com> <17905.28252.856544.931176@zebedee.pink> <45F180B3.50901@acronis.com> <17905.33869.537927.207102@zebedee.pink> <45F1A223.6060406@acronis.com> <17905.42424.400663.138838@zebedee.pink> <45F292DA.30804@acronis.com> <17908.16759.282405.262830@zebedee.pink> <45F653D5.8070500@acronis.com> <17910.32685.453760.827798@zebedee.pink> <45F6E269.1050201@acronis.com> <17910.58546.897282.378139@zebedee.pink> <45F80E6C.5090601@acronis.com> <17913.5853.465646.305627@zebedee.pink> <45F92EC7.2000106@acronis.com> <17913.12323.646294.479431@zebedee.pink> Message-ID: <45F984DB.3050201@acronis.com> Andrew Haley wrote: > Vladimir Simonov writes: > > Andrew Haley wrote: > > > Vladimir Simonov writes: > > > > The attached test case can be built by compile.sh. > > > > It produces two binaries - test_bin_bad & test_bin_good. > > > > > > > > test_bin_good prints "Hello word" before exit. > > > > test_bin_bad crashes. > > > > > > > > The difference is the only -O2 used while test_bin_bad build. > > > > > > > > The symptoms are the same - incorrect esp usage in caller > > > > after call function returning object. > > > > > > > > We reproduced the bug in gcc 4.1.0/4.1.1/4.1.2 > > > > gcc 3.x can't compile the sources. > > > > > > OK, we're getting closer. > > > > Hi > > > > Are you capable to reproduce the bug? > > Yes. > > > > Unfortunately, your test case includes a > > > ton of system headers for one particular system/version of gcc, > > But it doesn't contain any #include directive. > > It is self consistent. > > > > Do you mean that I should > > add "#include" for system headers? > > Yes. Otherwise it's not possible to compile it with any other version > of gcc than the one you built it on. A test case should be > standalone and not depend on a particulat gcc version. Sending you the test without inlined standard includes. But the source is still very large - ~1Mb. > > > I think this way we may made the bug less obvious. > > > > and it > > > also includes a lot of library code not used in your test case. > > > > I understood it from the start of discussion :) > > I hoped: > > > 1. GCC delelopers have some tools or methods to automatically > > remove text which does not affect codegeneration. Or some compile > > stage which contans intermediate data without unused by > > codegeneration prototypes, classes, etc. > > > 2. GCC developers are smart enough to localize and try to fix gcc > > having such obvious indication as this - codegenerator "forgets" > > that it called function returning object. Is it impossible to find > > thin place/places taking into account above, fix it and check by > > our test? > > It's up to you, really. The more self-contained a test case you > provide, the more likely someone is to fix your problem. Remember > that they are, in this case, volunteers, and not highly motivated to > spend a lot of time to try to remove all the extraneous code. > > > In such a case the test size has no defference in my opinion. > > > > > > > Fillet that, and you will have a test case that can be submitted. > > > > It requires a lot of mannual work - remove a peace of code, then > > check that the test can be built, the check that the bug did not > > disappear, etc. > > It's your code, so presumably you are familiar with it. I stepped > though the code in gdb, and it seemed that not many routines were > actually involved. We have tried to minimize the test but without significant success. If we try to create simple test case from scratch we can't reproduce the problem. I have a feeling the problem appears if huge templated code involved into codegeneration. If I understand correct it is impossible to file this bug to gcc bugzilla - it does not permit attachements. Do you think I need to post the problem to some another list to get it solved? Or just leave it( and you :) ) alone? Regards Vladimir -------------- next part -------------- A non-text attachment was scrubbed... Name: gcc_bug.tgz Type: application/x-gzip Size: 81859 bytes Desc: not available URL: From tprince@myrealbox.com Fri Mar 16 11:52:00 2007 From: tprince@myrealbox.com (Timothy C Prince) Date: Fri, 16 Mar 2007 11:52:00 -0000 Subject: errors while using -lgfortran instead of libg2c.a Message-ID: <1174000481.c7c3da3ctprince@myrealbox.com> -----Original Message----- From: "satyaakam goswami" To: gcc-help@gcc.gnu.org Date: Thu, 8 Mar 2007 11:07:05 +0530 Subject: errors while using -lgfortran instead of libg2c.a we getting undefined symbol:`d_sign', please suggest. /tsi71/pubref/liba/lnx86_gcc_ia32/liblapack.a /tsi71/pubref/liba/lnx86_gcc_ia32/libblas.a /tsi71/pubref/liba/lnx86_gcc_ia32/liblamatrix++.a -lm -lgfortran /tsi71/pubref/liba/lnx86_gcc_ia32/liblapack++.a(dtimmg.o): In function `dtimmg_': dtimmg.c:(.text+0xe47): undefined reference to `d_sign' dtimmg.c:(.text+0xf11): undefined reference to `d_sign' dtimmg.c:(.text+0x1004): undefined reference to `d_sign' dtimmg.c:(.text+0x10de): undefined reference to `d_sign' dtimmg.c:(.text+0x120d): undefined reference to `d_sign' Satya _____________________________ It's probably better not to mix libraries built with libg2c with gfortran. One would think that a linux distribution which supports a satisfactory gfortran (gcc 4.1 or newer) would have libraries built for libgfortran. Older libraries might be better rebuilt using gfortran. Tim Prince From sigra@home.se Fri Mar 16 12:39:00 2007 From: sigra@home.se (Erik) Date: Fri, 16 Mar 2007 12:39:00 -0000 Subject: Optimisation puzzle In-Reply-To: References: Message-ID: <45FA852C.1090904@home.se> Nate Denmark skrev: > I have a question about the optimiser in GCC. Take this bit of code: > > for(x = 0; x != 10; x++) > puts("Hello"); > > When compiled with full optimisations (-O3, -fexpensive-optimizations > etc.) it generates the following loop in assembly: > > .L2: > incl %ebx > movl $.LC0, (%esp) > call puts > cmpl $10, %ebx > jne .L2 > > .LC0 points to the "Hello" string. I'm wondering why GCC puts that > 'movl' line inside the loop, so that it's executed each time, when it > could go before the loop? As I understand it, 'puts' shouldn't do > anything to the stack, and the return value is passed back in eax, so > I'm not sure why it's doing the 'movl' each time. If I force loop > unrolling the same thing happens -- the 'movl' each iteration. From man:puts I see that it is declared "int puts(const char *)". This means that puts does not promise to leave its argument unchanged. Therefore the caller must push the argument anew before each call. If it had been declared "int puts(const char * const)" instead, the push should be moved outside the loop. Unfortunately this does not seem to work. I tried with the following program: void q(const unsigned int); void f() {for (unsigned int x = 0; x != 10; x++) q(77);} and built it with "gcc -std=c99 -Os -Wall -Wextra -Werror -S": .L2: subl $12, %esp incl %ebx pushl $77 call q addl $16, %esp cmpl $10, %ebx jne .L2 As you can see, "pushl $77" is still inside the loop even though q promises to not change its argument. This must be a bug. I tried to reproduce the bug with Ada and although the loop generated from Ada source code is indeed 2 instruction shorter (5 instructions instead of 7 instructions for C), the bug seems to be there too. I have this program in f.adb: with Q; procedure F is begin for i in 1 .. 10 loop Q(77); end loop; end F; and q.ads: procedure Q(N : in Natural); and built with "gnatgcc -Os -Wall -Wextra -Wextra -Werror -S f.adb": .L5: pushl $77 .LCFI3: call _ada_q popl %eax decl %ebx jns .L5 So if you need this loop to be tight, write it in Ada. But something, probably GCC, still needs to be fixed to get the "pushl $77" out of the loop (for any language). Unless someone explains that I have misses something, I will report this as a bug to gcc. Note 1: Tested with gcc 4.1.1 (Gentoo 4.1.1-r3) and gnatgcc 3.4.5 (from Gentoo dev-lang/gnat-3.45). Note 2: If you change the loop in C to "for (unsigned int x = 10; x; --x)" you will get it down to 6 instructions. Still not as tight as the Ada version, but one instruction less than your version. That gcc does not optimize your version to the 6 instruction version seems to be another bug. (I will report that too unless someone objects.) From Markus.Duft@salomon.at Fri Mar 16 13:49:00 2007 From: Markus.Duft@salomon.at (Duft Markus) Date: Fri, 16 Mar 2007 13:49:00 -0000 Subject: Cross GCC and Sysroot Message-ID: <18597F2B47F1394A9B309945EC724112D0B361@servex01.wamas.com> Hi! I'm working on getting a compiler-farm up, that can cross compile to multiple platforms. It's allready almost done, but there are some small problems left over. Since the Compiler-Farm will only compile (no preprocessing, no linking, etc.) because of usage of DISTCC, i wanted to ask if there is a way to build binutils/gcc in a way that there are only the really necessary parts (as, gcc, g++) without support for linking and other unwanted stuff. The second problem is, how to find out what to put in the sysroot packages used to bootstrap the crossc ompilers for each platform. At the moment this is a really annoying manual process of sorting out and tar'ing together /usr/include and /usr/lib with some additional softlinks. Is there a somewhat short list of files i need for this purpose? The sysroot package is used only for bootstrapping gcc, since everything that the cross-gcc will see is preprocessed allready. Any comments/ideas appreciated ;o) Thanks in Advance, Markus From karuottu@mbnet.fi Fri Mar 16 15:20:00 2007 From: karuottu@mbnet.fi (Kai Ruottu) Date: Fri, 16 Mar 2007 15:20:00 -0000 Subject: Cross GCC and Sysroot In-Reply-To: <18597F2B47F1394A9B309945EC724112D0B361@servex01.wamas.com> References: <18597F2B47F1394A9B309945EC724112D0B361@servex01.wamas.com> Message-ID: <45FAA186.4070207@mbnet.fi> Duft Markus kirjoitti: > Hi! > > I'm working on getting a compiler-farm up, that can cross compile to > multiple platforms. It's allready almost done, but there are some small > problems left over. > > Since the Compiler-Farm will only compile (no preprocessing, no linking, > etc.) because of usage of DISTCC, i wanted to ask if there is a way to > build binutils/gcc in a way that there are only the really necessary > parts (as, gcc, g++) without support for linking and other unwanted > stuff. > Just leave the build when it stops! It stops when trying libgcc, so if you don't link, where you will need libgcc? > The second problem is, how to find out what to put in the sysroot > packages used to bootstrap the crossc ompilers for each platform. At the > moment this is a really annoying manual process of sorting out and > tar'ing together /usr/include and /usr/lib with some additional > softlinks. Is there a somewhat short list of files i need for this > purpose? > You don't need anything for the $target system... > The sysroot package is used only for bootstrapping gcc, since everything > that the cross-gcc will see is preprocessed allready. > No 'bootstrap' required either... In a nutshell: Building GCC binaries requires ONLY the $host GCC ! Nothing for the $target ! Producing anything for the $target WITH the new GCC then can require quite a lot $target stuff ! From Markus.Duft@salomon.at Fri Mar 16 17:24:00 2007 From: Markus.Duft@salomon.at (Duft Markus) Date: Fri, 16 Mar 2007 17:24:00 -0000 Subject: Cross GCC and Sysroot Message-ID: <18597F2B47F1394A9B309945EC724112D0B394@servex01.wamas.com> Kai Ruottu <> wrote: > Duft Markus kirjoitti: >> Hi! >> >> I'm working on getting a compiler-farm up, that can cross compile to >> multiple platforms. It's allready almost done, but there are some >> small problems left over. >> >> Since the Compiler-Farm will only compile (no preprocessing, no >> linking, etc.) because of usage of DISTCC, i wanted to ask if there >> is a way to build binutils/gcc in a way that there are only the >> really necessary parts (as, gcc, g++) without support for linking >> and other unwanted stuff. >> > Just leave the build when it stops! It stops when trying libgcc, so > if you don't link, > where you will need libgcc? You're right ;o) i don't need libgcc anyways. But i'm inside an automated build system, which will die if there is an error. Additionally i can't do "make install" in this state, can i? >> The second problem is, how to find out what to put in the sysroot >> packages used to bootstrap the crossc ompilers for each platform. At >> the moment this is a really annoying manual process of sorting out >> and tar'ing together /usr/include and /usr/lib with some additional >> softlinks. Is there a somewhat short list of files i need for this >> purpose? >> > You don't need anything for the $target system... >> The sysroot package is used only for bootstrapping gcc, since >> everything that the cross-gcc will see is preprocessed allready. >> > No 'bootstrap' required either... > > In a nutshell: Building GCC binaries requires ONLY the $host GCC ! > Nothing for > the $target ! Producing anything for the $target WITH the new GCC > then can require > quite a lot $target stuff ! Oki doki.... ;o) Thanks, Markus From pranabesh.dash@gmail.com Fri Mar 16 21:31:00 2007 From: pranabesh.dash@gmail.com (Pranabesh Dash) Date: Fri, 16 Mar 2007 21:31:00 -0000 Subject: GCC 4.1.0 compile error In-Reply-To: <47694070703161021v12b67ee3j144baf0459f428dd@mail.gmail.com> References: <47694070703161021v12b67ee3j144baf0459f428dd@mail.gmail.com> Message-ID: <47694070703161024h49462899od3df2cc1bc9b4ff1@mail.gmail.com> On 3/16/07, Pranabesh Dash wrote: > > Hi, > The following piece of code compiles fine with 3.4.2, 4.0.0 but errors out on 4.1.0. Seems like a GCC bug. The friend function name is recognized if called as a function but does not work when used as a function pointer. An explicit function declaration (or definition reordered) is needed to get it to compile with 4.1.0. > > Do you believe this is a bug or a feature??? > > --P.D > > #include > > using namespace std; > > class object; > typedef void (func_ptr)( object* ); > class object { > > public: > object() {} > ~object() {} > > void top_func(); > void call_func_ptr(func_ptr); > protected: > friend void frnd_func(object*); > > private: > int member; > }; > > //friend.cpp: In member function #void object::top_func()#: > //friend.cpp:27: error: #frnd_func# was not declared in this scope > // The following needs to be uncommented to get 4.1.0 to compile > //void frnd_func(object*) ; > > void object::top_func() { > frnd_func(this); // Does not complain on this > call_func_ptr(frnd_func); // But complains on this !!!!! > } > > void object::call_func_ptr(func_ptr fp) { > fp(this); > } > > void frnd_func(object* obj) { > obj->member = 4; > } > > main () { > > object my_obj; > } > From iant@google.com Fri Mar 16 21:35:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Fri, 16 Mar 2007 21:35:00 -0000 Subject: Optimisation puzzle In-Reply-To: <45FA852C.1090904@home.se> References: <45FA852C.1090904@home.se> Message-ID: Erik writes: > From man:puts I see that it is declared "int puts(const char > *)". This means that puts does not promise to leave its argument > unchanged. Therefore the caller must push the argument anew before > each call. If it had been declared "int puts(const char * const)" > instead, the push should be moved outside the loop. Unfortunately this > does not seem to work. I tried with the following program: > void q(const unsigned int); > void f() {for (unsigned int x = 0; x != 10; x++) q(77);} > > and built it with "gcc -std=c99 -Os -Wall -Wextra -Werror -S": > .L2: > subl $12, %esp > incl %ebx > pushl $77 > call q > addl $16, %esp > cmpl $10, %ebx > jne .L2 > > As you can see, "pushl $77" is still inside the loop even though q > promises to not change its argument. This must be a bug. This is not a bug. const on an automatic variable in C is more advisory than anything else. You are not permitted to change a const object, but you can cast its address to a non-const pointer. The only time const really means something is when it is applied to a global or static variable. In that case the compiler is permitted to put the variable in read-only storage. That is, this is legal C: int q (const unsigned int i) { int *p = (int *) &i; *p = 1; return i; } Ian From iant@google.com Fri Mar 16 22:07:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Fri, 16 Mar 2007 22:07:00 -0000 Subject: GCC 4.1.0 compile error In-Reply-To: <47694070703161024h49462899od3df2cc1bc9b4ff1@mail.gmail.com> References: <47694070703161021v12b67ee3j144baf0459f428dd@mail.gmail.com> <47694070703161024h49462899od3df2cc1bc9b4ff1@mail.gmail.com> Message-ID: "Pranabesh Dash" writes: > The following piece of code compiles fine with 3.4.2, 4.0.0 but > errors out on 4.1.0. Seems like a GCC bug. The friend function name > is recognized if called as a function but does not work when used as > a function pointer. An explicit function declaration (or definition > reordered) is needed to get it to compile with 4.1.0. > > Do you believe this is a bug or a feature??? This is a feature. It is caused by closer conformance to the C++ standard. See the -ffriend-injection option and see "ARM-style name-injection" in http://gcc.gnu.org/gcc-4.1/changes.html. Ian From sigra@home.se Fri Mar 16 22:24:00 2007 From: sigra@home.se (Erik) Date: Fri, 16 Mar 2007 22:24:00 -0000 Subject: Optimisation puzzle In-Reply-To: References: <45FA852C.1090904@home.se> Message-ID: <45FB1566.5010605@home.se> Ian Lance Taylor skrev: > Erik writes: > > >> From man:puts I see that it is declared "int puts(const char >> *)". This means that puts does not promise to leave its argument >> unchanged. Therefore the caller must push the argument anew before >> each call. If it had been declared "int puts(const char * const)" >> instead, the push should be moved outside the loop. Unfortunately this >> does not seem to work. I tried with the following program: >> void q(const unsigned int); >> void f() {for (unsigned int x = 0; x != 10; x++) q(77);} >> >> and built it with "gcc -std=c99 -Os -Wall -Wextra -Werror -S": >> .L2: >> subl $12, %esp >> incl %ebx >> pushl $77 >> call q >> addl $16, %esp >> cmpl $10, %ebx >> jne .L2 >> >> As you can see, "pushl $77" is still inside the loop even though q >> promises to not change its argument. This must be a bug. >> > > This is not a bug. const on an automatic variable in C is more > advisory than anything else. You are not permitted to change a const > object, but you can cast its address to a non-const pointer. It is a bug. If not in gcc, then in C, that allows the programmers to do such strange things, preventing the compiler from optimizing the code. The right thing for gcc to do would be to enable such optimizations and warn when the code casts away constness, that it could break optimized code. I believe that is what gcc already does for some stupidities; gcc performs some optimizations that are broken by reinterpret_cast and gives "warning: dereferencing type-punned pointer will break strict-aliasing rules". So gcc should be modified to be useful for users who need the optimization but not the bizarre misfeatures of C. Anyway, it is surely a bug that gcc does not optimize away the "pushl $77" inside the loop from the Ada program. Unlike C, Ada was not designed for ugly hacks, but for clarity and for letting compilers perform optimizations. So a promise is a promise. If a function says it will not touch something, it won't. From iant@google.com Fri Mar 16 23:33:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Fri, 16 Mar 2007 23:33:00 -0000 Subject: Optimisation puzzle In-Reply-To: <45FB1566.5010605@home.se> References: <45FA852C.1090904@home.se> <45FB1566.5010605@home.se> Message-ID: Erik writes: > > This is not a bug. const on an automatic variable in C is more > > advisory than anything else. You are not permitted to change a const > > object, but you can cast its address to a non-const pointer. > It is a bug. If not in gcc, then in C, that allows the programmers to > do such strange things, preventing the compiler from optimizing the > code. The right thing for gcc to do would be to enable such > optimizations and warn when the code casts away constness, that it > could break optimized code. I believe that is what gcc already does > for some stupidities; gcc performs some optimizations that are broken > by reinterpret_cast and gives "warning: dereferencing type-punned > pointer will break strict-aliasing rules". So gcc should be modified > to be useful for users who need the optimization but not the bizarre > misfeatures of C. Those uses of reinterpret_cast are actually forbidden by the standard; that warning is telling you that you are doing something forbidden. The standard serves as a contract between the compiler and the programmer. There are reasons to sometimes modify the standard; it's not clear that this is one of them. > Anyway, it is surely a bug that gcc does not optimize away the "pushl > $77" inside the loop from the Ada program. Unlike C, Ada was not > designed for ugly hacks, but for clarity and for letting compilers > perform optimizations. So a promise is a promise. If a function says > it will not touch something, it won't. I don't know Ada. Ian From crowl@google.com Sat Mar 17 10:28:00 2007 From: crowl@google.com (Lawrence Crowl) Date: Sat, 17 Mar 2007 10:28:00 -0000 Subject: Optimisation puzzle In-Reply-To: <45FB1566.5010605@home.se> References: <45FA852C.1090904@home.se> <45FB1566.5010605@home.se> Message-ID: <29bd08b70703161632t2b6e0eddn31dbd17b4207f53b@mail.gmail.com> On 3/16/07, Erik wrote: > Ian Lance Taylor skrev: > > Erik writes: > > > > > >> From man:puts I see that it is declared "int puts(const char > >> *)". This means that puts does not promise to leave its argument > >> unchanged. Therefore the caller must push the argument anew before > >> each call. If it had been declared "int puts(const char * const)" > >> instead, the push should be moved outside the loop. Unfortunately this > >> does not seem to work. I tried with the following program: > >> void q(const unsigned int); > >> void f() {for (unsigned int x = 0; x != 10; x++) q(77);} > >> > >> and built it with "gcc -std=c99 -Os -Wall -Wextra -Werror -S": > >> .L2: > >> subl $12, %esp > >> incl %ebx > >> pushl $77 > >> call q > >> addl $16, %esp > >> cmpl $10, %ebx > >> jne .L2 > >> > >> As you can see, "pushl $77" is still inside the loop even though q > >> promises to not change its argument. This must be a bug. > > > > This is not a bug. const on an automatic variable in C is more > > advisory than anything else. You are not permitted to change a const > > object, but you can cast its address to a non-const pointer. The "lost optimization" in this case has nothing to do with const versus non-const. The issue is that the call deallocates the parameters. The pushl is allocating the argument. While it is possible to avoid the deallocation and reallocation, doing so requires either changing the calling convention or doing "whole program" optimization. In either event, all of the tools that understand the calling convention, like the debugger, would need to be modified. Again, this can be done, but not without investment and a period of "bugs". Note that in C++, you are not permitted to modify a const parameter. The compiler can optimize on that basis, but in this case, the code would be unaffected because of the allocation issue. > It is a bug. If not in gcc, then in C, that allows the programmers to do > such strange things, preventing the compiler from optimizing the code. > The right thing for gcc to do would be to enable such optimizations and > warn when the code casts away constness, that it could break optimized > code. I believe that is what gcc already does for some stupidities; gcc > performs some optimizations that are broken by reinterpret_cast and > gives "warning: dereferencing type-punned pointer will break > strict-aliasing rules". So gcc should be modified to be useful for users > who need the optimization but not the bizarre misfeatures of C. Given the need for compatibility with existing programs at the time that const was introduced, I don't think it is possible to have the kind of const safety that you seem to want. > Anyway, it is surely a bug that gcc does not optimize away the "pushl > $77" inside the loop from the Ada program. I think the Ada behavior is correct as well, because of the argument allocation. Skipping that would change the ABI, which should not be done lightly. > Unlike C, Ada was not designed for ugly hacks, but for clarity > and for letting compilers perform optimizations. I think that is an unfair characterization of C. The C language was designed to let programmers do the kinds of optimizations that most compilers of the day were not doing. It enabled many programmers get out of assembly coding. Ada had the advantage of being designed some ten years after C, when compilers could be relied upon to do optimizations. Even so, it was a bit of a stretch, and Ada lost many of its potential users because of poor initial performance. I am not saying that the Ada designers made a mistake, just that there were consequences. > So a promise is a promise. If a function says it will not touch > something, it won't. But, as I've shown, this notion does not apply to the example. -- Lawrence Crowl From sigra@home.se Sat Mar 17 22:24:00 2007 From: sigra@home.se (Erik) Date: Sat, 17 Mar 2007 22:24:00 -0000 Subject: Optimisation puzzle In-Reply-To: <29bd08b70703161632t2b6e0eddn31dbd17b4207f53b@mail.gmail.com> References: <45FA852C.1090904@home.se> <45FB1566.5010605@home.se> <29bd08b70703161632t2b6e0eddn31dbd17b4207f53b@mail.gmail.com> Message-ID: <45FBC2EC.8090900@home.se> Lawrence Crowl skrev: > On 3/16/07, Erik wrote: >> Ian Lance Taylor skrev: >> > Erik writes: >> > >> > >> >> From man:puts I see that it is declared "int puts(const char >> >> *)". This means that puts does not promise to leave its argument >> >> unchanged. Therefore the caller must push the argument anew before >> >> each call. If it had been declared "int puts(const char * const)" >> >> instead, the push should be moved outside the loop. Unfortunately >> this >> >> does not seem to work. I tried with the following program: >> >> void q(const unsigned int); >> >> void f() {for (unsigned int x = 0; x != 10; x++) q(77);} >> >> >> >> and built it with "gcc -std=c99 -Os -Wall -Wextra -Werror -S": >> >> .L2: >> >> subl $12, %esp >> >> incl %ebx >> >> pushl $77 >> >> call q >> >> addl $16, %esp >> >> cmpl $10, %ebx >> >> jne .L2 >> >> >> >> As you can see, "pushl $77" is still inside the loop even though q >> >> promises to not change its argument. This must be a bug. >> > >> > This is not a bug. const on an automatic variable in C is more >> > advisory than anything else. You are not permitted to change a const >> > object, but you can cast its address to a non-const pointer. > > The "lost optimization" in this case has nothing to do with const > versus non-const. The issue is that the call deallocates the > parameters. The pushl is allocating the argument. OK, as I understand it, the pushl $77 does 2 things: 1. Copy the value 77. 2. Allocate space for it (by changing the stack pointer). And in C, allocating the space must be done in each iteration because the called function deallocates it. But copying the value 77 in each iteration could be optimized away. But what about Ada? Does it have the same calling convetion? See the Ada loop: .L5: pushl $77 .LCFI3: call _ada_q popl %eax decl %ebx jns .L5 It looks like in Ada, the caller deallocates the parameter (popl). If this is so, it would mean that both the push and the pop should be moved out of the loop, something like: pushl $77 .L5: .LCFI3: call _ada_q decl %ebx jns .L5 popl %eax This would cut the loop down to only 3 instructions. Not bad compared to the 7 instructions in the original C loop. But the C version should probably be counted as having 8 instructions to make the comparison accurate, since it has a hidden popl inside q, which is not in Q of the Ada version. Is this correct? From stecarucci@hotmail.com Sun Mar 18 11:09:00 2007 From: stecarucci@hotmail.com (stefano carucci) Date: Sun, 18 Mar 2007 11:09:00 -0000 Subject: data type & sections Message-ID: Hello all, my question is: Is it possible to set a data type (for example, the type "Matrix",customized by means of a struct, or a standard type, as "int") in a certain section (defined in the linker script, as ".data") in order for every Matrix-items (for example) to be placed in a dedicated memory? maybe, by means of a #pragma...? further details : the target processor is a microblaze. I have read about linker script ( http://sourceware.org/binutils/docs-2.17/ld/Scripts.html ) Thank you for your kindness!!! Stefano Carucci _________________________________________________________________ Windows Live OneCare: tutto per la cura del tuo PC ! Provalo Gratis! http://onecare.live.com/standard/it-it/default.htm From ITZHACK@il.ibm.com Sun Mar 18 15:03:00 2007 From: ITZHACK@il.ibm.com (Itzhack Goldberg) Date: Sun, 18 Mar 2007 15:03:00 -0000 Subject: Error: expected expression before return In-Reply-To: <45F95132.4050902@microimages.com> Message-ID: Hi, Thanks for the quick and accurate answer. However I wonder about how gcc/gdb handles compound statements like: ((rtrn1=open("/tmp/file1",O_RDONLY))) && ((rtrn2=open("/tmp/file2",O_WRONLY))) ... What I see is, that the two expressions are treated as one statement when I try to "step" through the code with gdb... Is there a way/flag I could introduce so that I could indeed step through the statement, one expression at the time ? Thanks in advance, - Itzhack Dave Williss To Itzhack Goldberg/Haifa/IBM@IBMIL 15/03/07 15:59 cc gcc-help@gcc.gnu.org, Tehila Meyzels/Haifa/IBM@IBMIL Subject Re: Error: expected expression before return Itzhack Goldberg wrote: > The following program doesn't pass compliation: > > #include > int izik() > { > ( 1 == 1 ) && return 0 || return 1 ; > } > int main() > { > int rtrn = izik(); > } > > > The error is: error: expected expression before 'return' > > int izik() { return ( 1 == 1) ? 0 : 1; } This is C, not Perl :-) Shalom From dberlin@dberlin.org Mon Mar 19 06:29:00 2007 From: dberlin@dberlin.org (Daniel Berlin) Date: Mon, 19 Mar 2007 06:29:00 -0000 Subject: Signatures Was: where can I get gcc optimizations information In-Reply-To: <3B4C77997DD0254B86D3C9454476B6BC0F03EC20@lonms00812.fm.rbsgrp.net> References: <3B4C77997DD0254B86D3C9454476B6BC0F03EC20@lonms00812.fm.rbsgrp.net> Message-ID: <4aca3dc20703180803o3fbdc47av38fc17245cb0aeda@mail.gmail.com> On 3/12/07, CARTER-HITCHIN, David, GBM wrote: > Hello Andrew (once again), > > > Such disclaimers are inappropriate for mail sent to public lists. If > > your company automatically adds something like this to outgoing mail, > > and you can't convince them to stop, you might consider using a free > > web-based e-mail account. > > I have at least two of these, and they're both banned here at work, hence > my point about people not being able to interact with the list, who work > in such organisations. > We're sorry, but thousands of people are not going to possibly take on liability and risk simply because your company believes it is a good idea to add disclaimers to mails. If this means you can't interact with people, maybe your company should reconsider it's stance on attempting to foist the liability and risk of using email onto others (which is effectively what these disclaimers do). If they won't, we're sorry, but we're doing this to avoid burdening thousands of people who can use the list without having to worry about these things. You can, of course, argue that these disclaimers mean nothing, and are worse than useless, but at least i'm not willing to spend the tens of thousands of dollars it would cost in court to prove it for each different one i receive. IAAL, Dan From supermax9@yandex.ru Mon Mar 19 06:35:00 2007 From: supermax9@yandex.ru (supermax9) Date: Mon, 19 Mar 2007 06:35:00 -0000 Subject: Multiprocessor compiling Message-ID: <9547114.post@talk.nabble.com> My question is very simple - can I achieve a descrease of overall compiling time with gcc on a multiprocessor system? -- View this message in context: http://www.nabble.com/Multiprocessor-compiling-tf3425303.html#a9547114 Sent from the gcc - Help mailing list archive at Nabble.com. From brian@dessent.net Mon Mar 19 10:12:00 2007 From: brian@dessent.net (Brian Dessent) Date: Mon, 19 Mar 2007 10:12:00 -0000 Subject: Multiprocessor compiling References: <9547114.post@talk.nabble.com> Message-ID: <45FE2F38.2EB160A1@dessent.net> supermax9 wrote: > My question is very simple - can I achieve a descrease of overall compiling > time with gcc on a multiprocessor system? gcc itself is single-threaded, so a single instance of it can not benefit from multiple cores. However, you can instruct make to launch multiple jobs in parallel with the -j argument, and so assuming that your Makefile does not contain incorrect or inaccurate dependency relations (i.e. it is "parallel make safe"), and assuming that you have multiple files to compile, then you can in fact take advantage of as many cores/processors as the system has. Brian From Markus.Duft@salomon.at Mon Mar 19 10:17:00 2007 From: Markus.Duft@salomon.at (Duft Markus) Date: Mon, 19 Mar 2007 10:17:00 -0000 Subject: Cross GCC and Sysroot Message-ID: <18597F2B47F1394A9B309945EC724112D0B4ED@servex01.wamas.com> Hi! My question is still not answered, has anybody ideas about this? What i need: * A minimal gcc (*and* g++) * It will be use only for compiling with distcc (so no preprocessing or linking, so i don't need libgcc and stuff) * The build must not exit with an error (as the solution below supposes...) I really just need a gcc and g++ executable that is called from distccd. I'm inside an automated build system so configure/make/make install must go through without error, or otherwise the outer build-system will exit too. Do i need a sysroot package to accomplish this? Is this possible at all? At the moment i'm trying to build the whole gcc suite as cross compiler. For now i'm only working on a ia64-hp-hpux11.23 to i686-pc-linux-gnu cross compiler, but in the final stage there should be compilers for at least the following (allways running on ia64-hp-hpux11.23): ia64-hp-hpux11.23 hppa2.0w-hp-hpux11.11 powerpc-ibm-aix5.2.0.0 powerpc-ibm-aix5.3.0.0 sparc-sun-solaris2.9 i386-pc-solaris2.10 i686-pc-linux-gnu I know this is a big project, and that there is some work to be done inside gcc ;o) The other problem is disk space. Since the host is a Blade-Server there is only little space available (about 36GB i think, or even less, but for sure not more) so unneeded stuff wouldn't be too cool. Any Help and/or Comments appreciated! Cheers, Markus Duft Markus <> wrote: > Kai Ruottu <> wrote: >> Duft Markus kirjoitti: >>> Hi! >>> >>> I'm working on getting a compiler-farm up, that can cross compile to >>> multiple platforms. It's allready almost done, but there are some >>> small problems left over. >>> >>> Since the Compiler-Farm will only compile (no preprocessing, no >>> linking, etc.) because of usage of DISTCC, i wanted to ask if there >>> is a way to build binutils/gcc in a way that there are only the >>> really necessary parts (as, gcc, g++) without support for linking >>> and other unwanted stuff. >>> >> Just leave the build when it stops! It stops when trying libgcc, >> so if you don't link, where you will need libgcc? > > You're right ;o) i don't need libgcc anyways. But i'm inside an > automated build system, which will die if there is an error. > Additionally i can't do "make install" in this state, can i? > >>> The second problem is, how to find out what to put in the sysroot >>> packages used to bootstrap the crossc ompilers for each platform. At >>> the moment this is a really annoying manual process of sorting out >>> and tar'ing together /usr/include and /usr/lib with some additional >>> softlinks. Is there a somewhat short list of files i need for this >>> purpose? >>> >> You don't need anything for the $target system... >>> The sysroot package is used only for bootstrapping gcc, since >>> everything that the cross-gcc will see is preprocessed allready. >>> >> No 'bootstrap' required either... >> >> In a nutshell: Building GCC binaries requires ONLY the $host GCC ! >> Nothing for the $target ! Producing anything for the $target WITH >> the new GCC then can require quite a lot $target stuff ! > > Oki doki.... ;o) > > Thanks, Markus From aph@redhat.com Mon Mar 19 10:45:00 2007 From: aph@redhat.com (Andrew Haley) Date: Mon, 19 Mar 2007 10:45:00 -0000 Subject: Signatures Was: where can I get gcc optimizations information In-Reply-To: <4aca3dc20703180803o3fbdc47av38fc17245cb0aeda@mail.gmail.com> References: <3B4C77997DD0254B86D3C9454476B6BC0F03EC20@lonms00812.fm.rbsgrp.net> <4aca3dc20703180803o3fbdc47av38fc17245cb0aeda@mail.gmail.com> Message-ID: <17918.25358.452637.63369@zebedee.pink> Daniel Berlin writes: > > > We're sorry, but thousands of people are not going to possibly take on > liability and risk simply because your company believes it is a good > idea to add disclaimers to mails. > > If this means you can't interact with people, maybe your company > should reconsider it's stance on attempting to foist the liability and > risk of using email onto others (which is effectively what these > disclaimers do). If they won't, we're sorry, but we're doing this to > avoid burdening thousands of people who can use the list without > having to worry about these things. > > You can, of course, argue that these disclaimers mean nothing, and are > worse than useless, but at least i'm not willing to spend the tens of > thousands of dollars it would cost in court to prove it for each > different one i receive. Thanks, Dan. I'm going to cut and keep this reply of yours for the next time this question comes up... Andrew. From aph@redhat.com Mon Mar 19 12:11:00 2007 From: aph@redhat.com (Andrew Haley) Date: Mon, 19 Mar 2007 12:11:00 -0000 Subject: gcc forgets to decrease esp after function call In-Reply-To: <45F984DB.3050201@acronis.com> References: <45F15674.9000701@acronis.com> <17905.22833.766154.45450@zebedee.pink> <45F1681A.6030307@acronis.com> <17905.28252.856544.931176@zebedee.pink> <45F180B3.50901@acronis.com> <17905.33869.537927.207102@zebedee.pink> <45F1A223.6060406@acronis.com> <17905.42424.400663.138838@zebedee.pink> <45F292DA.30804@acronis.com> <17908.16759.282405.262830@zebedee.pink> <45F653D5.8070500@acronis.com> <17910.32685.453760.827798@zebedee.pink> <45F6E269.1050201@acronis.com> <17910.58546.897282.378139@zebedee.pink> <45F80E6C.5090601@acronis.com> <17913.5853.465646.305627@zebedee.pink> <45F92EC7.2000106@acronis.com> <17913.12323.646294.479431@zebedee.pink> <45F984DB.3050201@acronis.com> Message-ID: <17918.27050.815012.142815@zebedee.pink> Vladimir Simonov writes: > Andrew Haley wrote: > > Vladimir Simonov writes: > > > Andrew Haley wrote: > > > > Vladimir Simonov writes: > > > > Fillet that, and you will have a test case that can be submitted. > > > > > > It requires a lot of mannual work - remove a peace of code, then > > > check that the test can be built, the check that the bug did not > > > disappear, etc. > > > > It's your code, so presumably you are familiar with it. I stepped > > though the code in gdb, and it seemed that not many routines were > > actually involved. > > We have tried to minimize the test but without significant success. > If we try to create simple test case from scratch we can't > reproduce the problem. I have a feeling the problem appears > if huge templated code involved into codegeneration. > > If I understand correct it is impossible to file this > bug to gcc bugzilla - it does not permit attachements. > > Do you think I need to post the problem to some another > list to get it solved? Or just leave it( and you :) ) alone? It all depends on what you need. I have this feeling that your problem may well be fixed by a more recent g++. It's hard to be sure, because your test case does not even compile with a more recent g++. This is, I suspect, becasue we have improved g++ to be closer to the real ISO C++ standard. g++ Version 4.3 reports a number of type mismatch errors in the area that may be causing problems. It is quite possible that if you fix these errors your problem will go away. In any case, a self-contained test case is a prerequiesite for filing a bug. Andrew. From eljay@adobe.com Mon Mar 19 12:30:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Mon, 19 Mar 2007 12:30:00 -0000 Subject: Error: expected expression before return In-Reply-To: Message-ID: Hi Itzhack, > Is there a way/flag I could introduce so that I could indeed step through > the statement, one expression at the time ? I'm able to step into each of the function calls, in sequence (assuming the first one succeeds), one sub-expression at a time, using gdb. HTH, --Eljay From ITZHACK@il.ibm.com Mon Mar 19 12:41:00 2007 From: ITZHACK@il.ibm.com (Itzhack Goldberg) Date: Mon, 19 Mar 2007 12:41:00 -0000 Subject: Error: expected expression before return In-Reply-To: Message-ID: Hi John, I am able too, but only by using nexti (and the listed source command is left on the screen as the first line/expression of the compound statement ...). Have you used any special flag ? The example I sent was made of only two pieces, yet conceivably there can be many expressions in such a compound statement like: (expression) && (expression) && . . . (expression) and one would like to be able to break at the particular expression/line. Is is possible to break on the third expression of such a compound statement ? - Itzhack John Love-Jensen To 19/03/07 14:11 Itzhack Goldberg/Haifa/IBM@IBMIL cc MSX to GCC Subject Re: Error: expected expression before return Hi Itzhack, > Is there a way/flag I could introduce so that I could indeed step through > the statement, one expression at the time ? I'm able to step into each of the function calls, in sequence (assuming the first one succeeds), one sub-expression at a time, using gdb. HTH, --Eljay From eljay@adobe.com Mon Mar 19 12:59:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Mon, 19 Mar 2007 12:59:00 -0000 Subject: Error: expected expression before return In-Reply-To: Message-ID: Hi Itzhack, > Have you used any special flag ? Nope. I just do the 's' (step into) which goes into the first sub-expression's function call, 'fin' (finish) to step out of that function, 's' into the second sub-expression's function call. > and one would like to be able to break at the particular expression/line. > Is is possible to break on the third expression of such a compound > statement ? You can break on an expression. You cannot break on a SUB-expression. (Although I did have a debugger that walked through sub-expressions, but that was on the Amiga.) If you want to do something like that, you might want to consider pulling your SUB-expressions out of the expression and in their own expression. It's not any slower. Trust the optimizer. And it makes the if expression more legible, which is better mojo for maintainability. int rtrn1 = open("/tmp/file1", O_RDONLY); // -1 on error if (rtrn1 != -1) { int rtrn2 = open("/tmp/file2", O_WRONLY); // -1 on error if (rtrn2 != -1) { // yada yada yada } } BTW: you did know that open returns -1 on error, correct? HTH, --Eljay From akimaki23@gmail.com Mon Mar 19 14:14:00 2007 From: akimaki23@gmail.com (Akos Rajna) Date: Mon, 19 Mar 2007 14:14:00 -0000 Subject: unicode problem Message-ID: <625cdd630703190559y6291d6f3tfc28a90e61853695@mail.gmail.com> Hi, on some distributions UTF-32 is the default and i need to change the size of wchar_t to 2 bytes. i tried to compile it with -fwide-exec-charset=UTF-16 but it didn't help. any ideas howto change it? thanks, Akos From eljay@adobe.com Mon Mar 19 16:35:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Mon, 19 Mar 2007 16:35:00 -0000 Subject: unicode problem In-Reply-To: <625cdd630703190559y6291d6f3tfc28a90e61853695@mail.gmail.com> Message-ID: Hi Akos, Have you tried -fshort-wchar flag? CAVEAT: Warning: the -fshort-wchar switch causes GCC to generate code that is not binary compatible with code generated without that switch. Use it to conform to a non-default application binary interface. Sincerely, --Eljay From Vladimir.Simonov@acronis.com Mon Mar 19 17:22:00 2007 From: Vladimir.Simonov@acronis.com (Vladimir Simonov) Date: Mon, 19 Mar 2007 17:22:00 -0000 Subject: gcc forgets to decrease esp after function call In-Reply-To: <17918.27050.815012.142815@zebedee.pink> References: <45F15674.9000701@acronis.com> <17905.22833.766154.45450@zebedee.pink> <45F1681A.6030307@acronis.com> <17905.28252.856544.931176@zebedee.pink> <45F180B3.50901@acronis.com> <17905.33869.537927.207102@zebedee.pink> <45F1A223.6060406@acronis.com> <17905.42424.400663.138838@zebedee.pink> <45F292DA.30804@acronis.com> <17908.16759.282405.262830@zebedee.pink> <45F653D5.8070500@acronis.com> <17910.32685.453760.827798@zebedee.pink> <45F6E269.1050201@acronis.com> <17910.58546.897282.378139@zebedee.pink> <45F80E6C.5090601@acronis.com> <17913.5853.465646.305627@zebedee.pink> <45F92EC7.2000106@acronis.com> <17913.12323.646294.479431@zebedee.pink> <45F984DB.3050201@acronis.com> <17918.27050.815012.142815@zebedee.pink> Message-ID: <45FEBBAD.1090604@acronis.com> Andrew Haley wrote: > Vladimir Simonov writes: > > Andrew Haley wrote: > > > Vladimir Simonov writes: > > > > Andrew Haley wrote: > > > > > Vladimir Simonov writes: > > > > > > Fillet that, and you will have a test case that can be submitted. > > > > > > > > It requires a lot of mannual work - remove a peace of code, then > > > > check that the test can be built, the check that the bug did not > > > > disappear, etc. > > > > > > It's your code, so presumably you are familiar with it. I stepped > > > though the code in gdb, and it seemed that not many routines were > > > actually involved. > > > > We have tried to minimize the test but without significant success. > > If we try to create simple test case from scratch we can't > > reproduce the problem. I have a feeling the problem appears > > if huge templated code involved into codegeneration. > > > > If I understand correct it is impossible to file this > > bug to gcc bugzilla - it does not permit attachements. > > > > Do you think I need to post the problem to some another > > list to get it solved? Or just leave it( and you :) ) alone? > > It all depends on what you need. I have this feeling that your > problem may well be fixed by a more recent g++. It's hard to be sure, > because your test case does not even compile with a more recent g++. > This is, I suspect, becasue we have improved g++ to be closer to the > real ISO C++ standard. > > g++ Version 4.3 reports a number of type mismatch errors in the area > that may be causing problems. It is quite possible that if you fix > these errors your problem will go away. Ok, thank you. We'll try to fix sources to be compatible with gcc 4.3. And check the issue. Could you advise somehow working gcc 4.3 CVS snapshot? Link to tarballs would be very helpfull. We are using 4.1.2 because it is the latest stable version. Regards Vladimir From simon.kagstrom@bth.se Mon Mar 19 17:29:00 2007 From: simon.kagstrom@bth.se (Simon Kagstrom) Date: Mon, 19 Mar 2007 17:29:00 -0000 Subject: Inline assembly problem (GCC bug?) Message-ID: <20070319182245.25821cfe@lska> Hello! I have a problem with some inline assembly, which to me looks like a GCC bug but I first wanted to check that I haven't done any obvious mistake in my implementation. I see the problem both on MIPS and IA-32. The code I have is /* Assign 1 to v0 (the MIPS register used for passing function results) */ static inline int inline_asm(void) { register unsigned long __v0 asm("$2"); __asm__ volatile ( "li %0, 1\n" : "=r" (__v0) : : "memory" ); return (int) __v0; } void problem (void) { int a = inline_asm(); int b = overwriter(); tst(a, b); } When disassembling the generated code, this generates the following MIPS assembly code, with my comments 00000000 : 0: 27bdffe8 addiu sp,sp,-24 4: afbf0010 sw ra,16(sp) 8: 24020001 li v0,1 # Result of the inline assembly piece c: 0c000000 jal overwriter # Overwrites v0 10: 00000000 nop # jal delay slot - v0 should have been saved here! 14: 00402021 move a0,v0 # GCC thinks v0 still contains the result of the inline assembly 18: 0c000000 jal tst 1c: 00402821 move a1,v0 # ... *and* the result of overwriter()! 20: 8fbf0010 lw ra,16(sp) 24: 00000000 nop 28: 03e00008 jr ra 2c: 27bd0018 addiu sp,sp,24 This bug seems to be portable - I rewrote the inline assembly part for IA-32 - just a move to %eax - and %eax was indeed overwritten as well. The versions where I have this problem is mips-linux-gnu-gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) but gcc-3.3 (IA-32) handles this just fine. So the usual question: Did I miss something in the inline assembly piece which can cause this problem or is this a proper GCC bug? (The problem was first manifested in some inline assembly for the Cibyl project, http://spel.bth.se/index.php/Cibyl, and the code is based on the Linux system calls for MIPS) -- // Simon -------------- next part -------------- A non-text attachment was scrubbed... Name: a.i Type: application/octet-stream Size: 449 bytes Desc: not available URL: From aph@redhat.com Mon Mar 19 18:08:00 2007 From: aph@redhat.com (Andrew Haley) Date: Mon, 19 Mar 2007 18:08:00 -0000 Subject: gcc forgets to decrease esp after function call In-Reply-To: <45FEBBAD.1090604@acronis.com> References: <45F15674.9000701@acronis.com> <17905.22833.766154.45450@zebedee.pink> <45F1681A.6030307@acronis.com> <17905.28252.856544.931176@zebedee.pink> <45F180B3.50901@acronis.com> <17905.33869.537927.207102@zebedee.pink> <45F1A223.6060406@acronis.com> <17905.42424.400663.138838@zebedee.pink> <45F292DA.30804@acronis.com> <17908.16759.282405.262830@zebedee.pink> <45F653D5.8070500@acronis.com> <17910.32685.453760.827798@zebedee.pink> <45F6E269.1050201@acronis.com> <17910.58546.897282.378139@zebedee.pink> <45F80E6C.5090601@acronis.com> <17913.5853.465646.305627@zebedee.pink> <45F92EC7.2000106@acronis.com> <17913.12323.646294.479431@zebedee.pink> <45F984DB.3050201@acronis.com> <17918.27050.815012.142815@zebedee.pink> <45FEBBAD.1090604@acronis.com> Message-ID: <17918.51298.795800.290992@zebedee.pink> Vladimir Simonov writes: > > > Andrew Haley wrote: > > Vladimir Simonov writes: > > > Andrew Haley wrote: > > > > Vladimir Simonov writes: > > > > > Andrew Haley wrote: > > > > > > Vladimir Simonov writes: > > > > > > > > Fillet that, and you will have a test case that can be submitted. > > > > > > > > > > It requires a lot of mannual work - remove a peace of code, then > > > > > check that the test can be built, the check that the bug did not > > > > > disappear, etc. > > > > > > > > It's your code, so presumably you are familiar with it. I stepped > > > > though the code in gdb, and it seemed that not many routines were > > > > actually involved. > > > > > > We have tried to minimize the test but without significant success. > > > If we try to create simple test case from scratch we can't > > > reproduce the problem. I have a feeling the problem appears > > > if huge templated code involved into codegeneration. > > > > > > If I understand correct it is impossible to file this > > > bug to gcc bugzilla - it does not permit attachements. > > > > > > Do you think I need to post the problem to some another > > > list to get it solved? Or just leave it( and you :) ) alone? > > > > It all depends on what you need. I have this feeling that your > > problem may well be fixed by a more recent g++. It's hard to be sure, > > because your test case does not even compile with a more recent g++. > > This is, I suspect, becasue we have improved g++ to be closer to the > > real ISO C++ standard. > > > > g++ Version 4.3 reports a number of type mismatch errors in the area > > that may be causing problems. It is quite possible that if you fix > > these errors your problem will go away. > > Ok, thank you. > We'll try to fix sources to be compatible with gcc 4.3. > And check the issue. > Could you advise somehow working gcc 4.3 CVS snapshot? > Link to tarballs would be very helpfull. http://gcc.gnu.org/snapshots.html Whether this helps or not, it will be interesting. Even if it doesn't fix things, it's much more easy to get a gcc developer to fix a bug in the development gcc than in an old version. Andrew. From iant@google.com Mon Mar 19 21:33:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Mon, 19 Mar 2007 21:33:00 -0000 Subject: Inline assembly problem (GCC bug?) In-Reply-To: <20070319182245.25821cfe@lska> References: <20070319182245.25821cfe@lska> Message-ID: Simon Kagstrom writes: > When disassembling the generated code, this generates the following > MIPS assembly code, with my comments > > 00000000 : > 0: 27bdffe8 addiu sp,sp,-24 > 4: afbf0010 sw ra,16(sp) > 8: 24020001 li v0,1 # Result of the inline assembly piece > c: 0c000000 jal overwriter # Overwrites v0 > 10: 00000000 nop # jal delay slot - v0 should have been saved here! > 14: 00402021 move a0,v0 # GCC thinks v0 still contains the result of the inline assembly > 18: 0c000000 jal tst > 1c: 00402821 move a1,v0 # ... *and* the result of overwriter()! > 20: 8fbf0010 lw ra,16(sp) > 24: 00000000 nop > 28: 03e00008 jr ra > 2c: 27bd0018 addiu sp,sp,24 This is not a bug. It is a documented restriction on local register variables: Local register variables in specific registers do not reserve the registers, except at the point where they are used as input or output operands in an asm statement and the asm statement itself is not deleted. There are several ways to avoid this problem. Simply returning the register variable doesn't help, but it should work to store the value in a different register. Or change the asm to explicitly copy the value to a variable with the "d" constraint. Ian From kernel-hacker@bennee.com Mon Mar 19 21:46:00 2007 From: kernel-hacker@bennee.com (Alex Bennee) Date: Mon, 19 Mar 2007 21:46:00 -0000 Subject: Cross Linux/x86 to Solaris2.10/x86-64 compiler build problem Message-ID: <1174339982.27206.10.camel@okra.transitives.com> Hi, I'm not sure if this is a binutils problem or something funky in my configure for gcc. gcc fails to link while building libgcc: /export/toolchain/gcc-4.1.2.git/host-i686-pc-linux-gnu/gcc/xgcc -B/export/toolchain/gcc-4.1.2.git/host-i686-pc-linux-gnu/gcc/ -B/export/toolchain/build-install/i686-sun-solaris2.10/bin/ -B/export/toolchain/build-install/i686-sun-solaris2.10/lib/ -isystem /export/toolchain/build-install/i686-sun-solaris2.10/include -isystem /export/toolchain/build-install/i686-sun-solaris2.10/sys-include -O2 -O2 -g3 -DIN_GCC -DCROSS_COMPILE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc/amd64/libgcc.map -o amd64/libgcc_s.so.1.tmp -m64 libgcc/amd64/_muldi3_s.o libgcc/amd64/_negdi2_s.o libgcc/amd64/_lshrdi3_s.o libgcc/amd64/_ashldi3_s.o libgcc/amd64/_ashrdi3_s.o libgcc/amd64/_cmpdi2_s.o libgcc/amd64/_ucmpdi2_s.o libgcc/amd64/_clear_cache_s.o libgcc/amd64/_enable_execute_stack_s.o libgcc/amd64/_trampoline_s.o libgcc/amd64/__main_s.o libgcc/amd64/_absvsi2_s.o libgcc/amd64/_absvdi2_s.o libgcc/amd64/_addvsi3_s.o libgcc/amd64/_addvdi3_s.o libgcc/amd64/_subvsi3_s.o libgcc/amd64/_subvdi3_s.o libgcc/amd64/_mulvsi3_s.o libgcc/amd64/_mulvdi3_s.o libgcc/amd64/_negvsi2_s.o libgcc/amd64/_negvdi2_s.o libgcc/amd64/_ctors_s.o libgcc/amd64/_ffssi2_s.o libgcc/amd64/_ffsdi2_s.o libgcc/amd64/_clz_s.o libgcc/amd64/_clzsi2_s.o libgcc/amd64/_clzdi2_s.o libgcc/amd64/_ctzsi2_s.o libgcc/amd64/_ctzdi2_s.o libgcc/amd64/_popcount_tab_s.o libgcc/amd64/_popcountsi2_s.o libgcc/amd64/_popcountdi2_s.o libgcc/amd64/_paritysi2_s.o libgcc/amd64/_paritydi2_s.o libgcc/amd64/_powisf2_s.o libgcc/amd64/_powidf2_s.o libgcc/amd64/_powixf2_s.o libgcc/amd64/_powitf2_s.o libgcc/amd64/_mulsc3_s.o libgcc/amd64/_muldc3_s.o libgcc/amd64/_mulxc3_s.o libgcc/amd64/_multc3_s.o libgcc/amd64/_divsc3_s.o libgcc/amd64/_divdc3_s.o libgcc/amd64/_divxc3_s.o libgcc/amd64/_divtc3_s.o libgcc/amd64/_fixunssfsi_s.o libgcc/amd64/_fixunsdfsi_s.o libgcc/amd64/_fixunsxfsi_s.o libgcc/amd64/_fixsfdi_s.o libgcc/amd64/_fixunssfdi_s.o libgcc/amd64/_floatdisf_s.o libgcc/amd64/_fixdfdi_s.o libgcc/amd64/_fixunsdfdi_s.o libgcc/amd64/_floatdidf_s.o libgcc/amd64/_fixxfdi_s.o libgcc/amd64/_fixunsxfdi_s.o libgcc/amd64/_floatdixf_s.o libgcc/amd64/_fixtfdi_s.o libgcc/amd64/_fixunstfdi_s.o libgcc/amd64/_floatditf_s.o libgcc/amd64/_divdi3_s.o libgcc/amd64/_moddi3_s.o libgcc/amd64/_udivdi3_s.o libgcc/amd64/_umoddi3_s.o libgcc/amd64/_udiv_w_sdiv_s.o libgcc/amd64/_udivmoddi4_s.o libgcc/amd64/unwind-dw2_s.o libgcc/amd64/unwind-dw2-fde_s.o libgcc/amd64/unwind-sjlj_s.o libgcc/amd64/gthr-gnat_s.o libgcc/amd64/unwind-c_s.o -lc && rm -f amd64/libgcc_s.so && if [ -f amd64/libgcc_s.so.1 ]; then mv -f amd64/libgcc_s.so.1 amd64/libgcc_s.so.1.backup; else true; fi && mv amd64/libgcc_s.so.1.tmp amd64/libgcc_s.so.1 && ln -s libgcc_s.so.1 amd64/libgcc_s.so /export/toolchain/build-install/bin/i686-sun-solaris2.10-ld: cannot find -lc collect2: ld returned 1 exit status make[3]: *** [amd64/libgcc_s.so] Error 1 make[3]: Leaving directory `/export/toolchain/gcc-4.1.2.git/host-i686-pc-linux-gnu/gcc' make[2]: *** [stmp-multilib] Error 2 make[2]: Leaving directory `/export/toolchain/gcc-4.1.2.git/host-i686-pc-linux-gnu/gcc' make[1]: *** [all-gcc] Error 2 make[1]: Leaving directory `/export/toolchain/gcc-4.1.2.git' make: *** [all] Error 2 I've configured gcc with the following: path=`pwd` crossrc="$path/.." host=i686-pc-gnu target=i686-sun-solaris2.10 prefix=$crosssrc/build-install sysroot=$crosssrc/sysroot syslibs=$sysroot/usr/lib sysincludes=$sysroot/usr/include ./configure -prefix=$prefix --target=$target --with-gnu-as --with-gnu-ld --with-libs=$syslibs --with-headers=$sysincludes --enable-languages=c,c ++ --with-cpu=opteron And I'm using the latest binutils CVS as I've been told the linker already supports this cross-compile option. strace'ing the build it seems to search a series of options before it fails: [pid 4382] open("/export/toolchain/build-install/i686-sun-solaris2.10/bin/libc.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) [pid 4382] open("/export/toolchain/build-install/i686-sun-solaris2.10/bin/libc.a", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) [pid 4382] open("/export/toolchain/build-install/i686-sun-solaris2.10/lib/amd64/libc.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) [pid 4382] open("/export/toolchain/build-install/i686-sun-solaris2.10/lib/amd64/libc.a", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) [pid 4382] open("/export/toolchain/build-install/lib/../i686-sun-solaris2.10/lib/amd64/libc.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) [pid 4382] open("/export/toolchain/build-install/lib/../i686-sun-solaris2.10/lib/amd64/libc.a", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) [pid 4382] open("/lib/64/libc.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) Are these files that should of been copied over into the build directory by binutils from the --with-libs I passed it or should they be referencing sysroot directly. binutils was configured with: path=`pwd` crossrc="$path/.." host=i686-pc-gnu target=i686-sun-solaris2.10 prefix=$crosssrc/build-install sysroot=$crosssrc/sysroot syslibs=$sysroot/usr/lib sysincludes=$sysroot/usr/include ./configure -prefix=$prefix --target=$target --with-gnu-as --with-gnu-ld --with-libs=$syslibs --with-headers=$sysincludes --enable-languages=c,c ++ --with-cpu=opteron Regards, -- Alex, homepage: http://www.bennee.com/~alex/ By doing just a little every day, you can gradually let the task completely overwhelm you. From drow@false.org Tue Mar 20 00:23:00 2007 From: drow@false.org (Daniel Jacobowitz) Date: Tue, 20 Mar 2007 00:23:00 -0000 Subject: Cross Linux/x86 to Solaris2.10/x86-64 compiler build problem In-Reply-To: <1174339982.27206.10.camel@okra.transitives.com> References: <1174339982.27206.10.camel@okra.transitives.com> Message-ID: <20070319214612.GA23973@caradoc.them.org> On Mon, Mar 19, 2007 at 09:33:01PM +0000, Alex Bennee wrote: > path=`pwd` > crossrc="$path/.." > host=i686-pc-gnu > target=i686-sun-solaris2.10 > prefix=$crosssrc/build-install > sysroot=$crosssrc/sysroot > syslibs=$sysroot/usr/lib > sysincludes=$sysroot/usr/include > > ./configure -prefix=$prefix --target=$target --with-gnu-as --with-gnu-ld > --with-libs=$syslibs --with-headers=$sysincludes --enable-languages=c,c > ++ --with-cpu=opteron I strongly recommend you use --with-sysroot instead of --with-libs / --with-headers. That should help. -- Daniel Jacobowitz CodeSourcery From crowl@google.com Tue Mar 20 07:51:00 2007 From: crowl@google.com (Lawrence Crowl) Date: Tue, 20 Mar 2007 07:51:00 -0000 Subject: Optimisation puzzle In-Reply-To: <45FBC2EC.8090900@home.se> References: <45FA852C.1090904@home.se> <45FB1566.5010605@home.se> <29bd08b70703161632t2b6e0eddn31dbd17b4207f53b@mail.gmail.com> <45FBC2EC.8090900@home.se> Message-ID: <29bd08b70703191723h6f75291drcf63f1e637d15576@mail.gmail.com> On 3/17/07, Erik wrote: > Lawrence Crowl skrev: > > On 3/16/07, Erik wrote: > >> Ian Lance Taylor skrev: > >> > Erik writes: > >> > > >> > > >> >> From man:puts I see that it is declared "int puts(const char > >> >> *)". This means that puts does not promise to leave its argument > >> >> unchanged. Therefore the caller must push the argument anew before > >> >> each call. If it had been declared "int puts(const char * const)" > >> >> instead, the push should be moved outside the loop. Unfortunately > >> this > >> >> does not seem to work. I tried with the following program: > >> >> void q(const unsigned int); > >> >> void f() {for (unsigned int x = 0; x != 10; x++) q(77);} > >> >> > >> >> and built it with "gcc -std=c99 -Os -Wall -Wextra -Werror -S": > >> >> .L2: > >> >> subl $12, %esp > >> >> incl %ebx > >> >> pushl $77 > >> >> call q > >> >> addl $16, %esp > >> >> cmpl $10, %ebx > >> >> jne .L2 > >> >> > >> >> As you can see, "pushl $77" is still inside the loop even though q > >> >> promises to not change its argument. This must be a bug. > >> > > >> > This is not a bug. const on an automatic variable in C is more > >> > advisory than anything else. You are not permitted to change a const > >> > object, but you can cast its address to a non-const pointer. > > > > The "lost optimization" in this case has nothing to do with const > > versus non-const. The issue is that the call deallocates the > > parameters. The pushl is allocating the argument. > OK, as I understand it, the pushl $77 does 2 things: > 1. Copy the value 77. > 2. Allocate space for it (by changing the stack pointer). > > And in C, allocating the space must be done in each iteration because > the called function deallocates it. But copying the value 77 in each > iteration could be optimized away. Well actually the caller deallocates it, but on the other side of the basic-block boundary. Look above for the adjustments to the stack pointer. > But what about Ada? Does it have the same calling convention? > See the Ada loop: > .L5: > pushl $77 > .LCFI3: > call _ada_q > popl %eax > decl %ebx > jns .L5 I don't know the Ada ABI, but this code indicates that it does follow the same convention. It would be a bit surprising if it did not because that would make leveraging the system more difficult. > It looks like in Ada, the caller deallocates the parameter (popl). If > this is so, it would mean that both the push and the pop should be moved > out of the loop, something like: > pushl $77 > .L5: > .LCFI3: > call _ada_q > decl %ebx > jns .L5 > popl %eax > > This would cut the loop down to only 3 instructions. Not bad compared to > the 7 instructions in the original C loop. But the C version should > probably be counted as having 8 instructions to make the comparison > accurate, since it has a hidden popl inside q, which is not in Q of the > Ada version. Is this correct? Well, close. Theoretically, the optimization can be done, at least in C++. (I'm not entirely familiar with the C rules here.) The problem is that changing the details around calls takes extra care if you want the tool (like a debugger) to be able to follow along. In this case, I think you would need to show that the savings is a significant fraction of the total cost. You might be able to do that for static code size, but you'll have a harder time for the dynamic instruction count, which is what most compilers optimize. -- Lawrence Crowl From eithan77@gmail.com Tue Mar 20 10:03:00 2007 From: eithan77@gmail.com (Eithan Eithan) Date: Tue, 20 Mar 2007 10:03:00 -0000 Subject: dump-translation-unit Message-ID: Good morning. I would like to use gcc for limited source code analysis. I am interested in description of declarations only. I found "dump-translation-unit" option very useful for this, but unfortunately it dumps only description of used declarations. I read the manuals and searched the Internet, but was not able to find flag or combination of flags that would cause gcc to dump all declarations. I am afraid such functionality is not implemented, am I right? If so can you suggest reasonable solution? P.S. Please tell me that I wrong :-) Thank you. From daniel.lohmann@informatik.uni-erlangen.de Tue Mar 20 10:59:00 2007 From: daniel.lohmann@informatik.uni-erlangen.de (Daniel Lohmann) Date: Tue, 20 Mar 2007 10:59:00 -0000 Subject: data type & sections In-Reply-To: References: Message-ID: <45FFB171.9060202@informatik.uni-erlangen.de> stefano carucci wrote: > > Hello all, > > my question is: > Is it possible to set a data type (for example, the type > "Matrix",customized by means of a struct, or a standard type, as "int") > in a certain section (defined in the linker script, as ".data") in order > for every Matrix-items (for example) to be placed in a dedicated memory? > maybe, by means of a #pragma...? Gcc supports various attributes to assign linker sections (such as __attribute__((section, ".mysection")), take a look in the manuals), which is in general a more flexible mechanism than #pragmas. Unfortunately, the section attribute can be applied only to variable/function definitions, not to type definition. Hence, it is not possible to define a "default section" for all (static) variable instances of a particular type, even though such feature would be *very* useful. If you have full control over the source code you may use a pre-processor macro as workaround, which instantiates Matrix-items with the proper attributes. Daniel From Markus.Duft@salomon.at Tue Mar 20 11:06:00 2007 From: Markus.Duft@salomon.at (Duft Markus) Date: Tue, 20 Mar 2007 11:06:00 -0000 Subject: GCC cross from ia64 to hppa-hpux Message-ID: <18597F2B47F1394A9B309945EC724112D0B7D5@servex01.wamas.com> Hi! I'm currently looking into building a cross-compiler which runs on ia64-hp-hpux11.23 and targets hppa2.0w-hp-hpux11.11. Has there been anything like it? Currently i don't even get binutils built, so any help would be really cool. Cheers, Markus From aph@redhat.com Tue Mar 20 12:15:00 2007 From: aph@redhat.com (Andrew Haley) Date: Tue, 20 Mar 2007 12:15:00 -0000 Subject: GCC cross from ia64 to hppa-hpux In-Reply-To: <18597F2B47F1394A9B309945EC724112D0B7D5@servex01.wamas.com> References: <18597F2B47F1394A9B309945EC724112D0B7D5@servex01.wamas.com> Message-ID: <17919.49174.874641.146589@zebedee.pink> Duft Markus writes: > I'm currently looking into building a cross-compiler which runs on > ia64-hp-hpux11.23 and targets hppa2.0w-hp-hpux11.11. Has there been > anything like it? > > Currently i don't even get binutils built, so any help would be really > cool. Well, obviously you'll need a full set of target libraries and cross-target binutils. Beyond that, I'm, not aware of any special problems. Just configure and go. Andrew. From Markus.Duft@salomon.at Tue Mar 20 12:18:00 2007 From: Markus.Duft@salomon.at (Duft Markus) Date: Tue, 20 Mar 2007 12:18:00 -0000 Subject: GCC cross from ia64 to hppa-hpux Message-ID: <18597F2B47F1394A9B309945EC724112D0B81E@servex01.wamas.com> Andrew Haley <> wrote: > Duft Markus writes: > > > I'm currently looking into building a cross-compiler which runs on > > ia64-hp-hpux11.23 and targets hppa2.0w-hp-hpux11.11. Has there been > > anything like it? > > > > Currently i don't even get binutils built, so any help would be > really > cool. > > Well, obviously you'll need a full set of target libraries and > cross-target binutils. Beyond that, I'm, not aware of any special > problems. Just configure and go. OK, i have the libraries, but is there a binutils how-to somewhere? I built cross-binutils for solaris9, solaris10 and linux, but HP PA HP-UX is somehow a problem..... *arg* Cheers, Markus > > Andrew. From aph@gcc.gnu.org Tue Mar 20 13:08:00 2007 From: aph@gcc.gnu.org (Andrew Haley) Date: Tue, 20 Mar 2007 13:08:00 -0000 Subject: GCC cross from ia64 to hppa-hpux In-Reply-To: <18597F2B47F1394A9B309945EC724112D0B81E@servex01.wamas.com> References: <18597F2B47F1394A9B309945EC724112D0B81E@servex01.wamas.com> Message-ID: <17919.53505.131632.412590@zebedee.pink> Duft Markus writes: > Andrew Haley <> wrote: > > Duft Markus writes: > > > > > I'm currently looking into building a cross-compiler which runs on > > > ia64-hp-hpux11.23 and targets hppa2.0w-hp-hpux11.11. Has there been > > > anything like it? > > > > > > Currently i don't even get binutils built, so any help would be > > really > cool. > > > > Well, obviously you'll need a full set of target libraries and > > cross-target binutils. Beyond that, I'm, not aware of any special > > problems. Just configure and go. > > OK, i have the libraries, but is there a binutils how-to somewhere? I > built cross-binutils for solaris9, solaris10 and linux, but HP PA HP-UX > is somehow a problem..... *arg* Everything to do with cross-HPUX always seems to be a problem. :-) If you can't figure out how to get binutils built I think you'll just have to ask the binutils list. It's certainly way off-topic here. Good luck! Andrew. From Markus.Duft@salomon.at Tue Mar 20 14:06:00 2007 From: Markus.Duft@salomon.at (Duft Markus) Date: Tue, 20 Mar 2007 14:06:00 -0000 Subject: GCC cross from ia64 to hppa-hpux Message-ID: <18597F2B47F1394A9B309945EC724112D0B85C@servex01.wamas.com> Andrew Haley wrote: > Duft Markus writes: > > Andrew Haley <> wrote: > > > Duft Markus writes: > > > > > > > I'm currently looking into building a cross-compiler which > runs on > > > ia64-hp-hpux11.23 and targets hppa2.0w-hp-hpux11.11. > Has there been > > > anything like it? > > > > > > > > Currently i don't even get binutils built, so any help would > be > > really > cool. > > > > > > Well, obviously you'll need a full set of target libraries and > > > cross-target binutils. Beyond that, I'm, not aware of any > special > > problems. Just configure and go. > > > > OK, i have the libraries, but is there a binutils how-to > somewhere? I > built cross-binutils for solaris9, solaris10 and > linux, but HP PA HP-UX > is somehow a problem..... *arg* > > Everything to do with cross-HPUX always seems to be a problem. :-) > > If you can't figure out how to get binutils built I think you'll just > have to ask the binutils list. It's certainly way off-topic here. While waiting for the mailing-list subscription @ binutils i compiled them through ;o) just copied one header to my local sources, and it worked ... *arg* hack, hack... Now gcc allready bootstraps ;o) i hope things go fine, so thanks for the quick help / comment ... For anybody interested: just copy (from the target platform, so hppa-hpux) from /usr/include/machine/reg.h to the binutils source: $src/bfd/machine/reg.h. the set CFLAGS and CXXFLAGS to include -DHOST_HPPAHPUX and binutils build fine... I have no plan if they actually *work* too ;o// Cheers, Markus > > Good luck! > > Andrew. From ranjit_kumar_b4u@yahoo.co.uk Tue Mar 20 14:43:00 2007 From: ranjit_kumar_b4u@yahoo.co.uk (ranjith kumar) Date: Tue, 20 Mar 2007 14:43:00 -0000 Subject: version of gcc and auto-vectorization Message-ID: <20070320140613.70794.qmail@web27405.mail.ukl.yahoo.com> 1) In my P.C. gcc version 4.1.2 has been installed. I have a look at http://gcc.gnu.org/. In that it is said that 4.1.2 is the "current release series", "Next release series: GCC 4.2.0" and "Active development: GCC 4.3.0" What does it mean? Has gcc 4.2.0/4.3.0 been released??? If so from where can I download 4.2/4.3????? 2)From which version "auto-vectorization" has been included? In http://gcc.gnu.org/projects/tree-ssa/vectorization.html#status4.0 it is said that gcc 4.0 also does "auto-vectorization". Deos it mean auto-vectorization cababilities of gcc4.0 and gcc4.1/4.2 are same?? 3)-ftree-vectorize is the flag that enables autovectorization. isn't it?? 4) where can I get C programs for which gcc can do autovectorization and for which it cant? 4) I know all languages are internallay converted to same representation(in the context of gcc compiler). So what is said in gcc manuals about auto-vectorization is applicable to all languages gcc supports. Isn't it? Thanks in advance. ___________________________________________________________ New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at the Yahoo! Mail Championships. Plus: play games and win prizes. http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk From iant@google.com Tue Mar 20 17:46:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Tue, 20 Mar 2007 17:46:00 -0000 Subject: version of gcc and auto-vectorization In-Reply-To: <20070320140613.70794.qmail@web27405.mail.ukl.yahoo.com> References: <20070320140613.70794.qmail@web27405.mail.ukl.yahoo.com> Message-ID: ranjith kumar writes: > 1) In my P.C. gcc version 4.1.2 has been installed. > I have a look at http://gcc.gnu.org/. > In that it is said that 4.1.2 is the "current > release series", "Next release series: GCC 4.2.0" and > "Active development: GCC 4.3.0" > > What does it mean? Has gcc 4.2.0/4.3.0 been > released??? No. It means that 4.2 is the next release. 4.3 is under active development. > > 2)From which version "auto-vectorization" has been > included? > In > http://gcc.gnu.org/projects/tree-ssa/vectorization.html#status4.0 > it is said that gcc 4.0 also does > "auto-vectorization". > Deos it mean auto-vectorization cababilities of gcc4.0 > and gcc4.1/4.2 are same?? No, it is under active development and is enhanced in each release. > 3)-ftree-vectorize is the flag that enables > autovectorization. isn't it?? Yes. > 4) where can I get C programs for which gcc can do > autovectorization and for which it cant? There are test cases in gcc/testsuite/gcc.dg/vect. > 4) I know all languages are internallay converted to > same representation(in the context of gcc compiler). > So what is said in gcc manuals about > auto-vectorization is applicable to all languages gcc > supports. Isn't it? Yes. But some languages are more amenable to vectorization than others. Ian From ranjit_kumar_b4u@yahoo.co.uk Tue Mar 20 18:54:00 2007 From: ranjit_kumar_b4u@yahoo.co.uk (ranjith kumar) Date: Tue, 20 Mar 2007 18:54:00 -0000 Subject: version of gcc and auto-vectorization In-Reply-To: Message-ID: <20070320174615.21590.qmail@web27401.mail.ukl.yahoo.com> --- Ian Lance Taylor wrote: > ranjith kumar writes: > > > 1) In my P.C. gcc version 4.1.2 has been > installed. > > I have a look at http://gcc.gnu.org/. > > In that it is said that 4.1.2 is the "current > > release series", "Next release series: GCC 4.2.0" > and > > "Active development: GCC 4.3.0" > > > > What does it mean? Has gcc 4.2.0/4.3.0 been > > released??? > > No. It means that 4.2 is the next release. 4.3 is > under active > development. > > > > 2)From which version "auto-vectorization" has been > > included? > > In > > > http://gcc.gnu.org/projects/tree-ssa/vectorization.html#status4.0 > > it is said that gcc 4.0 also does > > "auto-vectorization". > > Deos it mean auto-vectorization cababilities of > gcc4.0 > > and gcc4.1/4.2 are same?? > > No, it is under active development and is enhanced > in each release. > > > 3)-ftree-vectorize is the flag that enables > > autovectorization. isn't it?? > > Yes. > > > 4) where can I get C programs for which gcc can do > > autovectorization and for which it cant? > > There are test cases in gcc/testsuite/gcc.dg/vect. What does auto-vectorization mean?? I think it must be converting 'for' loops which does not exploit SIMD features of a processor(say Pentium 4) to 'for' loops which exploit SIMD features(of course, it could be at any intermediate representation). I have taken vect-40.c in that directory and compiled as "gcc -march=pentium4 -S -O3 -ftree-vectorize vect-40.c". I looked at the assembly code. No MMX/SSE/SSE2 instructions were there. (I have gcc-4.1.2 installed in my P.C. and my processor is Pentium4.) What can gcc do? Can it produce MMX/SSE/SSE2 instructions even if the source file(.c) does not use any functions defined in mmintrin.h/xmmintrin.h/emmintrin.h???? If so, did I miss any other option while compiling? Thanks in advance. > > > 4) I know all languages are internallay converted > to > > same representation(in the context of gcc > compiler). > > So what is said in gcc manuals about > > auto-vectorization is applicable to all languages > gcc > > supports. Isn't it? > > Yes. But some languages are more amenable to > vectorization than > others. > > Ian > ___________________________________________________________ Now you can scan emails quickly with a reading pane. Get the new Yahoo! Mail. http://uk.docs.yahoo.com/nowyoucan.html From feradz@gmail.com Tue Mar 20 19:37:00 2007 From: feradz@gmail.com (Ferad Zyulkyarov) Date: Tue, 20 Mar 2007 19:37:00 -0000 Subject: The g++ -fconserve-space flag Message-ID: Hi, I want to port an application written in C into C++. When compiling the code with the C compiler (gcc) some of the variables are compiled as common symbols that the linker treats without problems. But when I compile the code with g++ these common symbols are put in BSS section and at link time, the linker reports for multiple definitions of the same variable in different object files. Before writing here, I looked for some solution and as I understand the -fconserve-space flag is supposed to solve my problem. There is another posting in the mail grup that relates to -fconserve-space flag that it doesn't have any effect (http://gcc.gnu.org/ml/gcc-help/2004-08/threads.html#00008). The suggested solutions are to define the variables that cause the problem as either static or extern. Static definition changes the logic/semantics of the application, whereas the extern declaration will involve a lot of code refactoring :( I would welcome all the comments that would save me the huge burden of code rewriting. Thanks, Ferad -- Ferad Zyulkyarov Barcelona Supercomputing Center From iant@google.com Tue Mar 20 20:15:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Tue, 20 Mar 2007 20:15:00 -0000 Subject: version of gcc and auto-vectorization In-Reply-To: <20070320174615.21590.qmail@web27401.mail.ukl.yahoo.com> References: <20070320174615.21590.qmail@web27401.mail.ukl.yahoo.com> Message-ID: ranjith kumar writes: > What does auto-vectorization mean?? > I think it must be converting 'for' loops which does > not exploit SIMD features of a processor(say Pentium > 4) to 'for' loops which exploit SIMD features(of > course, it could be at any intermediate > representation). Yes, that is what it means. > I have taken vect-40.c in that directory and compiled > as "gcc -march=pentium4 -S -O3 -ftree-vectorize > vect-40.c". I looked at the assembly code. No > MMX/SSE/SSE2 instructions were there. > (I have gcc-4.1.2 installed in my P.C. and my > processor is Pentium4.) > > What can gcc do? Can it produce MMX/SSE/SSE2 > instructions even if the source file(.c) does not use > any functions defined in > mmintrin.h/xmmintrin.h/emmintrin.h???? Yes, it can. Here is an example which vectorizes for me with gcc 4.1.2 with -O2 -ftree-vectorize -std=c99 -march=pentium4 void foo (int n, int * restrict c, const int * restrict a, const int * restrict b) { int i; for (i = 0; i < n; ++i) c[i] = a[i] + b[i]; } Ian From eljay@adobe.com Tue Mar 20 21:05:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Tue, 20 Mar 2007 21:05:00 -0000 Subject: The g++ -fconserve-space flag In-Reply-To: Message-ID: Hi Ferad, Sounds like you have header files that are defining symbols, when what you want is for the header files to declare them (not define them). Take a look at Stroustrup's C++ Programming Language (special edition, or third edition) section B.2.2 "C Code That Is Not C++". This is valid C, but not valid C++: int foo; int foo; In C, only one foo is defined. In C++, the second foo causes an error in the translation unit. (And if the int foo is in different translation units, it causes an error at link time. Violation of ODR.) In C++, you may need to do this in your header files: extern int foo; // Declaration, not a definition. HTH, --Eljay From feradz@gmail.com Wed Mar 21 04:14:00 2007 From: feradz@gmail.com (Ferad Zyulkyarov) Date: Wed, 21 Mar 2007 04:14:00 -0000 Subject: The g++ -fconserve-space flag In-Reply-To: References: Message-ID: Thanks John, Your answer helped me to understand what the actual problem is. On 3/20/07, John Love-Jensen wrote: > Hi Ferad, > > Sounds like you have header files that are defining symbols, when what you > want is for the header files to declare them (not define them). > > Take a look at Stroustrup's C++ Programming Language (special edition, or > third edition) section B.2.2 "C Code That Is Not C++". > > This is valid C, but not valid C++: > int foo; > int foo; > > In C, only one foo is defined. > > In C++, the second foo causes an error in the translation unit. (And if the > int foo is in different translation units, it causes an error at link time. > Violation of ODR.) > > In C++, you may need to do this in your header files: > > extern int foo; // Declaration, not a definition. > > HTH, > --Eljay > > -- Ferad Zyulkyarov Barcelona Supercomputing Center From olecom@flower.upol.cz Wed Mar 21 06:57:00 2007 From: olecom@flower.upol.cz (Oleg Verych) Date: Wed, 21 Mar 2007 06:57:00 -0000 Subject: Optimisation puzzle In-Reply-To: <45FA852C.1090904@home.se> References: <45FA852C.1090904@home.se> Message-ID: > From: Erik > Newsgroups: gmane.comp.gcc.help > Subject: Re: Optimisation puzzle > Date: Fri, 16 Mar 2007 12:53:16 +0100 [] > I tried with the following program: void q(const unsigned int); void > f() {for (unsigned int x = 0; x != 10; x++) q(77);} > > and built it with "gcc -std=c99 -Os -Wall -Wextra -Werror -S": > .L2: > subl $12, %esp > incl %ebx > pushl $77 > call q > addl $16, %esp > cmpl $10, %ebx > jne .L2 > > As you can see, "pushl $77" is still inside the loop even though q > promises to not change its argument. This must be a bug. Maybe this somehow linked to the fact, that parameter by value are always copied and there's no way for caller to know about what happened to that *copy*. E.g. "void q(const unsigned int b);" means b is read-only inside q, but any caller sets up b for q, i.e it create/change it. Anyways this can be optimized. And i think, gdb will be ok with such code. That isn't working program, you've tested, is it? I tried working one, but it was little bit hard to get non-unrolled loop. See even one more instruction, that seems to be useless, unless it somehow speeds-up register access (or any other CPU's magic). Of course things are completely different with q being static. AMD64 code: ..globl q .type q, @function q: _mtune=k8_ q: _mtune=nocona_ ..LFB2: .LFB2: mov %edi, %edi *NOTE* movsd a(%rip), %xmm1 movlpd a(%rip), %xmm1 mov %edi, %edi *NOTE* cvtsi2sdq %rdi, %xmm0 cvtsi2sdq %rdi, %xmm0 sqrtsd %xmm0, %xmm0 sqrtsd %xmm0, %xmm0 addsd %xmm0, %xmm1 addsd %xmm0, %xmm1 movsd %xmm1, a(%rip) movsd %xmm1, a(%rip) ret ret ..LFE2: .LFE2: .size q, .-q ..globl f .type f, @function f: ..LFB3: pushq %rbx ..LCFI0: movl %edi, %ebx ..L7: movl $77, %edi movl $77, %edi .L7_OPERFORMANCE: call q call q decl %ebx decl %ebx jne .L7 jne .L7_OPERFORMANCE popq %rbx ret ..LFE3: .size f, .-f Code is: #include static double a; void q(const unsigned int b) { a += sqrt(b); } void f(int c) { do { q(77); } while (--c); } int main(int argc, char *argv[]) { f(argc); return 0; } Kind regards. _____ From wesley.hoke@gmail.com Wed Mar 21 07:26:00 2007 From: wesley.hoke@gmail.com (Wesley Smith) Date: Wed, 21 Mar 2007 07:26:00 -0000 Subject: Function overloading Message-ID: <1079b050703202357v2d72149fl3c03c305995202bf@mail.gmail.com> I have a question about function overloading. I'm getting alot of errors when I do the following class A { void draw(); }; class B : public A { static int draw(lua_State *L); static B * get(lua_State *L, int i); } //bad int B :: draw(lua_State *L) { B *b = get(L, 1); b->draw() //<--- produces error because it things I'm calling the static B function } //good int B :: draw(lua_State *L) { B *b = get(L, 1); b->A::draw() //<--- no errors } Shouldn't the compiler understand that I'm actually calling the superclass' draw method, especially since the class' draw method is static and I'm calling it as an instance method? thanks, wes From wesley.hoke@gmail.com Wed Mar 21 10:38:00 2007 From: wesley.hoke@gmail.com (Wesley Smith) Date: Wed, 21 Mar 2007 10:38:00 -0000 Subject: Function overloading In-Reply-To: <32380a010703210019o70bfe7d4ge45ced3c3838f412@mail.gmail.com> References: <1079b050703202357v2d72149fl3c03c305995202bf@mail.gmail.com> <32380a010703210019o70bfe7d4ge45ced3c3838f412@mail.gmail.com> Message-ID: <1079b050703210026x25d2ebeehb09fd4c9c047c806@mail.gmail.com> Wow that really clarifies things. Is there an URL for this documentation? Many thanks, wes On 3/21/07, Vadim Doroginin wrote: > On 3/21/07, Wesley Smith wrote: > > I have a question about function overloading. I'm getting alot of > > errors when I do the following > > > > class A > > { > > void draw(); > > }; > > > > > > class B : public A > > { > > static int draw(lua_State *L); > > static B * get(lua_State *L, int i); > > } > > > > //bad > > int B :: draw(lua_State *L) > > { > > B *b = get(L, 1); > > b->draw() //<--- produces error because it things I'm calling > > the static B function > > } > > > > > > //good > > int B :: draw(lua_State *L) > > { > > B *b = get(L, 1); > > b->A::draw() //<--- no errors > > } > > > > > > > > Shouldn't the compiler understand that I'm actually calling the > > superclass' draw method, especially since the class' draw method is > > static and I'm calling it as an instance method? > > > > thanks, > > wes > > > > No. > IS 13.1 says: > Certain function declarations cannot be overloaded: > ? Function declarations that differ only in the return type cannot be > overloaded. > ? Member function declarations with the same name and the same > parameter types cannot be overloaded if any of them is a static member > function declaration (9.4). Likewise, member function template > declarations with the same name, the same parameter types, and the > same template parameter lists cannot be overloaded if any of them is a > static member function template declaration. The types of the implicit > object parameters constructed for the member functions for the purpose > of overload resolution (13.3.1) are not considered when comparing > parameter types for enforcement of this rule. In contrast, if there is > no static member function declaration among a set of member function > declarations with the same name and the same parameter types, then > these member function declarations can be overloaded if they differ in > the type of their implicit object parameter. [Example: the following > illustrates this distinction: > class X { > static void f(); > void f(); // ill-formed > void f() const; // ill-formed > void f() const volatile; // ill-formed > void g(); > void g() const; // OK: no static g > void g() const volatile; // OK: no static g > }; > ?end example] > From aph@redhat.com Wed Mar 21 11:57:00 2007 From: aph@redhat.com (Andrew Haley) Date: Wed, 21 Mar 2007 11:57:00 -0000 Subject: Function overloading In-Reply-To: <1079b050703210026x25d2ebeehb09fd4c9c047c806@mail.gmail.com> References: <1079b050703202357v2d72149fl3c03c305995202bf@mail.gmail.com> <32380a010703210019o70bfe7d4ge45ced3c3838f412@mail.gmail.com> <1079b050703210026x25d2ebeehb09fd4c9c047c806@mail.gmail.com> Message-ID: <17921.2818.33778.386620@zebedee.pink> Wesley Smith writes: > Wow that really clarifies things. Is there an URL for this > documentation? http://www.open-std.org/jtc1/sc22/wg21/ Andrew. From s.kruizinga@hccnet.nl Wed Mar 21 12:21:00 2007 From: s.kruizinga@hccnet.nl (Seijo Kruizinga) Date: Wed, 21 Mar 2007 12:21:00 -0000 Subject: gfortran Message-ID: <001301c76bb0$1f002db0$0100000a@kruizinga> L.S. I recently downloaded the latest version of gfortran (4.3.0). In general it works very well. I met, however, a curious problem. When I tried to open a file twice with different unit-numbers I got an error message during running. (I try to read the files synchron with a records spacing). In f77 this was allowed. I can imagine some problems if you use then read/write. But even with status'='OLD' it was refused. I use it under Suse 10.0. Thanks for your help, Seijo Kruizinga From r.atwood@imperial.ac.uk Wed Mar 21 12:26:00 2007 From: r.atwood@imperial.ac.uk (Atwood, Robert C) Date: Wed, 21 Mar 2007 12:26:00 -0000 Subject: Function overloading In-Reply-To: <1079b050703210026x25d2ebeehb09fd4c9c047c806@mail.gmail.com> Message-ID: <2CB39EAF0E0EFF498ADEDA636B8C999F04C39621@icex1.ic.ac.uk> That does not make sense to me, in the original example the function is not what I would call 'overloaded', as I understand a function in a derived class is not in the same scope as a function in a base class, so a function with the same name _hides_ the function from the base class rather than overloading it, resulting in the behaviour observed by the original poster. I don't see how the prohibition of overloading a static function with the same parameter types applies to hiding a function with _different_ parameter types? Happy to be corrected if I'm wrong, Robert > -----Original Message----- > From: gcc-help-owner@gcc.gnu.org > [mailto:gcc-help-owner@gcc.gnu.org] On Behalf Of Wesley Smith > Sent: 21 March 2007 07:26 > To: gcc-help@gcc.gnu.org > Subject: Re: Function overloading > > Wow that really clarifies things. Is there an URL for this > documentation? > Many thanks, > wes > > On 3/21/07, Vadim Doroginin wrote: > > On 3/21/07, Wesley Smith wrote: > > > I have a question about function overloading. I'm getting alot of > > > errors when I do the following > > > > > > class A > > > { > > > void draw(); > > > }; > > > > > > > > > class B : public A > > > { > > > static int draw(lua_State *L); > > > static B * get(lua_State *L, int i); > > > } > > > > > > //bad > > > int B :: draw(lua_State *L) > > > { > > > B *b = get(L, 1); > > > b->draw() //<--- produces error because it things > I'm calling > > > the static B function > > > } > > > > > > > > > //good > > > int B :: draw(lua_State *L) > > > { > > > B *b = get(L, 1); > > > b->A::draw() //<--- no errors > > > } > > > > > > > > > > > > Shouldn't the compiler understand that I'm actually calling the > > > superclass' draw method, especially since the class' draw > method is > > > static and I'm calling it as an instance method? > > > > > > thanks, > > > wes > > > > > > > No. > > IS 13.1 says: > > Certain function declarations cannot be overloaded: > > - Function declarations that differ only in the return type > cannot be > > overloaded. > > - Member function declarations with the same name and the same > > parameter types cannot be overloaded if any of them is a > static member > > function declaration (9.4). Likewise, member function template > > declarations with the same name, the same parameter types, and the > > same template parameter lists cannot be overloaded if any > of them is a > > static member function template declaration. The types of > the implicit > > object parameters constructed for the member functions for > the purpose > > of overload resolution (13.3.1) are not considered when comparing > > parameter types for enforcement of this rule. In contrast, > if there is > > no static member function declaration among a set of member function > > declarations with the same name and the same parameter types, then > > these member function declarations can be overloaded if > they differ in > > the type of their implicit object parameter. [Example: the following > > illustrates this distinction: > > class X { > > static void f(); > > void f(); // ill-formed > > void f() const; // ill-formed > > void f() const volatile; // ill-formed > > void g(); > > void g() const; // OK: no static g > > void g() const volatile; // OK: no static g > > }; > > -end example] > > > From f.p.boomstra@gmail.com Wed Mar 21 12:35:00 2007 From: f.p.boomstra@gmail.com (Feike Boomstra) Date: Wed, 21 Mar 2007 12:35:00 -0000 Subject: _bit_scan_forward Message-ID: <8d55a8b20703210526g2a449f38g7eec3314bf10fe79@mail.gmail.com> I am new to Linux, I am using Kubuntu (AMD64) with KDevelop. I try to migrate a VC++ project to Linux. I am having problems with the built-in function _Bit_scan_forward. 1) I can't find a headerfile defining this function. 2) If I define it myself, I get a link error: unresolved reference please help Feike Boomstra From Thimo.Neubauer@cst.com Wed Mar 21 13:59:00 2007 From: Thimo.Neubauer@cst.com (Thimo.Neubauer@cst.com) Date: Wed, 21 Mar 2007 13:59:00 -0000 Subject: How do I deprecate a class? Message-ID: <4EC819A95B.05783D5CTFSNAUJM@cst.com> Hi! I'd like to mark a class as deprecated, i.e. any instantiation or method call should be warned. After reading http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Type-Attributes.html#Type-Attributes I concluded that class Foo { public: void bar(int x); } __attribute__ ((deprecated)); should do the trick. However int main() { Foo f; return 0; }; only warns about the (obviously) unused variable but nothing else: beachboys++ /tmp> make g++ -Wall foo.cc -o foo foo.cc: In function ?int main()?: foo.cc:11: warning: unused variable ?f? beachboys++ /tmp> g++ --version g++ (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Same effect with gcc 3.3 and 3.4. However a typedef Foo Quux __attribute__ ((deprecated)); with int main() { Quux f; return 0; }; does what I expected: foo.cc: In function `int main()': foo.cc:11: warning: `Quux' is deprecated (declared at foo.cc:8) foo.cc:11: warning: unused variable `Quux f' Did I understand anything wrong? Or is this a bug/feature? :-) Please CC me on reply, I'm not subscribed to gcc-help. Cheers Thimo From segher@kernel.crashing.org Wed Mar 21 14:30:00 2007 From: segher@kernel.crashing.org (Segher Boessenkool) Date: Wed, 21 Mar 2007 14:30:00 -0000 Subject: version of gcc and auto-vectorization In-Reply-To: <20070320174615.21590.qmail@web27401.mail.ukl.yahoo.com> References: <20070320174615.21590.qmail@web27401.mail.ukl.yahoo.com> Message-ID: > What does auto-vectorization mean?? > I think it must be converting 'for' loops which does > not exploit SIMD features of a processor(say Pentium > 4) to 'for' loops which exploit SIMD features(of > course, it could be at any intermediate > representation). While (indexed) loops are the most obvious case, auto vectorisation actually applies to *any* code. Loops are easier to do than generic code, and you get a better gain from them, so that's where all the action is ;-) Segher From iant@google.com Wed Mar 21 14:38:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Wed, 21 Mar 2007 14:38:00 -0000 Subject: _bit_scan_forward In-Reply-To: <8d55a8b20703210526g2a449f38g7eec3314bf10fe79@mail.gmail.com> References: <8d55a8b20703210526g2a449f38g7eec3314bf10fe79@mail.gmail.com> Message-ID: "Feike Boomstra" writes: > I am new to Linux, I am using Kubuntu (AMD64) with KDevelop. I try to > migrate a VC++ project to Linux. I am having problems with the > built-in function _Bit_scan_forward. > > 1) I can't find a headerfile defining this function. > 2) If I define it myself, I get a link error: unresolved reference If that function does what I think it does, then the Unix equivalent would be ffs. If that is the right answer, then this is not a gcc question, it is a Windows to Unix porting question. This is probably not the best mailing list to ask such questions, as we are unlikely to know the answer. Ian From iant@google.com Wed Mar 21 15:34:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Wed, 21 Mar 2007 15:34:00 -0000 Subject: How do I deprecate a class? In-Reply-To: <4EC819A95B.05783D5CTFSNAUJM@cst.com> References: <4EC819A95B.05783D5CTFSNAUJM@cst.com> Message-ID: Thimo.Neubauer@cst.com writes: > I concluded that > > class Foo { > public: > void bar(int x); > } __attribute__ ((deprecated)); > > should do the trick. However > > int main() { > Foo f; > > return 0; > }; > > only warns about the (obviously) unused variable but nothing else: Looks like a bug to me. And it's been filed already: http://gcc.gnu.org/PR16370 Interestingly, I do get a warning for this: struct Foo { int i; } __attribute__ ((deprecated)); void foo() { struct Foo f; } It matters whether I use "struct" or not. Which is bizarre. Ian From loudons@hotmail.com Wed Mar 21 17:53:00 2007 From: loudons@hotmail.com (steve_loudon) Date: Wed, 21 Mar 2007 17:53:00 -0000 Subject: Trouble Compiling GCC Message-ID: <9596458.post@talk.nabble.com> I am trying to recreate the binaries for a arm cross compiler (gcc-3.2.3) that I have on another machine. I am currently running Ubuntu 6.10 with the latest stable version of gcc installed (gcc-4.1.2). I have not built gcc before, so I thought that the easiest thing to do first is to just recompile version 4.1.2. I got the source, ran configure and make. It ended in error. I used the following configure options: ../src/gcc-4.1.2/configure --prefix=/home/loudon --disable-werror --enable-languages=c and the make bootstrap command ended with the following error: /home/loudon/gcc-build/./gcc/xgcc -B/home/loudon/gcc-build/./gcc/ -B/home/loudon/i686-pc-linux-gnu/bin/ -B/home/loudon/i686-pc-linux-gnu/lib/ -isystem /home/loudon/i686-pc-linux-gnu/include -isystem /home/loudon/i686-pc-linux-gnu/sys-include -O2 -O2 -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -I. -I. -I../../src/gcc-4.1.2/gcc -I../../src/gcc-4.1.2/gcc/. -I../../src/gcc-4.1.2/gcc/../include -I../../src/gcc-4.1.2/gcc/../libcpp/include -fexceptions -fvisibility=hidden -DHIDE_EXPORTS -c ../../src/gcc-4.1.2/gcc/unwind-dw2.c -o libgcc/./unwind-dw2.o In file included from ../../src/gcc-4.1.2/gcc/unwind-dw2.c:256: ../../src/gcc-4.1.2/gcc/config/i386/linux-unwind.h: In function ?x86_fallback_frame_state?: ../../src/gcc-4.1.2/gcc/config/i386/linux-unwind.h:152: error: ?struct sigcontext? has no member named ?esp? ../../src/gcc-4.1.2/gcc/config/i386/linux-unwind.h:159: error: ?struct sigcontext? has no member named ?eax? ../../src/gcc-4.1.2/gcc/config/i386/linux-unwind.h:161: error: ?struct sigcontext? has no member named ?ebx? ../../src/gcc-4.1.2/gcc/config/i386/linux-unwind.h:163: error: ?struct sigcontext? has no member named ?ecx? ../../src/gcc-4.1.2/gcc/config/i386/linux-unwind.h:165: error: ?struct sigcontext? has no member named ?edx? ../../src/gcc-4.1.2/gcc/config/i386/linux-unwind.h:167: error: ?struct sigcontext? has no member named ?esi? ../../src/gcc-4.1.2/gcc/config/i386/linux-unwind.h:169: error: ?struct sigcontext? has no member named ?edi? ../../src/gcc-4.1.2/gcc/config/i386/linux-unwind.h:171: error: ?struct sigcontext? has no member named ?ebp? ../../src/gcc-4.1.2/gcc/config/i386/linux-unwind.h:173: error: ?struct sigcontext? has no member named ?eip? make[4]: *** [libgcc/./unwind-dw2.o] Error 1 make[4]: Leaving directory `/home/loudon/gcc-build/gcc' make[3]: *** [libgcc.a] Error 2 make[3]: Leaving directory `/home/loudon/gcc-build/gcc' make[2]: *** [all-stage1-gcc] Error 2 make[2]: Leaving directory `/home/loudon/gcc-build' make[1]: *** [stage1-bubble] Error 2 make[1]: Leaving directory `/home/loudon/gcc-build' make: *** [all] Error 2 Don't know where to go from here. When I looked through the .h files that should have defined sigcontext, the structure members should be defined. Thanks for any suggestions, Steve -- View this message in context: http://www.nabble.com/Trouble-Compiling-GCC-tf3441530.html#a9596458 Sent from the gcc - Help mailing list archive at Nabble.com. From essu_n21@yahoo.co.in Wed Mar 21 18:16:00 2007 From: essu_n21@yahoo.co.in (Eswari Natrajan) Date: Wed, 21 Mar 2007 18:16:00 -0000 Subject: how to execute c script file Message-ID: <277087.69264.qm@web8914.mail.in.yahoo.com> Hi, I am using Linux and installed GCC in my PC. I want to compile C script file. Can u tell me steps to execute? Thanking you __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/ From stangmechanic@gmail.com Wed Mar 21 18:44:00 2007 From: stangmechanic@gmail.com (Blake Huff) Date: Wed, 21 Mar 2007 18:44:00 -0000 Subject: Nested functions with GCC in OS X Message-ID: <48C6BF09-DF77-44E3-AC85-A19A6ABCEF3E@gmail.com> Hi All: Hopefully this is the right list for this question. Does anyone have any experience building nested functions into dynamically linked library files (.so) on Mac OS X 10.4.9, with gcc 4.0.1. I am confused on several points by this. Here's an example of the problem with the associated errors: gcc -dynamiclib calc_mean.c -o libmean.so -fnested-functions /usr/bin/libtool: unknown option character `l' in: -allow_stack_execute Usage: /usr/bin/libtool -static [-] file [...] [-filelist listfile [,dirname]] [-arch_only arch] [-sacLT] Usage: /usr/bin/libtool -dynamic [-] file [...] [-filelist listfile [,dirname]] [-arch_only arch] [-o output] [-install_name name] [- compatibility_version #] [-current_version #] [-seg1addr 0x#] [- segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table ] [-seg_addr_table_filename ] [-all_load] [-noall_load] Obviously libtool doesn't know what -allow_stack_execute is because - allow_stack_execute is an option for ld, not libtool. Any ideas how to get the right flag from the compiler to ld? In another project with nested functions, the '-fnested-functions' is never specified during the compile process, yet at runtime the program fails with an error message: /usr/bin/ld: -allow_stack_execute can only be used when output file type is MH_EXECUTE collect2: ld returned 1 exit status This is unusual, because neither '-fnested-functions' nor '- allow_stack_execute' were specified. I'm assuming that ld is sensing the need for an executable stack, and producing an error because their isn't one. This error seems to indicate to me that you cannot have nested functions inside a dynamically linked library, as such a library will never have the type of MH_EXECUTE. Does anyone have any experience with nested functions, ideas about what's going on? Thanks in advance for any suggestions. "Hats and mittens you kittens!" Blake Huff stangmechanic@gmail.com From eljay@adobe.com Wed Mar 21 21:41:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Wed, 21 Mar 2007 21:41:00 -0000 Subject: how to execute c script file In-Reply-To: <277087.69264.qm@web8914.mail.in.yahoo.com> Message-ID: Hi Eswari, Assuming your C source code is called Foo.c and you want the executable to be called Foo, you'd do this: gcc -o Foo Foo.c To run the program Foo, you'd do this from the directory it was compile/linked in: ./Foo HTH, --Eljay From karel.miklav@siol.net Thu Mar 22 03:15:00 2007 From: karel.miklav@siol.net (Karel Miklav) Date: Thu, 22 Mar 2007 03:15:00 -0000 Subject: Minimizing a bootstrap compiler Message-ID: <4601A68F.1050406@siol.net> I've made a bootstrap compiler for GNAT-GCC Ada compiler from GCC 4.1. The resulting package is around 11 Mb. I tried to cut some Mb's off, by extracting files not used during bootstrap. The result of this shaky method gave a package of 8 Mb. Is there another way I can strip something off? -- Regards, Karel miklav From bdavis9659@sbcglobal.net Thu Mar 22 10:01:00 2007 From: bdavis9659@sbcglobal.net (Bud Davis) Date: Thu, 22 Mar 2007 10:01:00 -0000 Subject: gfortran In-Reply-To: <001301c76bb0$1f002db0$0100000a@kruizinga> Message-ID: <162234.69774.qm@web81213.mail.mud.yahoo.com> --- Seijo Kruizinga wrote: > L.S. > > I recently downloaded the latest version of gfortran > (4.3.0). In general it > works very well. I met, however, a curious problem. > When I tried to open a > file twice with different unit-numbers I got an > error message during > running. (I try to read the files synchron with a > records spacing). In f77 > this was allowed. I can imagine some problems if you > use then read/write. > But even with status'='OLD' it was refused. I use it > under Suse 10.0. > > Thanks for your help, > > Seijo Kruizinga > > is this an example of your problem: $ cat b.f open(unit=20,file='b.f') open(unit=30,file='b.f') print*,'ok' end $ g77 b.f $ ./a.out ok $ gfortran -static b.f $ ./a.out At line 2 of file b.f Fortran runtime error: File already opened in another unit --bud From brendon@christian.net Thu Mar 22 11:22:00 2007 From: brendon@christian.net (Brendon Costa) Date: Thu, 22 Mar 2007 11:22:00 -0000 Subject: Two versions of GCC Message-ID: <460253D0.3050205@christian.net> Hi All, I have installed on my system two different versions of GCC. I am finding that while compiling + linking an autotools based example project using the "new" GCC version, it seems to compile using the headers for libstdc++ (new version) but tries to link with the libstdc++ (old version). See end for example linker command line that looks correct to me... The two versions of GCC are: One that comes with NetBSD: Version: 3.3.3 Prefix: /usr And one i have been modifying as part of a C++ exception source analysis tool i am writing: Version: 4.0.1 (patched with my modifications) Prefix: /home/bcosta/build/install/edoc_gcc Now the problem i have is that i get undefined symbols while linking when i compile trying to use the modified GCC. The undefined symbols belong to libstdc++ and exist in the 4.0.1 GCC version of libstdc++ but those symbols do NOT exist in the 3.3.3 GCC version of libstdc++ So for some reason i assume it is linking using the /usr/lib/libstdc++.so file instead of the /home/bcosta/build/install/edoc_gcc/lib/libstdc++.so In order to setup my environment to use the modified GCC (4.0.1) i do the following: export LD_LIBRARY_PATH="/home/bcosta/build/install/edoc_gcc/lib:$LD_LIBRARY_PATH" export PATH="/home/bcosta/build/install/edoc_gcc/bin:$PATH" Is there something else i should be doing in order to set my build environment to use the new GCC version (without un-installing the old one)? Thanks, Brendon. The link errors i get look like: rm -f .libs/library_user.nm .libs/library_user.nmS .libs/library_user.nmT creating .libs/library_userS.c extracting global C symbols from `../../../src/plugins/myplugin/.libs/myplugin.a' extracting global C symbols from `/home/bcosta/build/example/src/libs/mystatic/.libs/libmystatic.a' extracting global C symbols from `/home/bcosta/build/install/edoc_gcc/lib/libstdc++.a' (cd .libs && gcc -c -fno-builtin "library_userS.c") rm -f .libs/library_userS.c .libs/library_user.nm .libs/library_user.nmS .libs/library_user.nmT g++ -g -O2 -o .libs/library_user library_user-main.o .libs/library_userS.o -L/home/bcosta/build/edoc/gcc-4.0.1/i386-unknown-netbsdelf3.0/libstdc++-v3/src -L/home/bcosta/build/edoc/gcc-4.0.1/i386-unknown-netbsdelf3.0/libstdc++-v3/src/.libs -L/home/bcosta/build/edoc/gcc-4.0.1/gcc ../../../src/plugins/myplugin/.libs/myplugin.a /home/bcosta/build/example/src/libs/mystatic/.libs/libmystatic.a -lm ../../../src/libs/myshared/.libs/libmyshared.so ../../../src/libs/mystatic/.libs/libmystatic.a /home/bcosta/build/install/edoc_gcc/lib/libstdc++.so ../../../libltdl/.libs/libltdlc.a -Wl,--rpath -Wl,/home/bcosta/build/install_example/lib -Wl,--rpath -Wl,/home/bcosta/build/install/edoc_gcc/lib .libs/library_userS.o(.rodata+0x8414): undefined reference to `__gnu_internal::palloc_init_mutex' .libs/library_userS.o(.rodata+0x841c): undefined reference to `__gnu_cxx::__pool_alloc_base::_S_end_free' .libs/library_userS.o(.rodata+0x842c): undefined reference to `__gnu_cxx::__pool_alloc_base::_S_free_list' .libs/library_userS.o(.rodata+0x8434): undefined reference to `__gnu_cxx::__pool_alloc_base::_S_heap_size' .libs/library_userS.o(.rodata+0x843c): undefined reference to `__gnu_cxx::__pool_alloc_base::_S_start_free' .libs/library_userS.o(.rodata+0x844c): undefined reference to `__gnu_cxx::__pool_alloc_base::_M_allocate_chunk(unsigned int, int&)' ... From sumit.jain@nokia.com Thu Mar 22 11:32:00 2007 From: sumit.jain@nokia.com (sumit.jain@nokia.com) Date: Thu, 22 Mar 2007 11:32:00 -0000 Subject: Help with gcc Message-ID: <12C8F1FF38CEC643BCFF624810AB986F4E00AB@siebe101.NOE.Nokia.com> Hi, I have some query regarding the way gcc resolves the search directory for standard libraries like libc. When I run command "gcc -v test.c" i get the following output Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux Thread model: posix gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/cc1 -lang-c -v -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=2 -D__GXX_ABI_VERSION=102 -D__ELF__ -Dunix -D__gnu_linux__ -Dlinux -D__ELF__ -D__unix__ -D__gnu_linux__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i386__ test.c -quiet -dumpbase test.c -version -o /tmp/ccAc9Ljz.s GNU CPP version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) (cpplib) (i386 Linux/ELF) GNU C version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) (i386-redhat-linux) compiled by GNU C version 3.2.2 20030222 (Red Hat Linux 3.2.2-5). ignoring nonexistent directory "/usr/i386-redhat-linux/include" #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include /usr/include End of search list. as -V -Qy -o /tmp/cc8Ge9kX.o /tmp/ccAc9Ljz.s GNU assembler version 2.13.90.0.18 (i386-redhat-linux) using BFD version 2.13.90.0.18 20030206 /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/collect2 --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../crt1.o /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../crti.o /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/crtbegin.o -L/usr/lib/gcc-lib/i386-redhat-linux/3.2.2 -L/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../.. /tmp/cc8Ge9kX.o -lgcc -lgcc_eh -lc -lgcc -lgcc_eh /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/crtend.o /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../crtn.o As the last section of the output illustrated that the location that the linker looks for libraries like libc etc is "-L/usr/lib/gcc-lib/i386-redhat-linux/3.2.2" and "-L/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../.." Is there anyway i can change the default search location. I believe that by passing my own spec file to gcc as gcc -specs= test.c, i can change the default include path and also the path to look for for crt0.o etc. Regards, Sumit Kumar Jain From aph@redhat.com Thu Mar 22 12:05:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 22 Mar 2007 12:05:00 -0000 Subject: Help with gcc In-Reply-To: <12C8F1FF38CEC643BCFF624810AB986F4E00AB@siebe101.NOE.Nokia.com> References: <12C8F1FF38CEC643BCFF624810AB986F4E00AB@siebe101.NOE.Nokia.com> Message-ID: <17922.26802.216433.101943@zebedee.pink> sumit.jain@nokia.com writes: > > I have some query regarding the way gcc resolves the search directory > for standard libraries like libc. When I run command "gcc -v test.c" i > get the following output > As the last section of the output illustrated that the location that the > linker looks for libraries like libc etc is > "-L/usr/lib/gcc-lib/i386-redhat-linux/3.2.2" and > "-L/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../.." > Is there anyway i can change the default search location. > > I believe that by passing my own spec file to gcc as gcc > -specs= test.c, i can change the default include path and also > the path to look for for crt0.o etc. OK, so you believe this. So what happened when you tried it? IMO, that's the wrong way to do it. If you *really* need to use nonstandard paths we provide args like -Isystem and -nostdlib. But generally gcc is configured for a particular target environment and things will go wrong if you try to change things under its feet. If the libraries and include paths are very similar, you might get way with it. Andrew. From f.p.boomstra@gmail.com Thu Mar 22 12:51:00 2007 From: f.p.boomstra@gmail.com (Feike Boomstra) Date: Thu, 22 Mar 2007 12:51:00 -0000 Subject: _bit_scan_forward In-Reply-To: References: <8d55a8b20703210526g2a449f38g7eec3314bf10fe79@mail.gmail.com> Message-ID: <8d55a8b20703220505v61219077y9c8006f14e2bc047@mail.gmail.com> Sorry Ian, it is not the right answer. This function is in the libstc++ library, so I supposed I just could use it. I found the library on my system. 21 Mar 2007 07:29:43 -0700, Ian Lance Taylor : > "Feike Boomstra" writes: > > > I am new to Linux, I am using Kubuntu (AMD64) with KDevelop. I try to > > migrate a VC++ project to Linux. I am having problems with the > > built-in function _Bit_scan_forward. > > > > 1) I can't find a headerfile defining this function. > > 2) If I define it myself, I get a link error: unresolved reference > > If that function does what I think it does, then the Unix equivalent > would be ffs. > > If that is the right answer, then this is not a gcc question, it is a > Windows to Unix porting question. This is probably not the best > mailing list to ask such questions, as we are unlikely to know the > answer. > > Ian > From dreams_arpit@yahoo.co.in Thu Mar 22 12:56:00 2007 From: dreams_arpit@yahoo.co.in (arpit jain) Date: Thu, 22 Mar 2007 12:56:00 -0000 Subject: gdb on HP-UX Message-ID: <858395.54517.qm@web8407.mail.in.yahoo.com> Hiiiii Can anyone plz tell me where I can found rpm packages (binaries) for GDB-6.3 and GDB-6.4 for HP-UX 11?? Thanks & Regards Arpit __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/ From aph@redhat.com Thu Mar 22 15:18:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 22 Mar 2007 15:18:00 -0000 Subject: gdb on HP-UX In-Reply-To: <858395.54517.qm@web8407.mail.in.yahoo.com> References: <858395.54517.qm@web8407.mail.in.yahoo.com> Message-ID: <17922.31974.765884.352273@zebedee.pink> arpit jain writes: > Can anyone plz tell me where I can found rpm packages > (binaries) for GDB-6.3 and GDB-6.4 for HP-UX 11?? I'm sure they can, but not on this list. This is for help using gcc. I'd just download gdb from http://sources.redhat.com/gdb/ and install it. Andrew. From dberlin@dberlin.org Thu Mar 22 16:06:00 2007 From: dberlin@dberlin.org (Daniel Berlin) Date: Thu, 22 Mar 2007 16:06:00 -0000 Subject: Is there a way to pretty-print output for templates errors In-Reply-To: References: <1174489576.4073.8.camel@localhost.localdomain> Message-ID: <4aca3dc20703220818l18fcf41eq9a31a5cd6eb74b3f@mail.gmail.com> On 21 Mar 2007 08:17:41 -0700, Ian Lance Taylor wrote: > Stephen Torri writes: > > > I have a hard time reading the template errors I get from GCC. I was > > wondering if there is a flag for the compiler so that instead of getting > > output like below. I know I failed to present this snapshot in a > > preformatted output. This was deliberate to show how hard is to read > > this on a terminal window. > > Question about compiler options are appropriate for the mailing list > gcc-help@gcc.gnu.org, not for gcc@gcc.gnu.org. Thanks. > > Unfortunately there is no such option. > BTW, i think the real readability improvement (besides obviously trying to use magic to make them shorter but understandable) would be had from making it visually clear where the word " to non-scalar type" starts. At least for me, half the time I spend trying to interpret the error is going through the 80 lines it spewed trying to find where the template it's complaining about ends and where the error it's actually complaining about begins. > Some people find the STLFilt program to be helpful: > http://www.bdsoft.com/tools/stlfilt.html > > Ian > From us15@os.inf.tu-dresden.de Thu Mar 22 16:38:00 2007 From: us15@os.inf.tu-dresden.de (Udo A. Steinberg) Date: Thu, 22 Mar 2007 16:38:00 -0000 Subject: Output section of string literal in initializer Message-ID: <20070322170705.09e976c3@laptop.hypervisor.org> Hello, In the example below I would like the string literals "foo", "bar" and "baz" to reside in .mysection. This works when using a pointer variable ptr as shown for "baz". Is there any way to specify the output section of string literals in an initializer (e.g., "foo" and "bar") without using using a pointer variable? I'm looking for something like { "foo" MYSECTION, 1 }. #define MYSECTION __attribute__((section (".mysection"))) char const *const ptr MYSECTION = "baz"; struct { char const *string; unsigned number; } x[] MYSECTION = { { "foo", 1 }, { "bar", 2 }, { ptr, 3 }, }; Cheers, - Udo From ranjit_kumar_b4u@yahoo.co.uk Thu Mar 22 16:46:00 2007 From: ranjit_kumar_b4u@yahoo.co.uk (ranjith kumar) Date: Thu, 22 Mar 2007 16:46:00 -0000 Subject: gcc source code Message-ID: <972742.11283.qm@web27410.mail.ukl.yahoo.com> I want to install gcc 4.1.2. Where can I get source file? I tried to follow some links in gcc.gnu.org. But I could not locate. Thanks in advance. ___________________________________________________________ New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at the Yahoo! Mail Championships. Plus: play games and win prizes. http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk From ranjit_kumar_b4u@yahoo.co.uk Thu Mar 22 16:48:00 2007 From: ranjit_kumar_b4u@yahoo.co.uk (ranjith kumar) Date: Thu, 22 Mar 2007 16:48:00 -0000 Subject: tree-ssa optimizations Message-ID: <864473.59107.qm@web27402.mail.ukl.yahoo.com> 1) I know that auto-vectorization is done on GIMPLE. I think I need to understand entire syntax GIMPLE to understand internal files of gcc which does auto-vectorization like tree-vectorizer.c. Isn't it? 2)Where can I get complete syntax of GIMPLE? 3) Is it possible to compile a .gimple/.ssa/.rtl file? Actually I want to modify above representations of a .c program and compile the modified file. If it is possible tell me how to do? Thanks in advance. ___________________________________________________________ Inbox full of unwanted email? Get leading protection and 1GB storage with All New Yahoo! Mail. http://uk.docs.yahoo.com/nowyoucan.html From iant@google.com Thu Mar 22 16:49:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Thu, 22 Mar 2007 16:49:00 -0000 Subject: _bit_scan_forward In-Reply-To: <8d55a8b20703220505v61219077y9c8006f14e2bc047@mail.gmail.com> References: <8d55a8b20703210526g2a449f38g7eec3314bf10fe79@mail.gmail.com> <8d55a8b20703220505v61219077y9c8006f14e2bc047@mail.gmail.com> Message-ID: "Feike Boomstra" writes: > it is not the right answer. > This function is in the libstc++ library, so I supposed I just could use it. > I found the library on my system. You can't simply call every function you may see in the libstdc++ sources. The library provides a documented stable interface. Ian From eljay@adobe.com Thu Mar 22 17:01:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Thu, 22 Mar 2007 17:01:00 -0000 Subject: gcc source code In-Reply-To: <972742.11283.qm@web27410.mail.ukl.yahoo.com> Message-ID: Hi ranjith, Try this UK mirror: ftp://ftp.mcc.ac.uk/pub/gnu/gcc/gcc-4.1.2/ HTH, --Eljay From aph@redhat.com Thu Mar 22 17:19:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 22 Mar 2007 17:19:00 -0000 Subject: tree-ssa optimizations In-Reply-To: <864473.59107.qm@web27402.mail.ukl.yahoo.com> References: <864473.59107.qm@web27402.mail.ukl.yahoo.com> Message-ID: <17922.46674.998692.167622@zebedee.pink> ranjith kumar writes: > 1) I know that auto-vectorization is done on GIMPLE. > I think I need to understand entire syntax GIMPLE to > understand internal files of gcc which does > auto-vectorization like tree-vectorizer.c. > Isn't it? > 2)Where can I get complete syntax of GIMPLE? gcc/tree.def > 3) Is it possible to compile a .gimple/.ssa/.rtl file? No. > Actually I want to modify above representations of > a .c program and compile the modified file. > If it is possible tell me how to do? It is not possible. Andrew. From ranjit_kumar_b4u@yahoo.co.uk Thu Mar 22 18:22:00 2007 From: ranjit_kumar_b4u@yahoo.co.uk (ranjith kumar) Date: Thu, 22 Mar 2007 18:22:00 -0000 Subject: gcc source code In-Reply-To: Message-ID: <841077.31638.qm@web27404.mail.ukl.yahoo.com> I got the following error. I am in India(I hope this information may help). Would you please send some other link. ******************************************************* ERROR The requested URL could not be retrieved An FTP protocol error occurred while trying to retrieve the URL: ftp://ftp.mcc.ac.uk/pub/gnu/gcc/ Squid sent the following FTP command: Connect to server and then received this reply Your cache administrator is webmaster. Generated Thu, 22 Mar 2007 17:15:10 GMT by netmon.iitb.ac.in (squid/2.6.STABLE11) ****************************************************** --- John Love-Jensen wrote: > Hi ranjith, > > Try this UK mirror: > ftp://ftp.mcc.ac.uk/pub/gnu/gcc/gcc-4.1.2/ > > HTH, > --Eljay > > ___________________________________________________________ The all-new Yahoo! Mail goes wherever you go - free your email address from your Internet provider. http://uk.docs.yahoo.com/nowyoucan.html From monoid@ispras.ru Thu Mar 22 18:51:00 2007 From: monoid@ispras.ru (Alexander Monakov) Date: Thu, 22 Mar 2007 18:51:00 -0000 Subject: Optimizing sequential memory access in loops Message-ID: Hi, I have noticed that in examples like these: void test1(int N, double *a) { int i; for (i=0; i References: <8d55a8b20703210526g2a449f38g7eec3314bf10fe79@mail.gmail.com> <8d55a8b20703220505v61219077y9c8006f14e2bc047@mail.gmail.com> <8d55a8b20703221139t1e05c010xd4f13ad1ee001c0a@mail.gmail.com> Message-ID: "Feike Boomstra" writes: > I didn't get it from the source code. I found it here: > http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespace____gnu__cxx.html > and that looked to me as an interface description. > > The build-in bit_scan_forward function implements the bsf instruction of the > X386 instructionset. It is in the intel c-compiler and the ms c-compiler. This is a reason that I personally don't like doxygen documentation. It isn't clearly separated into interface functions and internal functions. Take my word for it: don't call that function. Now, if you look at the definition of the function, you will see that it is this: inline size_t _Bit_scan_forward(size_t __num) { return static_cast(__builtin_ctzl(__num)); } So how about just calling __builtin_ctzl instead? That is documented here: http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Other-Builtins.html Ian From rattan@cps.cmich.edu Thu Mar 22 19:17:00 2007 From: rattan@cps.cmich.edu (ISHWAR RATTAN) Date: Thu, 22 Mar 2007 19:17:00 -0000 Subject: Strange execution behavior.. Message-ID: I was asked by a colleague about the code given below. I compiles and runs as: 1. No errors on: AMD64 based Solaris-10 (g++: 3.4.3) 2. Buserror on SPARC based Solaris-10 (g++: 3.4.4) after printing the results.. 3. Segmentation fault on Linux (g++: 4.1.2) after printing the results.. Any pointers will be appreciated. -ishwar -------- ///////////////////////////////////////////////////////// // // sptr.cc // // A. Ugur, March 20, 2007 // // to compile: g++ sptr.cc -o sptr // ///////////////////////////////////////////////////////// #include //#include class Node { public: int x, y; // alignment coordinates public: Node(); Node(int i, int j); }; Node::Node() // default constructor { x = -1; y = -1; } Node::Node(int i, int j) // parameterized constructor { x = i; y = j; } template class smartPtr { T* p; public: smartPtr(); smartPtr(T& n); T* operator->(); }; template smartPtr::smartPtr() // default constructor { *p = T(); } template smartPtr::smartPtr(T& n) // parameterized constructor { p = &n; } template T* smartPtr::operator->() // overloaded operator->() { return p; } // function to use smartpointer to Node object void f(smartPtr p, int i, int j) { p->x = i; p->y = j; } // test driver for smartpointer main(int argc, char* argv[]) { Node n1, n2, n3(3, 3); smartPtr p; printf("n1: after constructor: (%d,%d)\n", n1.x, n1.y); printf("n2: after constructor: (%d,%d)\n", n2.x, n2.y); printf("n3: after constructor: (%d,%d)\n", n3.x, n3.y); p = smartPtr(n3); f(p, 5, 5); printf("n3: after f applied: (%d,%d)\n", n3.x, n3.y); } --- From aph@redhat.com Thu Mar 22 19:56:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 22 Mar 2007 19:56:00 -0000 Subject: Strange execution behavior.. In-Reply-To: References: Message-ID: <17922.54833.318885.777259@zebedee.pink> ISHWAR RATTAN writes: > I was asked by a colleague about the code given below. > I compiles and runs as: > 1. No errors on: AMD64 based Solaris-10 (g++: 3.4.3) > 2. Buserror on SPARC based Solaris-10 (g++: 3.4.4) > after printing the results.. > 3. Segmentation fault on Linux (g++: 4.1.2) after > printing the results.. > > Any pointers will be appreciated. Your default constructor is broken. > template > smartPtr::smartPtr() > // default constructor > { > *p = T(); > } What does p point to? Andrew. From Michael.Young@paetec.com Thu Mar 22 20:08:00 2007 From: Michael.Young@paetec.com (Young, Michael) Date: Thu, 22 Mar 2007 20:08:00 -0000 Subject: _bit_scan_forward In-Reply-To: Message-ID: > This is a reason that I personally don't like doxygen documentation. > It isn't clearly separated into interface functions and internal > functions. Do you know of a better tool? If so, I'm interested, because I have "issues" with Doxygen, too - IMHO, it does have some "warts". However... AFAICT, the problem really isn't with Doxygen. How does C or C++ really specify that a function is an "interface" vs. "internal"? They don't... one could argue that the C++ access specifiers on member functions are the same thing, but, it reality, they're not quite. (In most cases they're synonymous, but what members are/are not intended for use by a "friend"? That's why there's the Client/Attorney "pattern"...) [On a related note : access specifiers aren't there for encapsulation, either - that's why there's a "pimpl" (handle/body) idiom.] In C, there's really truly nothing for this... Anyway, the languages lack a formal way to specify interface vs. internal implementation. Note that even if there's a way to do this, then the question becomes, "Which interface is appropriate to use for which application / code layer?" So the real answer is that the developer should explicitly "identify" the function as internal/interface, along with the interface name/category, (easily done using preprocessor definitions and conditionals) when the documentation is created. (There may be other ways to deal with this, too - probably best to ask the Doxygen team for ideas.) Of course, even if you manage to identify the files/sections/functions appropriate for each audience, you must then typically generate "multiple sets" of docs - one for internal developers and one for 3rd parties, for example. [Side note : I've often wondered if I could generate a single doc set that can present only the views "accessible" by an identified user, but I've never really invetigated/pursued this...] Alternatively, you can choose to not create "pretty" docs for the internal stuff - but if you have to learn the tool / tags to create the interface docs anyway, the tool is easy to use, and the doc is useful for the next maintainer (you know - that homicidal maniac who knows where you live, or, in my case, that ADHD developer who can't remember anything and lives where I live), why not??? Finally, there's the "brute force" approach that just creates a description line that explicitly states into which "camp" the function falls; this leaves the "enforcement" up to the client developer and hides nothing, but it is generally the simplest approach to implement, too. I understand that it's difficult to "reverse engineer" and document functions properly "after the fact" (i.e., usually much later than the code creation, and often after the original developer is no longer available for consultation). There isn't a perfect solution for that situation, at least not until Vulcan mind-melds and collective cognition come along! But I think Doxygen provides a reasonable approach - it allows you to document "what is" relatively quickly, and that hopefully makes the code base easier to "grok". This is a little off-topic, but gripes about tools that are not being fully utilized or understood is something the GCC community has a vested interest in dispelling! In all fairness, the issue here may be with how GCC developers are documenting code, rather than a real problem with the tool! ;-) - Mike BTW - I am not a Doxygen contributor, and I have not ever used it at a paid job, but I do use it for my own "projects" (currently, my masters thesis project). From eljay@adobe.com Thu Mar 22 20:16:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Thu, 22 Mar 2007 20:16:00 -0000 Subject: gcc source code In-Reply-To: <841077.31638.qm@web27404.mail.ukl.yahoo.com> Message-ID: Hi ranjith, You can find the closest GNU or Mirror site to you here: http://gcc.gnu.org/gcc-4.1/ HTH, --Eljay From iant@google.com Fri Mar 23 03:44:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Fri, 23 Mar 2007 03:44:00 -0000 Subject: _bit_scan_forward In-Reply-To: References: Message-ID: "Young, Michael" writes: > > This is a reason that I personally don't like doxygen documentation. > > It isn't clearly separated into interface functions and internal > > functions. > > Do you know of a better tool? If so, I'm interested, because I have > "issues" with Doxygen, too - IMHO, it does have some "warts". However... > > AFAICT, the problem really isn't with Doxygen. How does C or C++ really > specify that a function is an "interface" vs. "internal"? Yes. The problem is that Doxygen doesn't force you to consider this. Writing documentation does. That is, my problem with Doxygen is a conceptual one: I don't think that annotating code is the right way to write documentation. Doxygen certainly has its uses. For example, it's useful within a project for people working on that project to see what functions are available and what they do. But it's not the same as documentation. For that purpose, at its best it's a tool which can be used to create the first version of the documentation. Ian From fang@csl.cornell.edu Fri Mar 23 05:42:00 2007 From: fang@csl.cornell.edu (David Fang) Date: Fri, 23 Mar 2007 05:42:00 -0000 Subject: Is there a way to pretty-print output for templates errors In-Reply-To: <4aca3dc20703220818l18fcf41eq9a31a5cd6eb74b3f@mail.gmail.com> Message-ID: <20070322223321.B48706-200000@shannon.csl.cornell.edu> > > Stephen Torri writes: > > > > > I have a hard time reading the template errors I get from GCC. I was > > > wondering if there is a flag for the compiler so that instead of getting > > > output like below. I know I failed to present this snapshot in a > > > preformatted output. This was deliberate to show how hard is to read > > > this on a terminal window. > > > > Unfortunately there is no such option. > > BTW, i think the real readability improvement (besides obviously > trying to use magic to make them shorter but understandable) would be > had from making it visually clear where the word " to non-scalar type" > starts. > > At least for me, half the time I spend trying to interpret the error > is going through the 80 lines it spewed trying to find where the > template it's complaining about ends and where the error it's actually > complaining about begins. > > Some people find the STLFilt program to be helpful: > > http://www.bdsoft.com/tools/stlfilt.html Hi all, Years ago, I had similar gripes about reading template errors arising from deeply nested templates and long chains of instantiations. I put awk to work and wrote the attached makeshift filter [balance_indent.awk] that expands templates arguments with tree-like indenting and line-breaking. To use it, pipe the stderr of gcc/g++ through "awk -f ". It's probably far from perfect, but it sure took strain off of my eyes in identifying the precise problem. You can customize the matching pattern at the end of the script. To be honest, I haven't used the script in years, and the format of the error messages may have changed slightly over the years. After practice, one just sees through the falling glyphs... Hope it helps some. Fang -------------- next part -------------- #!/usr/bin/awk -f # "balance_indent.awk" # $Id: balance_indent.awk,v 1.1 2005/09/04 22:13:48 fang Exp $ # for all those unreadable template error messages in the C++ standard library BEGIN { level = 0; indent = " "; # or "\t" width = 80; # terminal width, overrideable } # note beware of operators < and > function auto_indent(lvl, i) { ret = ""; i=0; # local var for ( ; i", "\n>", str); # split them apart numlines = split(str, arr, "\\n"); i=1; for ( ; i<=numlines; i++) { if (match(arr[i], "^\\)") || match(arr[i], "^>") || match(arr[i], "^\\]")) { level--; } # prepend indent ilevel[i] = level; if (match(arr[i], "\\($") || match(arr[i], "<$") || match(arr[i], "\\[$")) { level++; } # else no change in level } # glue back together # any intelligence about short balances? # joinlines = smart_join(arr, ilevel, 0, numlines-1); str = arr[1]; i = 2; for ( ; i<=numlines; i++) { if (length(arr[i])) str = str "\n" auto_indent(ilevel[i]) arr[i]; # else skip blank lines } return str; } # intelligently joins lines, recursively function smart_join(arr, ilevel, startindex, endindex, # returned arrays (by reference) subarr, subilevel, subnumlines, # local variables i, is_nested, curlevel, linelength) { # so we know this is passed by reference subnumlines[0] = 0; is_nested = 0; curlevel = ilevel[startindex]; # phase 0: scan and see if this sub-array has nested levels for (i=startindex+1; i<=endindex && !is_nested; i++) { if (ilevel[i] > curlevel) is_nested = 1; } if (is_nested) { # phase 1: partition into sections by level # what is one *item* in this level? for (i = startindex; i<=endindex; i++) { } } else { # we're in deepest level, no need to recurse # we have uniformly indented subarray of lines # see what we can combine... # no partial joining, just all or none # compute total line length (until width exceeded) linelength = length(auto_indent(curlevel)); for (i=startindex; i<=endindex && linelength < width; i++) { linelength += length(arr[i]); } if (linelength < width) { # join them all # don't prefix with indent yet. subilevel[startindex] = ilevel[startindex]; for (i=startindex; i<=endindex; i++) { subarray[startindex] = \ subarray[startindex] arr[i]; } subnumlines[0] = 1; } else { # don't join any, just copy back for (i=startindex; i<=endindex; i++) { subarray[i] = arr[i]; subilevel[i] = ilevel[i]; } subnumlines[0] = startindex -endindex +1; } } } # for almost all lines: { # exceptions if (match($0, "^g?make") || match($0, "^distcc")) print; else print balance_indent($0); } From rbaverst@engmail.uwaterloo.ca Fri Mar 23 06:34:00 2007 From: rbaverst@engmail.uwaterloo.ca (Richard Baverstock) Date: Fri, 23 Mar 2007 06:34:00 -0000 Subject: Forcing use of move instead of movem on M68k (5200/5307) Message-ID: <9D2873BB-D515-48E4-8DE5-69C17EB89470@engmail.uwaterloo.ca> Hi, We're having an issue with movem on the coldfire boards we are compiling a program for, and wondering if we can force the m68k gcc compiler to use move instead of movem. movem does not appear to be working on whatever chip variant we have, which severely affects returning from functions. Using the coldfire 5307, tried compiling with -m5200 and -m5307, both use movem. Thanks, Richard From dreams_arpit@yahoo.co.in Fri Mar 23 07:28:00 2007 From: dreams_arpit@yahoo.co.in (arpit jain) Date: Fri, 23 Mar 2007 07:28:00 -0000 Subject: Linker Directive Language Message-ID: <597907.76520.qm@web8405.mail.in.yahoo.com> Hiiiii 1.Can anyone plz tell me which is the latest version of Linker Directive Language (LD)? 2. What is the version of LD used by Latest release of GCC? Thanks & Regards Arpit __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/ From ita-garpaljo@itacyl.es Fri Mar 23 07:51:00 2007 From: ita-garpaljo@itacyl.es (=?iso-8859-1?Q?Jose_Luis_Garc=EDa_Pallero?=) Date: Fri, 23 Mar 2007 07:51:00 -0000 Subject: Installing gcc in a local directory Message-ID: Hello, First of all I should say that I'm a newbie GNU/Linux user. I need to install gcc/gfortran 4.2.0 in my computer. I would like to install it in a local directory, no the standard /usr/local. I configured the package with the options: ./configure --prefix=/home/user/gcc-4.2.0 --enable-languages=c,fortran --with-mpfr=/home/user/mpfr-2.2.1 --with-gmp=/home/user/gmp-4.2.1 and when it was compiled I put in .bash_profile the lines: PATH="/home/user/gcc- 4.2.0/bin:$PATH" export PATH I don't know if it is the only PATH that I should be defined. Should I define any other LIBPATH or INCLUDEPATH? Thanks From Markus.Duft@salomon.at Fri Mar 23 08:40:00 2007 From: Markus.Duft@salomon.at (Duft Markus) Date: Fri, 23 Mar 2007 08:40:00 -0000 Subject: Is it a Bug? (void*) Message-ID: <18597F2B47F1394A9B309945EC724112D3FC02@servex01.wamas.com> Hi I'm porting lots of stuff to windows (i know, *arg*...) and while doing so i found something interesting in a C Source file: void* myptr = (void*)otherptr + 1; Which doesn't compile with the microsoft compiler (error: void*: unknown size). Now i think, that microsoft is right in that case, and that void really has an unknown size. Since the "+ 1" should add something like "one times sizeof type" to the pointer, what should the compiler add when void is encountered? I think the above is wrong and dangerous. Should the compiler catch this? With C++ gcc prints an error and exits, but because of type conversions, not because of the addition. I attached a small test program, which demonstrates this (maybe bug... ;o)). Should i officially report this issue? Cheers, Markus -------------- next part -------------- A non-text attachment was scrubbed... Name: test.c Type: application/octet-stream Size: 472 bytes Desc: test.c URL: From annapoorna.r@subexazure.com Fri Mar 23 08:54:00 2007 From: annapoorna.r@subexazure.com (Annapoorna R) Date: Fri, 23 Mar 2007 08:54:00 -0000 Subject: installing gcc4.1.2 Message-ID: <46039218.7020504@subexazure.com> Hi, i was istalling the GCC4.1.2 vesrion on solaris10. i dowloaded core and the java vesrion tar.gz from the site to GCC4.1 folder. when i extracted core and java. both got extracted to /gcc4.1/gcc-4.1.2 folder. java into libjava. i read the instalation details in the install info, and got confused in between. .-- should i do configure for both core and java seperately? -- does this version(GCC) supports java 1.5 features (generics, autoboxing etc) -- confused with srcdir and objdir what you have mentioned. - does objdir means the dir where i want to install it? and srcdir is the dir where it got extracted. - i found that classpath-0.92-generics.tar.gz which supports generics. should i extract this to classpath folder created? Kindly give me details. -- Regards, Annapoorna.R This e-mail is bound by the terms and conditions described at http://www.subexazure.com/mail-disclaimer.html From daniel.lohmann@informatik.uni-erlangen.de Fri Mar 23 10:15:00 2007 From: daniel.lohmann@informatik.uni-erlangen.de (Daniel Lohmann) Date: Fri, 23 Mar 2007 10:15:00 -0000 Subject: Is it a Bug? (void*) In-Reply-To: <18597F2B47F1394A9B309945EC724112D3FC02@servex01.wamas.com> References: <18597F2B47F1394A9B309945EC724112D3FC02@servex01.wamas.com> Message-ID: <460395BD.1030307@informatik.uni-erlangen.de> It is not a bug, it's a feature :-) http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Pointer-Arith.html#Pointer-Arith >>> 5.17 Arithmetic on void- and Function-Pointers In GNU C, addition and subtraction operations are supported on pointers to void and on pointers to functions. This is done by treating the size of a void or of a function as 1. A consequence of this is that sizeof is also allowed on void and on function types, and returns 1. The option -Wpointer-arith requests a warning if these extensions are used. <<< Daniel Duft Markus wrote: > Hi > > I'm porting lots of stuff to windows (i know, *arg*...) and while doing > so i found something interesting in a C Source file: > > void* myptr = (void*)otherptr + 1; > > Which doesn't compile with the microsoft compiler (error: void*: unknown > size). Now i think, that microsoft is right in that case, and that void > really has an unknown size. > > Since the "+ 1" should add something like "one times sizeof type" to the > pointer, what should the compiler add when void is encountered? I think > the above is wrong and dangerous. Should the compiler catch this? With > C++ gcc prints an error and exits, but because of type conversions, not > because of the addition. > > I attached a small test program, which demonstrates this (maybe bug... > ;o)). > > Should i officially report this issue? > > Cheers, Markus From aph@redhat.com Fri Mar 23 10:46:00 2007 From: aph@redhat.com (Andrew Haley) Date: Fri, 23 Mar 2007 10:46:00 -0000 Subject: gcj install failed In-Reply-To: <46036AC2.7070108@subexazure.com> References: <46036AC2.7070108@subexazure.com> Message-ID: <17923.43199.886420.76004@zebedee.pink> Annapoorna R writes: > Hi, > > am trying to istall the GCJ 4.1.2 version on my SUNOs. > > steps i followed: > > 1. downloaded GCJ4.1.2 core and java tar from GNU site. and extracted it > to GCC4.1 > > after extracting folder GCC-4.1.2 is created(automatically while > extracting). > > the frontend part (java tar) was extraced to /gcc-4.1.2/libjava. > > Did ./configure from libjava folder.--successful > > did make from libjava. giving compilation errors. > > Please let me know am i wrong in the steps followed? Do the configure from the top directory. Andrew. From annapoorna.r@subexazure.com Fri Mar 23 11:06:00 2007 From: annapoorna.r@subexazure.com (Annapoorna R) Date: Fri, 23 Mar 2007 11:06:00 -0000 Subject: gcj install failed In-Reply-To: <17923.43199.886420.76004@zebedee.pink> References: <46036AC2.7070108@subexazure.com> <17923.43199.886420.76004@zebedee.pink> Message-ID: <4603AFA2.6000101@subexazure.com> Hi, Thanks for the info. I did configure from top directory. now its giving error here /disk1/certo/gcc4.1/gcc-4.1.2/libjava/classpath /bin/sh ./gen-classlist.sh test: Unknown operator -ef . Does it depend on the whether its running on sh/ksh/bash. Kindly help me. now its giving error here /disk1/certo/gcc4.1/gcc-4.1.2/libjava/classpath /bin/sh ./gen-classlist.sh Andrew Haley wrote: > Annapoorna R writes: > > Hi, > > > > am trying to istall the GCJ 4.1.2 version on my SUNOs. > > > > steps i followed: > > > > 1. downloaded GCJ4.1.2 core and java tar from GNU site. and extracted it > > to GCC4.1 > > > > after extracting folder GCC-4.1.2 is created(automatically while > > extracting). > > > > the frontend part (java tar) was extraced to /gcc-4.1.2/libjava. > > > > Did ./configure from libjava folder.--successful > > > > did make from libjava. giving compilation errors. > > > > Please let me know am i wrong in the steps followed? > > Do the configure from the top directory. > > Andrew. > > > > -- Regards, Annapoorna.R This e-mail is bound by the terms and conditions described at http://www.subexazure.com/mail-disclaimer.html From aph@redhat.com Fri Mar 23 11:58:00 2007 From: aph@redhat.com (Andrew Haley) Date: Fri, 23 Mar 2007 11:58:00 -0000 Subject: gcj install failed In-Reply-To: <4603AFA2.6000101@subexazure.com> References: <46036AC2.7070108@subexazure.com> <17923.43199.886420.76004@zebedee.pink> <4603AFA2.6000101@subexazure.com> Message-ID: <17923.46230.699404.72263@zebedee.pink> Please don't top-post. Annapoorna R writes: > Hi, > > Thanks for the info. I did configure from top directory. > > now its giving error here > > /disk1/certo/gcc4.1/gcc-4.1.2/libjava/classpath /bin/sh ./gen-classlist.sh > > test: Unknown operator -ef . > > Does it depend on the whether its running on sh/ksh/bash. You have to look at the man page for test on your system and find out why 'test -ef' doesn't work. Andrew. From glen.beane@jax.org Fri Mar 23 12:58:00 2007 From: glen.beane@jax.org (Glen Beane) Date: Fri, 23 Mar 2007 12:58:00 -0000 Subject: Is it a Bug? (void*) In-Reply-To: <18597F2B47F1394A9B309945EC724112D3FC02@servex01.wamas.com> References: <18597F2B47F1394A9B309945EC724112D3FC02@servex01.wamas.com> Message-ID: <4603C0BE.5090004@jax.org> Duft Markus wrote: > Hi > > I'm porting lots of stuff to windows (i know, *arg*...) and while doing > so i found something interesting in a C Source file: > > void* myptr = (void*)otherptr + 1; what about doing the conversion after incrementing the pointer? void *myptr = (void*)(otherptr + 1); -- Glen L. Beane Software Engineer II The Jackson Laboratory Phone (207) 288-6153 From tprince@myrealbox.com Fri Mar 23 13:13:00 2007 From: tprince@myrealbox.com (Timothy C Prince) Date: Fri, 23 Mar 2007 13:13:00 -0000 Subject: Installing gcc in a local directory Message-ID: <1174654719.c7c8925ctprince@myrealbox.com> -----Original Message----- From: Jose Luis Garc?a Pallero To: Date: Fri, 23 Mar 2007 08:28:41 +0100 Subject: Installing gcc in a local directory Hello, First of all I should say that I'm a newbie GNU/Linux user. I need to install gcc/gfortran 4.2.0 in my computer. I would like to install it in a local directory, no the standard /usr/local. I configured the package with the options: ../configure --prefix=/home/user/gcc-4.2.0 --enable-languages=c,fortran --with-mpfr=/home/user/mpfr-2.2.1 --with-gmp=/home/user/gmp-4.2.1 and when it was compiled I put in .bash_profile the lines: PATH="/home/user/gcc- 4.2.0/bin:$PATH" export PATH I don't know if it is the only PATH that I should be defined. Should I define any other LIBPATH or INCLUDEPATH? Thanks ________________________________________- After completion of make and make install, to use the compiler you have made, you would also need LD_LIBRARY_PATH=/home/user/gcc-4.2.0/lib:$LD_LIBRARY_PATH (no spaces in either path) Tim Prince From klaus-fried@gmx.net Fri Mar 23 13:15:00 2007 From: klaus-fried@gmx.net (Klaus Friedrich) Date: Fri, 23 Mar 2007 13:15:00 -0000 Subject: need help for GCC--RTL Message-ID: <4603D278.8050205@gmx.net> Hallo, my name is Klaus Friedrich. For my diploma thesis, i will work with the gcc4.1 internals. I would like to extract information about the RTL language. I search for a description of the virtual machine/virtual processor on the RTL instruction set and for example the register management/alignment. I can't find exakt information about the meaning for the RTL constructs. For Example the meaning for this reg expression [D.1281] in (reg:SI 58 [D.1281]) or the meaning for virtual-stack-vars in (reg/f:SI 54 virtual-stack-vars). I also information about the (clobber (reg:CC 17 flags)) expr. What do the clobber function with the reg 17 ? Thank You very much!!! Klaus Friedrich From ita-garpaljo@itacyl.es Fri Mar 23 13:38:00 2007 From: ita-garpaljo@itacyl.es (=?iso-8859-1?Q?Jose_Luis_Garc=EDa_Pallero?=) Date: Fri, 23 Mar 2007 13:38:00 -0000 Subject: Installing gcc in a local directory Message-ID: Hi, Only LD_LIBRARY_PATH=/home/user/gcc-4.2.0/lib:$LD_LIBRARY_PATH? What about include files? For example, if I want to compile a tipycal hello world program in C, what stdio.h use the compiler, the new 4.2.0 or the old 4.1.2? If I want to compile a program with gcc-4.1.2 instead of 4.2.0, what about the new LD_LIBRARY_PATH=/home/user/gcc-4.2.0/lib:$LD_LIBRARY_PATH order? Need add LD_LIBRARY_PATH=/home/user/gcc-4.2.0/lib:$LD_LIBRARY_PATH order if I compile, for example, gcc/g77 too? -----Original Message----- From: Jose Luis Garc?a Pallero To: Date: Fri, 23 Mar 2007 08:28:41 +0100 Subject: Installing gcc in a local directory Hello, First of all I should say that I'm a newbie GNU/Linux user. I need to install gcc/gfortran 4.2.0 in my computer. I would like to install it in a local directory, no the standard /usr/local. I configured the package with the options: ../configure --prefix=/home/user/gcc-4.2.0 --enable-languages=c,fortran --with-mpfr=/home/user/mpfr-2.2.1 --with-gmp=/home/user/gmp-4.2.1 and when it was compiled I put in .bash_profile the lines: PATH="/home/user/gcc- 4.2.0/bin:$PATH" export PATH I don't know if it is the only PATH that I should be defined. Should I define any other LIBPATH or INCLUDEPATH? Thanks ________________________________________- After completion of make and make install, to use the compiler you have made, you would also need LD_LIBRARY_PATH=/home/user/gcc-4.2.0/lib:$LD_LIBRARY_PATH (no spaces in either path) Tim Prince From kkxkkx@gmail.com Fri Mar 23 14:33:00 2007 From: kkxkkx@gmail.com (John) Date: Fri, 23 Mar 2007 14:33:00 -0000 Subject: How to modify GCC so to insert some code for debug? Message-ID: <2311f6f10703230638g3e1c12c9rf5526f86146eaa@mail.gmail.com> Hi, I use GCC to compile the code that runs in a very resouse-limited embed system, so I can't use the usual debug tools, such as GDB. And there are thousands of lagacy code already, in which there is no debug code, sth like PRINT(__FILE__, __LINE__). So I want to modify the GCC to meet the requirement below: 1. In each funtion entry and exit, print out some info, such as the funtion name, time, etc. 2. Before each loop(for/while/until) and branch selection, print out the condition info. For exmaple: for(i = ...) while(j < ...), if(i > ...), print out the value of i. 3. More advanced, when a variable is accessed, its value is printed. Like the watch command in GDB. Could some gurus give me some suggestions? Such as is there a project aimed at this? How long/difficult does it take if I make it from scratch? Thanks, John From kpfleming@starnetworks.us Fri Mar 23 14:35:00 2007 From: kpfleming@starnetworks.us (Kevin P. Fleming) Date: Fri, 23 Mar 2007 14:35:00 -0000 Subject: Is it a Bug? (void*) In-Reply-To: <4603C0BE.5090004@jax.org> References: <18597F2B47F1394A9B309945EC724112D3FC02@servex01.wamas.com> <4603C0BE.5090004@jax.org> Message-ID: <4603E534.6070705@starnetworks.us> Glen Beane wrote: > what about doing the conversion after incrementing the pointer? > > void *myptr = (void*)(otherptr + 1); Then the pointer will be incremented by sizeof(*otherptr), which could be anything and is likely to not be '1 byte'. From hooksbetty@sbcglobal.net Fri Mar 23 15:07:00 2007 From: hooksbetty@sbcglobal.net (RLB) Date: Fri, 23 Mar 2007 15:07:00 -0000 Subject: Starting programs How? Message-ID: <002301c76d58$8cbec290$4a4adf45@fastamd> Have been using VisualStudio ( 6 & 8) for several years. I am not satisfied with the stuff that comes out of MSFT. I have tried for several years (occassionally) to get into a different area -- and I have not discovered the secret to beginning. At present I have Boost; gcc compiler; cygwin; gimp; STAF; STAX; VS6; and VS8; in the hdd that runs WinXP. I am unable to find a place to start any of the programs, projects, or whatever, except the VS6 and VS8. I have the manuals from gcc. Hundreds of pages, many not be relevant. And nowhere does it tell how to institute any of the programs. For example: How do you get the gcc-4.1.2 to do anything? Is there a program editor here anywhere? If so how do you call it up? (Other than the VS6 or 8) How do I get any of this stuff to work together with any of the other stuff? Basically I have a workable program that XP will not run. Is there a way to move all the files from the VS6 and rework it somewhere else? Bear in mind that the program I have involves some 40 odd files. Can anyone give me anything that will help -- even the way to institute any of these outfits. I can probably figure how to make the program work if there is a starting place. Thanks, Bob Bailey hooksbetty@sbcglobal.net From Markus.Duft@salomon.at Fri Mar 23 15:10:00 2007 From: Markus.Duft@salomon.at (Duft Markus) Date: Fri, 23 Mar 2007 15:10:00 -0000 Subject: Is it a Bug? (void*) Message-ID: <18597F2B47F1394A9B309945EC724112D3FE3A@servex01.wamas.com> Kevin P. Fleming <> wrote: > Glen Beane wrote: >> what about doing the conversion after incrementing the pointer? >> >> void *myptr = (void*)(otherptr + 1); > > Then the pointer will be incremented by sizeof(*otherptr), which could > be anything and is likely to not be '1 byte'. Yes, correctly... The thing is, i can cast to char*, but thats not the point. I just wanted to know if it's wanted that void=1byte with gcc -> it's not necessarily with other compilers. (it's not with microsoft's cl which i'm porting to ;o)) Cheers, Markus From eljay@adobe.com Fri Mar 23 15:47:00 2007 From: eljay@adobe.com (John (Eljay) Love-Jensen) Date: Fri, 23 Mar 2007 15:47:00 -0000 Subject: Starting programs How? References: <002301c76d58$8cbec290$4a4adf45@fastamd> Message-ID: Hi Bob, Here's my recommendation. Download the Cygwin SETUP.EXE (www.cygwin.com). Run the SETUP.EXE and make sure you install GCC (whichever languages you want). If you want to target Windows, install the MinGW facilities. If you want to target the Unix-like Cygwin environment, you don't need MinGW. I use Vim for my editor, and GNU Make for my projects. If you prefer an IDE type of environment, there are several available, but I'm not familiar with them. HTH, --Eljay From aph@redhat.com Fri Mar 23 16:15:00 2007 From: aph@redhat.com (Andrew Haley) Date: Fri, 23 Mar 2007 16:15:00 -0000 Subject: Is it a Bug? (void*) In-Reply-To: <18597F2B47F1394A9B309945EC724112D3FE3A@servex01.wamas.com> References: <18597F2B47F1394A9B309945EC724112D3FE3A@servex01.wamas.com> Message-ID: <17923.63085.933389.961068@zebedee.pink> Duft Markus writes: > Kevin P. Fleming <> wrote: > > Glen Beane wrote: > >> what about doing the conversion after incrementing the pointer? > >> > >> void *myptr = (void*)(otherptr + 1); > > > > Then the pointer will be incremented by sizeof(*otherptr), which could > > be anything and is likely to not be '1 byte'. > > Yes, correctly... > > The thing is, i can cast to char*, but thats not the point. I just > wanted to know if it's wanted that void=1byte with gcc -> it's not > necessarily with other compilers. (it's not with microsoft's cl which > i'm porting to ;o)) 5.17 Arithmetic on `void'- and Function-Pointers ================================================ In GNU C, addition and subtraction operations are supported on pointers to `void' and on pointers to functions. This is done by treating the size of a `void' or of a function as 1. A consequence of this is that `sizeof' is also allowed on `void' and on function types, and returns 1. The option `-Wpointer-arith' requests a warning if these extensions are used. From iant@google.com Fri Mar 23 16:16:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Fri, 23 Mar 2007 16:16:00 -0000 Subject: Forcing use of move instead of movem on M68k (5200/5307) In-Reply-To: <9D2873BB-D515-48E4-8DE5-69C17EB89470@engmail.uwaterloo.ca> References: <9D2873BB-D515-48E4-8DE5-69C17EB89470@engmail.uwaterloo.ca> Message-ID: Richard Baverstock writes: > We're having an issue with movem on the coldfire boards we are > compiling a program for, and wondering if we can force the m68k gcc > compiler to use move instead of movem. movem does not appear to be > working on whatever chip variant we have, which severely affects > returning from functions. Using the coldfire 5307, tried compiling > with -m5200 and -m5307, both use movem. Unfortunately there is no option to disable movem. You would have to change the compiler source code. The ColdFire does support movem, although it doesn't support all variants. You didn't mention which version of gcc you are using. There have been improvements to the ColdFire support in recent releases. Ian From mailinglists@blueSpirit.la Fri Mar 23 16:17:00 2007 From: mailinglists@blueSpirit.la (Karl Krach) Date: Fri, 23 Mar 2007 16:17:00 -0000 Subject: wrong GCC-configuration? (./specs: Is a directory) Message-ID: <4603FD3F.5000600@blueSpirit.la> Hi! I'm a Gentoo user and tried to emerge k3b and got stuck while installing the necessary app-cdr/cdrdao-1.2.1-r1 package: [...] checking for x86_64-pc-linux-gnu-gcc... x86_64-pc-linux-gnu-gcc checking for C compiler default output file name... configure: error: *C compiler cannot create executables* See `config.log' for more details. [...] !!! ERROR: app-cdr/cdrdao-1.2.1-r1 failed. In the config.log the interesting part is configure:2357: x86_64-pc-linux-gnu-gcc -v &5 Reading specs from ./specs x86_64-pc-linux-gnu-gcc: *./specs: Is a directory* configure:2360: $? = 1 configure:2362: x86_64-pc-linux-gnu-gcc -V &5 x86_64-pc-linux-gnu-gcc: '-V' option must have argument configure:2365: $? = 1 configure:2388: checking for C compiler default output file name configure:2391: x86_64-pc-linux-gnu-gcc -march=k8 -pipe -O2 -fno-inline conftest.c >&5 x86_64-pc-linux-gnu-gcc: *./specs: Is a directory* configure:2394: $? = 1 [...] configure:2433: error: C compiler cannot create executables What I figured out: My problem is that my GCC reads the specs from the current directory (if available). To demonstrate this: bluespirit tmp # ls bluespirit tmp # gcc -v *Reading specs from /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/specs* Target: x86_64-pc-linux-gnu [...] gcc version 4.1.1 (Gentoo 4.1.1-r3) bluespirit tmp # touch specs bluespirit tmp # gcc -v *Reading specs from ./specs* gcc: unrecognized option '-v' gcc: unrecognized option '-mtune=k8' Target: x86_64-pc-linux-gnu [...] gcc version 4.1.1 (Gentoo 4.1.1-r3) bluespirit tmp # rm specs bluespirit tmp # mkdir specs bluespirit tmp # gcc -v *Reading specs from ./specs* gcc: ./specs: Is a directory bluespirit tmp # unset GCC_SPECS bluespirit tmp # gcc -v *Reading specs from ./specs* gcc: ./specs: Is a directory bluespirit tmp # How can I teach my GCC to use ONLY the given specs - and ignore the directory specs (which exists in the cdrdao-folder). In my opinion, I use the Gentoo settings for the GCC - so I'm wondering, why this error is so rarely documented in the web. Thanks in advance, Charly -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: gcc.v.txt URL: From iant@google.com Fri Mar 23 16:21:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Fri, 23 Mar 2007 16:21:00 -0000 Subject: Linker Directive Language In-Reply-To: <597907.76520.qm@web8405.mail.in.yahoo.com> References: <597907.76520.qm@web8405.mail.in.yahoo.com> Message-ID: arpit jain writes: > 1.Can anyone plz tell me which is the latest version > of Linker Directive Language (LD)? > > 2. What is the version of LD used by Latest release of > GCC? GCC uses whatever linker you have installed. On GNU/Linux systems the linker is part of the GNU binutils. See http://sourceware.org/binutils/ for more information. Ian From iant@google.com Fri Mar 23 16:27:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Fri, 23 Mar 2007 16:27:00 -0000 Subject: How to modify GCC so to insert some code for debug? In-Reply-To: <2311f6f10703230638g3e1c12c9rf5526f86146eaa@mail.gmail.com> References: <2311f6f10703230638g3e1c12c9rf5526f86146eaa@mail.gmail.com> Message-ID: John writes: > I use GCC to compile the code that runs in a very resouse-limited embed system, > so I can't use the usual debug tools, such as GDB. And there are thousands of > lagacy code already, in which there is no debug code, sth like > PRINT(__FILE__, __LINE__). > > So I want to modify the GCC to meet the requirement below: > 1. In each funtion entry and exit, print out some info, such as the > funtion name, time, etc. Look at the profiling support enabled by -pg, which does something similar at function entry. It inserts a call to _mcount. > 2. Before each loop(for/while/until) and branch selection, print out > the condition info. > For exmaple: > for(i = ...) while(j < ...), if(i > ...), print out the value of i. Painful but possible. > 3. More advanced, when a variable is accessed, its value is printed. > Like the watch command in GDB. Look at the -fmudflap support. > Could some gurus give me some suggestions? Such as is there a project > aimed at this? How long/difficult > does it take if I make it from scratch? I don't know of anybody trying these ideas, because the result is going to run quite slowly. You might want to look into setting up a gdb stub as described in the gdb manual, and using the remote protocol. I've successfully used gdb on resource constrainted embedded systems that way. It's not easy to set up, but it's much much simpler than changing the compiler as you propose. Ian From iant@google.com Fri Mar 23 16:53:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Fri, 23 Mar 2007 16:53:00 -0000 Subject: need help for GCC--RTL In-Reply-To: <4603D278.8050205@gmx.net> References: <4603D278.8050205@gmx.net> Message-ID: Klaus Friedrich writes: > For my diploma thesis, i will work with the gcc4.1 internals. I would > like to extract information about the RTL > language. I search for a description of the virtual machine/virtual > processor on the RTL instruction set and for example the register > management/alignment. > > I can't find exakt information about the meaning for the RTL > constructs. For Example the meaning for this reg expression [D.1281] in > (reg:SI 58 [D.1281]) or the meaning for virtual-stack-vars in > (reg/f:SI 54 virtual-stack-vars). The [D.1281] refers to the variable associated with that register. In this case I can tell by the name that it is a GIMPLE temporary register. If you use -fdump-tree-final_cleanup and look in the dump file you will see the last GIMPLE code before the expansion into RTL. You should see D.1281 in that code. virtual-stack-vars is a pseudo register which points to the first local variable on the stack frame. It is only used for a little while, and is eliminated by pass_instantiate_virtual_regs. > I also information about the (clobber (reg:CC 17 flags)) expr. What do > the clobber function with the reg 17 ? What can I say: it clobbers it. See the RTL documentation. Ian From rodgexu@yahoo.com Fri Mar 23 16:58:00 2007 From: rodgexu@yahoo.com (Zhiyong Xu) Date: Fri, 23 Mar 2007 16:58:00 -0000 Subject: what's wrong with it? Message-ID: <249651.91455.qm@web31509.mail.mud.yahoo.com> t.c /* * Evaluate a function at three points, displaying results. */ void evaluate(double f(double f_arg), double pt1, double pt2, double pt3) { printf("f(%.5f) = %.5f\n", pt1, f(pt1)); printf("f(%.5f) = %.5f\n", pt2, f(pt2)); printf("f(%.5f) = %.5f\n", pt3, f(pt3)); } compile: $gcc -lm ex.c t.c $./a.out f(2.00000) = 0.90930 f(3.00000) = 0.14112 f(4.00000) = -0.75680 f(2.00000) = 1.41421 f(3.00000) = 1.73205 f(4.00000) = 2.00000 if change ex.c, add the prototype of function evaluate ex.c #include #include void evaluate(double f(double f_arg), double pt1, double pt2, double pt3); int main(void) { evaluate(sin, 2,3,4); evaluate(sqrt,2,3,4); return(0); } compile: $gcc -lm ex.c t.c $./a.out f(2.00000) = 0.90930 f(3.00000) = 0.14112 f(4.00000) = -0.75680 f(2.00000) = 1.41421 f(3.00000) = 1.73205 f(4.00000) = 2.00000 here's the description: 1. I have a function evaluate defined in t.c 2. in ex.c, I call function evaluate without prototype defined. using gcc -lm ex.c t.c, I can generate the executable file a.out, when executing, the result is wrong 3. if I modify ex.c, add the prototype definition, the result is correct. Anything wrong with the first case? ____________________________________________________________________________________ 8:00? 8:25? 8:40? Find a flick in no time with the Yahoo! Search movie showtime shortcut. http://tools.search.yahoo.com/shortcuts/#news From jeffreyholle@bellsouth.net Fri Mar 23 17:01:00 2007 From: jeffreyholle@bellsouth.net (Jeffrey Holle) Date: Fri, 23 Mar 2007 17:01:00 -0000 Subject: Starting programs How? In-Reply-To: <002301c76d58$8cbec290$4a4adf45@fastamd> References: <002301c76d58$8cbec290$4a4adf45@fastamd> Message-ID: RLB wrote: > Have been using VisualStudio ( 6 & 8) for several years. I > am not satisfied with the stuff that comes out of MSFT. > Boost; gcc compiler; cygwin; gimp; STAF; I recommend that you use bjam, the build system of boost. While I only use bjam on linux, I find it much more productive to use that a GUI. I too have spent years using Microsoft's Visual Studio products and found they were always a maintenance problem. Bjam is a make replacement that allows the programmer to operate at a higher level of abstraction than both make and Visual Studio. This hopefully will allow you to remain blissfully ignorant of your "cross compiler" tool chain. Look for example Jamfile in the boost directories. There is a separate mail list for bjam users, (gmane.comp.lib.boost.build) As for editors, I recommend investing in good one. Personally, I like the Visual Slick Editor. From iant@google.com Fri Mar 23 17:10:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Fri, 23 Mar 2007 17:10:00 -0000 Subject: wrong GCC-configuration? (./specs: Is a directory) In-Reply-To: <4603FD3F.5000600@blueSpirit.la> References: <4603FD3F.5000600@blueSpirit.la> Message-ID: Karl Krach writes: > What I figured out: My problem is that my GCC reads the specs from the > current directory (if available). This is not normal behaviour. There is something odd about your GCC. Or you've done something like set the environment variable GCC_EXEC_PREFIX to ".". Ian From aph@redhat.com Fri Mar 23 18:25:00 2007 From: aph@redhat.com (Andrew Haley) Date: Fri, 23 Mar 2007 18:25:00 -0000 Subject: what's wrong with it? In-Reply-To: <249651.91455.qm@web31509.mail.mud.yahoo.com> References: <249651.91455.qm@web31509.mail.mud.yahoo.com> Message-ID: <17924.2530.20574.526806@zebedee.pink> Zhiyong Xu writes: > > here's the description: > 1. I have a function evaluate defined in t.c > 2. in ex.c, I call function evaluate without prototype > defined. > using gcc -lm ex.c t.c, I can generate the executable > file a.out, > when executing, the result is wrong > 3. if I modify ex.c, add the prototype definition, the > result is correct. > > Anything wrong with the first case? Yes: int main(void) { evaluate(sin, 2.0,3.0,4.0); evaluate(sqrt,2.0,3.0,4.0); return(0); } But working without ptototypes is stupid and pointless. Don't do it. Andrew. From david@carter-hitchin.clara.co.uk Fri Mar 23 18:36:00 2007 From: david@carter-hitchin.clara.co.uk (DCH) Date: Fri, 23 Mar 2007 18:36:00 -0000 Subject: -fdump-tree-all documentation. In-Reply-To: <17911.51534.977035.359224@zebedee.pink> References: <3B4C77997DD0254B86D3C9454476B6BC0F03EC1D@lonms00812.fm.rbsgrp.net> <200703122349.l2CNnjOg000953@mx1.redhat.com> <17910.26477.347058.814071@zebedee.pink> <200703132042.l2DKg4P5026776@mx1.redhat.com> <17911.51534.977035.359224@zebedee.pink> Message-ID: Hi Andrew, >Oh, you mean the front end dump. Most of the dumps look like this: Ok... I had a look at the other dumps and can see things more clearly here. Each one of these is a tree node, and links are replaced by numbers of >the form @N. After that, it's just tree nodes. Most of the meaning >of these nodes is documented in gcc/tree.def, but a few nodes are >language-specific and are documented in the language front ends. Cheers, David. From david@carter-hitchin.clara.co.uk Fri Mar 23 18:47:00 2007 From: david@carter-hitchin.clara.co.uk (DCH) Date: Fri, 23 Mar 2007 18:47:00 -0000 Subject: Is there a way to pretty-print output for templates errors In-Reply-To: <20070322223321.B48706-200000@shannon.csl.cornell.edu> References: <4aca3dc20703220818l18fcf41eq9a31a5cd6eb74b3f@mail.gmail.com> <20070322223321.B48706-200000@shannon.csl.cornell.edu> Message-ID: STLfilt is pretty handy: http://www.bdsoft.com/tools/stlfilt.html I have to say that I found this amazing when I first started using the STL, but after a while I can just look at a long message and quite quickly get out of it the information I need to fix my code, without reaching for something like STLfilt. I'd only use it now, if I had absolutely no clue what was wrong with my code. Cheers, David At 03:44 23/03/2007, David Fang wrote: > > > Stephen Torri writes: > > > > > > > I have a hard time reading the template errors I get from GCC. I was > > > > wondering if there is a flag for the compiler so that instead > of getting > > > > output like below. I know I failed to present this snapshot in a > > > > preformatted output. This was deliberate to show how hard is to read > > > > this on a terminal window. > > > > > > Unfortunately there is no such option. > > > > BTW, i think the real readability improvement (besides obviously > > trying to use magic to make them shorter but understandable) would be > > had from making it visually clear where the word " to non-scalar type" > > starts. > > > > At least for me, half the time I spend trying to interpret the error > > is going through the 80 lines it spewed trying to find where the > > template it's complaining about ends and where the error it's actually > > complaining about begins. > > > > Some people find the STLFilt program to be helpful: > > > http://www.bdsoft.com/tools/stlfilt.html > >Hi all, > Years ago, I had similar gripes about reading template errors >arising from deeply nested templates and long chains of instantiations. >I put awk to work and wrote the attached makeshift filter >[balance_indent.awk] that expands templates arguments with tree-like >indenting and line-breaking. To use it, pipe the stderr of gcc/g++ >through "awk -f ". It's probably far from perfect, but it >sure took strain off of my eyes in identifying the precise problem. You >can customize the matching pattern at the end of the script. > To be honest, I haven't used the script in years, and the format >of the error messages may have changed slightly over the years. After >practice, one just sees through the falling glyphs... > >Hope it helps some. > >Fang > From rodgexu@yahoo.com Fri Mar 23 18:52:00 2007 From: rodgexu@yahoo.com (Zhiyong Xu) Date: Fri, 23 Mar 2007 18:52:00 -0000 Subject: what's wrong with it? In-Reply-To: <17924.2530.20574.526806@zebedee.pink> Message-ID: <471446.26019.qm@web31503.mail.mud.yahoo.com> I knew if I put real number parameters, it will work fine. I just want to know if I did not put function prototype, how system will deal with it, and why it generate this error. Could you please tell me? Thanks, --- Andrew Haley wrote: > Zhiyong Xu writes: > > > > > here's the description: > > 1. I have a function evaluate defined in t.c > > 2. in ex.c, I call function evaluate without > prototype > > defined. > > using gcc -lm ex.c t.c, I can generate the > executable > > file a.out, > > when executing, the result is wrong > > 3. if I modify ex.c, add the prototype > definition, the > > result is correct. > > > > Anything wrong with the first case? > > Yes: > > int main(void) > { > evaluate(sin, 2.0,3.0,4.0); > evaluate(sqrt,2.0,3.0,4.0); > > return(0); > } > > But working without ptototypes is stupid and > pointless. Don't do it. > > Andrew. > ____________________________________________________________________________________ Sucker-punch spam with award-winning protection. Try the free Yahoo! Mail Beta. http://advision.webevents.yahoo.com/mailbeta/features_spam.html From storri@torri.org Fri Mar 23 18:55:00 2007 From: storri@torri.org (Stephen Torri) Date: Fri, 23 Mar 2007 18:55:00 -0000 Subject: Is there a way to pretty-print output for templates errors In-Reply-To: <1174675003.3604.7.camel@localhost.localdomain> References: <4aca3dc20703220818l18fcf41eq9a31a5cd6eb74b3f@mail.gmail.com> <20070322223321.B48706-200000@shannon.csl.cornell.edu> <1174675003.3604.7.camel@localhost.localdomain> Message-ID: <1174675911.3604.8.camel@localhost.localdomain> On Fri, 2007-03-23 at 18:36 +0000, DCH wrote: > STLfilt is pretty handy: > > http://www.bdsoft.com/tools/stlfilt.html When I checked the faq it said that GCC 4.0 support was not implemented. Do you have different information? Stephen From aph@redhat.com Fri Mar 23 19:01:00 2007 From: aph@redhat.com (Andrew Haley) Date: Fri, 23 Mar 2007 19:01:00 -0000 Subject: what's wrong with it? In-Reply-To: <471446.26019.qm@web31503.mail.mud.yahoo.com> References: <17924.2530.20574.526806@zebedee.pink> <471446.26019.qm@web31503.mail.mud.yahoo.com> Message-ID: <17924.8827.817929.401614@zebedee.pink> Zhiyong Xu writes: > I knew if I put real number parameters, it will work fine. So you knew the answer already. > I just want to know if I did not put function prototype, how system > will deal with it, and why it generate this error. Because in the absence of a prototype, an int is passed to a function expecting a double. In the presence of a prototype, the ints are converted to doubles before being passed. > > But working without prototypes is stupid and > > pointless. Don't do it. Andrew. From david@carter-hitchin.clara.co.uk Fri Mar 23 20:23:00 2007 From: david@carter-hitchin.clara.co.uk (DCH) Date: Fri, 23 Mar 2007 20:23:00 -0000 Subject: Is there a way to pretty-print output for templates errors In-Reply-To: <1174675911.3604.8.camel@localhost.localdomain> References: <4aca3dc20703220818l18fcf41eq9a31a5cd6eb74b3f@mail.gmail.com> <20070322223321.B48706-200000@shannon.csl.cornell.edu> <1174675003.3604.7.camel@localhost.localdomain> <1174675911.3604.8.camel@localhost.localdomain> Message-ID: At 18:51 23/03/2007, Stephen Torri wrote: >On Fri, 2007-03-23 at 18:36 +0000, DCH wrote: > > STLfilt is pretty handy: > > > > http://www.bdsoft.com/tools/stlfilt.html > >When I checked the faq it said that GCC 4.0 support was not implemented. >Do you have different information? > >Stephen Apologies, I hadn't realised that time had moved on. IIRC it's written in perl which is pretty easy to understand and modify to suit ones needs. It's also a small script so it shouldn't take you too long to work through. There are also quite a few versions of it floating about - if you google enough, you might even find that someone has done the job for you. Cheers, David. From mailinglists@blueSpirit.la Fri Mar 23 20:28:00 2007 From: mailinglists@blueSpirit.la (Karl Krach) Date: Fri, 23 Mar 2007 20:28:00 -0000 Subject: wrong GCC-configuration? (./specs: Is a directory) In-Reply-To: References: <4603FD3F.5000600@blueSpirit.la> Message-ID: <46043721.7070705@blueSpirit.la> Ian Lance Taylor wrote: > Karl Krach writes: > >> What I figured out: My problem is that my GCC reads the specs from the >> current directory (if available). > > This is not normal behaviour. There is something odd about your GCC. > Or you've done something like set the environment variable > GCC_EXEC_PREFIX to ".". I've already checked all environment variables. There is only $GCC_SPECS and it's empty. But this variable (if empty) has no effect to GCC's behavior. > > Ian > And yes, I'm also sure that it's not the normal behavior. But I've no idea which parameters to change. Thanks, Charly From tprince@myrealbox.com Fri Mar 23 20:29:00 2007 From: tprince@myrealbox.com (Timothy C Prince) Date: Fri, 23 Mar 2007 20:29:00 -0000 Subject: Installing gcc in a local directory Message-ID: <1174681727.c7de34bctprince@myrealbox.com> -----Original Message----- From: Jose Luis Garc?a Pallero To: Date: Fri, 23 Mar 2007 14:15:15 +0100 Subject: Installing gcc in a local directory Hi, Only LD_LIBRARY_PATH=/home/user/gcc-4.2.0/lib:$LD_LIBRARY_PATH? What about include files? For example, if I want to compile a tipycal hello world program in C, what stdio.h use the compiler, the new 4.2.0 or the old 4.1.2? If I want to compile a program with gcc-4.1.2 instead of 4.2.0, what about the new LD_LIBRARY_PATH=/home/user/gcc-4.2.0/lib:$LD_LIBRARY_PATH order? Need add LD_LIBRARY_PATH=/home/user/gcc-4.2.0/lib:$LD_LIBRARY_PATH order if I compile, for example, gcc/g77 too? ___________________________________________ You can check by gcc -v and gcc -print-search-dirs to see that the compiler is correctly using its own paths for its include files. Tim Prince From brendon@christian.net Fri Mar 23 20:31:00 2007 From: brendon@christian.net (Brendon Costa) Date: Fri, 23 Mar 2007 20:31:00 -0000 Subject: Installing gcc in a local directory In-Reply-To: References: Message-ID: <46043885.8030509@christian.net> Jose Luis Garc??a Pallero wrote: > Hi, > Only LD_LIBRARY_PATH=/home/user/gcc-4.2.0/lib:$LD_LIBRARY_PATH? > What about include files? For example, if I want to compile a tipycal hello world program in C, what stdio.h use the compiler, the new 4.2.0 or the old 4.1.2? If I want to compile a program with gcc-4.1.2 instead of 4.2.0, what about the new LD_LIBRARY_PATH=/home/user/gcc-4.2.0/lib:$LD_LIBRARY_PATH order? > Need add LD_LIBRARY_PATH=/home/user/gcc-4.2.0/lib:$LD_LIBRARY_PATH order if I compile, for example, gcc/g77 too? > I just asked almost the same question in another thread: "Two Versions of GCC" I am doing the PATH export and the LD_LIBRARY_PATH export, however upon linking some things i get link errors because it is trying to link using the old system installed GCC libstdc++ libraries, not the ones in my home directory. I dont see why thought because the link command looks like: g++ -g -O2 -o .libs/library_user library_user-main.o .libs/library_userS.o -L/home/bcosta/build/edoc/gcc-4.0.1/i386-unknown-netbsdelf3.0/libstdc++-v3/src -L/home/bcosta/build/edoc/gcc-4.0.1/i386-unknown-netbsdelf3.0/libstdc++-v3/src/.libs -L/home/bcosta/build/edoc/gcc-4.0.1/gcc ../../../src/plugins/myplugin/.libs/myplugin.a /home/bcosta/build/example/src/libs/mystatic/.libs/libmystatic.a -lm ../../../src/libs/myshared/.libs/libmyshared.so ../../../src/libs/mystatic/.libs/libmystatic.a /home/bcosta/build/install/edoc_gcc/lib/libstdc++.so ../../../libltdl/.libs/libltdlc.a -Wl,--rpath -Wl,/home/bcosta/build/install_example/lib -Wl,--rpath -Wl,/home/bcosta/build/install/edoc_gcc/lib Notice the: /home/bcosta/build/install/edoc_gcc/lib/libstdc++.so line which says its linking the libstdc++ from the home directory NOT the user one. For some reason, libstdc++ from /usr/lib is being used instead... Or so it seems. The other thread has more details. Any thoughts? Just as an additional note to the original question, i dont know if it is necessary but my configuration options include: --with-local-prefix=/home/user/gcc-4.2.0 as well as the standard --prefix. I dont remember where i got this from as i have been doing it for a while now. Brendon. From iant@google.com Fri Mar 23 20:46:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Fri, 23 Mar 2007 20:46:00 -0000 Subject: wrong GCC-configuration? (./specs: Is a directory) In-Reply-To: <46043721.7070705@blueSpirit.la> References: <4603FD3F.5000600@blueSpirit.la> <46043721.7070705@blueSpirit.la> Message-ID: Karl Krach writes: > Ian Lance Taylor wrote: > > Karl Krach writes: > > > >> What I figured out: My problem is that my GCC reads the specs from the > >> current directory (if available). > > This is not normal behaviour. There is something odd about your GCC. > > Or you've done something like set the environment variable > > GCC_EXEC_PREFIX to ".". > > I've already checked all environment variables. There is only > $GCC_SPECS and it's empty. But this variable (if empty) has no effect > to GCC's behavior. GCC_SPECS does nothing with standard gcc. > And yes, I'm also sure that it's not the normal behavior. But I've no > idea which parameters to change. I think you must be using patched source code. I have no other way of explaining what you are seeing. Well, maybe you configured gcc with "--prefix=." but that would probably cause other problems. Ian From mohsen@pahlevanzadeh.org Fri Mar 23 21:06:00 2007 From: mohsen@pahlevanzadeh.org (Mohsen Pahlevanzadeh) Date: Fri, 23 Mar 2007 21:06:00 -0000 Subject: pthread & its bug Message-ID: <46046D9B.7030607@pahlevanzadeh.org> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Dear all, I'm newbie in multithread programming.I'm practicing that.Now i have written following code : My code : #include #include #include int g1=0; int g2=0; void task1(int *counter); void task2(int *counter); int main(int argc,char *argv[]) { pthread_t *thr1,*thr2; int ret; if ((ret = pthread_create(&thr1,NULL,(void *)task1,(void *)&g1))) { perror("pthread_create : task1"); exit(EXIT_FAILURE); } if ((ret = pthread_create(&thr2,NULL,(void *)task2,(void *)&g2))) { perror("pthread_create : task2"); exit(EXIT_FAILURE); } pthread_join(thr2,NULL); pthread_join(thr1,NULL); cleanup(g1,g2); exit(EXIT_SUCCESS); }//end of main program void task1(int *counter) { while(*counter < 5 ){ printf("task1 count: %d\n",*counter); (*counter)++; }//end of while }//end of task1 function void task2(int *counter) { while(*counter < 5 ){ printf("task2 count: %d\n",*counter); (*counter)++; }//end of while }//end of task1 function void cleanup(int counter1,int counter2) { printf("Total iterations: %d\n",counter1+counter2); }//end of cleanup function ///////////////////////////END OF CODE//////////////////////////////////////////////////////// Now when i compile it, I receive following errors: mohsen@debian:~/test/learning/pthread$ make gcc -c test.c In file included from test.c:3: /usr/include/pthread.h:285: error: conflicting types for ???pthread_t??? /usr/include/bits/pthreadtypes.h:152: error: previous declaration of ???pthread_t??? was here /usr/include/pthread.h:286: error: conflicting types for ???pthread_attr_t??? /usr/include/bits/pthreadtypes.h:54: error: previous declaration of ???pthread_attr_t??? was here /usr/include/pthread.h:287: error: conflicting types for ???pthread_key_t??? /usr/include/bits/pthreadtypes.h:82: error: previous declaration of ???pthread_key_t??? was here /usr/include/pthread.h:289: error: conflicting types for ???pthread_mutexattr_t??? /usr/include/bits/pthreadtypes.h:102: error: previous declaration of ???pthread_mutexattr_t??? was here /usr/include/pthread.h:290: error: conflicting types for ???pthread_mutex_t??? /usr/include/bits/pthreadtypes.h:95: error: previous declaration of ???pthread_mutex_t??? was here /usr/include/pthread.h:291: error: conflicting types for ???pthread_condattr_t??? /usr/include/bits/pthreadtypes.h:79: error: previous declaration of ???pthread_condattr_t??? was here /usr/include/pthread.h:292: error: conflicting types for ???pthread_cond_t??? /usr/include/bits/pthreadtypes.h:72: error: previous declaration of ???pthread_cond_t??? was here test.c: In function ???main???: test.c:13: warning: passing argument 1 of ???pthread_create??? from incompatible pointer type test.c:19: warning: passing argument 1 of ???pthread_create??? from incompatible pointer type test.c:26: warning: passing argument 1 of ???pthread_join??? from incompatible pointer type test.c:27: warning: passing argument 1 of ???pthread_join??? from incompatible pointer type test.c: At top level: test.c:48: warning: conflicting types for ???cleanup??? test.c:29: warning: previous implicit declaration of ???cleanup??? was here make: *** [main.o] Error 1 mohsen@debian:~/test/learning/pthread$ ////////////////////////////////////// I have retrieved libdir & includedir with pthread_config command. Please help me ..... Yours,Mohsen -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGBG2a/ZBAvBh9bHIRArwvAJ429vihIW7mqsNq4U76vrzCHi7zcwCbBpC3 O07y29P5zpUjfirZOV1vbBk= =5N0e -----END PGP SIGNATURE----- From eljay@adobe.com Fri Mar 23 21:21:00 2007 From: eljay@adobe.com (John (Eljay) Love-Jensen) Date: Fri, 23 Mar 2007 21:21:00 -0000 Subject: pthread & its bug References: <46046D9B.7030607@pahlevanzadeh.org> Message-ID: Hi Mohsen, Your inquiry is off topic for this forum. I do not say this to chastize you. I say it because you may get better / faster / more accurate information from a more appropriate forum that is pthread savvy. There are a whole bunch of errors in your test source code. For example, the pthread_create's third parameter takes a function pointer to a function that looks like: void* task(void* ptr); You are passing in a function pointer to a function that looks like: void task(int* counter); And you are casting the function pointer to a data pointer: (void*)task1 That doesn't fit. Another example, pthread_create's first parameter takes a pointer to a pthread_t. You are passing in a poiter to a pointer to a pthread_t. (And that pointer-to-a-pointer has not been allocated anywhere.) That doesn't fit. Work through all the mismatched data types, and then see where things end up. GCC helps you, by emitting a lot of warnings and errors. Heed them. Don't forget to: gcc test.c -lpthread HTH, --Eljay From bjensen@fastmail.fm Fri Mar 23 22:57:00 2007 From: bjensen@fastmail.fm (bjorn rohde jensen) Date: Fri, 23 Mar 2007 22:57:00 -0000 Subject: pthread & its bug In-Reply-To: References: <46046D9B.7030607@pahlevanzadeh.org> Message-ID: <460444B8.4020003@fastmail.fm> John (Eljay) Love-Jensen wrote: > Hi Mohsen, > > Your inquiry is off topic for this forum. I do not say this to chastize you. I say it because you may get better / faster / more accurate information from a more appropriate forum that is pthread savvy. > > There are a whole bunch of errors in your test source code. > > For example, the pthread_create's third parameter takes a function pointer to a function that looks like: > > void* task(void* ptr); > > You are passing in a function pointer to a function that looks like: > > void task(int* counter); > > And you are casting the function pointer to a data pointer: > > (void*)task1 > > That doesn't fit. > > Another example, pthread_create's first parameter takes a pointer to a pthread_t. You are passing in a poiter to a pointer to a pthread_t. (And that pointer-to-a-pointer has not been allocated anywhere.) > > That doesn't fit. > > Work through all the mismatched data types, and then see where things end up. GCC helps you, by emitting a lot of warnings and errors. Heed them. > > Don't forget to: > > gcc test.c -lpthread > > HTH, > --Eljay You might want to define your task functions to have the type expected by phtread_create instead of casting them, something like; void *task1(void *p) { int *counter=(int *)p; while(*counter < 5 ){ printf("task1 count: %d\n",*counter); (*counter)++; } return NULL; } The type system is there to help you, dont cast things unless you really need to. From rbaverst@engmail.uwaterloo.ca Fri Mar 23 23:01:00 2007 From: rbaverst@engmail.uwaterloo.ca (Richard Baverstock) Date: Fri, 23 Mar 2007 23:01:00 -0000 Subject: Forcing use of move instead of movem on M68k (5200/5307) In-Reply-To: References: <9D2873BB-D515-48E4-8DE5-69C17EB89470@engmail.uwaterloo.ca> Message-ID: <5333517B-B1DB-4C16-8831-19B245B26426@engmail.uwaterloo.ca> We're using 2.95.3 and 3.4.6 (tried both versions), so nothing really recent. Trying the most recent one (4.1.2) would be a better idea? Or would a more recent version of the 3.x series be better? Thanks, Richard On Mar 23, 2007, at 12:15 PM, Ian Lance Taylor wrote: > Richard Baverstock writes: > >> We're having an issue with movem on the coldfire boards we are >> compiling a program for, and wondering if we can force the m68k gcc >> compiler to use move instead of movem. movem does not appear to be >> working on whatever chip variant we have, which severely affects >> returning from functions. Using the coldfire 5307, tried compiling >> with -m5200 and -m5307, both use movem. > > Unfortunately there is no option to disable movem. You would have to > change the compiler source code. > > The ColdFire does support movem, although it doesn't support all > variants. You didn't mention which version of gcc you are using. > There have been improvements to the ColdFire support in recent > releases. > > Ian From iant@google.com Sat Mar 24 08:30:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Sat, 24 Mar 2007 08:30:00 -0000 Subject: Forcing use of move instead of movem on M68k (5200/5307) In-Reply-To: <5333517B-B1DB-4C16-8831-19B245B26426@engmail.uwaterloo.ca> References: <9D2873BB-D515-48E4-8DE5-69C17EB89470@engmail.uwaterloo.ca> <5333517B-B1DB-4C16-8831-19B245B26426@engmail.uwaterloo.ca> Message-ID: Richard Baverstock writes: > We're using 2.95.3 and 3.4.6 (tried both versions), so nothing really > recent. > > Trying the most recent one (4.1.2) would be a better idea? Or would a > more recent version of the 3.x series be better? Certainly the support for ColdFire has improved in 4.1.2. I don't know whether this specific problem has been fixed. Ian From olecom@flower.upol.cz Sat Mar 24 09:51:00 2007 From: olecom@flower.upol.cz (Oleg Verych) Date: Sat, 24 Mar 2007 09:51:00 -0000 Subject: Optimisation puzzle References: <45FA852C.1090904@home.se> Message-ID: > From: me > Newsgroups: gmane.comp.gcc.help > Subject: Re: Optimisation puzzle > Date: Wed, 21 Mar 2007 05:24:15 +0100 [] > Maybe this somehow linked to the fact, that parameter by value are always > copied and there's no way for caller to know about what happened to that > *copy*. E.g. "void q(const unsigned int b);" means b is read-only inside q, > but any caller sets up b for q, i.e it create/change it. Similar to semantics, described here: > q: _mtune=k8_ q: _mtune=nocona_ > ..LFB2: .LFB2: > mov %edi, %edi *NOTE* movsd a(%rip), %xmm1 > movlpd a(%rip), %xmm1 mov %edi, %edi *NOTE* This ones are still a puzzle (or need rtfm :)... _____ From lynx.abraxas@freenet.de Sat Mar 24 11:12:00 2007 From: lynx.abraxas@freenet.de (lynx.abraxas@freenet.de) Date: Sat, 24 Mar 2007 11:12:00 -0000 Subject: inline asm: How to push PIC reg before seven input operands get loaded? Message-ID: <20070324095148.GB1837@drago.uni-regensburg.de> Hallo! I got a bit further with my problem. Now I'm stuck on how to save the register used when -fPIC is enabled to the stack before my seven input operands, needing all registers, get loaded. Is that somehow possible? I couldn't find any examples on the net. It seems not to be necessary in the original code for MSC. Also I wonder which -f option that comes with -O2 makes gcc stop reporting: error: can't find a register in class 'LEGACY_REGS' while reloading 'asm' Thanks. Lynx From aph@redhat.com Sat Mar 24 12:23:00 2007 From: aph@redhat.com (Andrew Haley) Date: Sat, 24 Mar 2007 12:23:00 -0000 Subject: inline asm: How to push PIC reg before seven input operands get loaded? In-Reply-To: <20070324095148.GB1837@drago.uni-regensburg.de> References: <20070324095148.GB1837@drago.uni-regensburg.de> Message-ID: <17925.1912.101064.171511@zebedee.pink> lynx.abraxas@freenet.de writes: > > I got a bit further with my problem. Now I'm stuck on how to save > the register used when -fPIC is enabled to the stack before my > seven input operands, needing all registers, get loaded. Is that > somehow possible? I couldn't find any examples on the net. It seems > not to be necessary in the original code for MSC. I doubt very much thath is possible. > Also I wonder which -f option that comes with -O2 makes gcc stop reporting: > error: can't find a register in class 'LEGACY_REGS' while reloading 'asm' I guess this is a joke. Andrew. From lynx.abraxas@freenet.de Sat Mar 24 14:58:00 2007 From: lynx.abraxas@freenet.de (lynx.abraxas@freenet.de) Date: Sat, 24 Mar 2007 14:58:00 -0000 Subject: inline asm: How to push PIC reg before seven input operands get loaded? In-Reply-To: <17925.1912.101064.171511@zebedee.pink> References: <20070324095148.GB1837@drago.uni-regensburg.de> <17925.1912.101064.171511@zebedee.pink> Message-ID: <20070324122324.GA3154@drago.uni-regensburg.de> On 24/03/07 11:11:52, Andrew Haley wrote: > > I got a bit further with my problem. Now I'm stuck on how to save > > the register used when -fPIC is enabled to the stack before my > > seven input operands, needing all registers, get loaded. Is that > > somehow possible? I couldn't find any examples on the net. It seems > > not to be necessary in the original code for MSC. > > I doubt very much thath is possible. Thanks for Your answer. I then wonder why gcc doesn't let me load the registers from the memory myself. If I do eg: Pixel16 *tileData[4]; uint16 *pDestPixel; Pixel16 *dataPtr, *transDataPtr; sint32 startX, endX; __asm__ __volatile__ ( "push %%ebx \n\t" // save reg for PIC! //code here using %1 but now reg can be rused: "movl %5, %1 \n\t" //no reg left for %5 when gcc should handel it //but now gcc says: //error: memory input 5 is not directly addressable "movl (%1,%%ebx,4), %1 \n\t" //instead of "movl (%5,%%ebx,4), %1 \n\t" //because m for %5 didn't work here //more code using also ebx and ebp "pop %%ebx \n\t" // restore reg for PIC! : : "D" (pDestPixel), "d" (endX), "c" (startX), "a" (transDataPtr), "S" (dataPtr), "m" (tileData) : "cc" //don't tell gcc about what was done to ebx because of PIC!!! ); gcc complains about: error: memory input 5 is not directly addressable Why is that? How else should I load the tileData pointer from memory into a register? > > Also I wonder which -f option that comes with -O2 makes gcc stop reporting: > > error: can't find a register in class 'LEGACY_REGS' while reloading 'asm' > > I guess this is a joke. No, it isn't. I wouldn't have asked else wise... Is it the combination of all -f options in -O2? I coudn't find a single obviouse one in the manpage. Is it a rule then to include -O2 or higher if inline asm is used??? > > Andrew. Thanks Andrew. Lynx From tprince@myrealbox.com Sat Mar 24 18:17:00 2007 From: tprince@myrealbox.com (Timothy C Prince) Date: Sat, 24 Mar 2007 18:17:00 -0000 Subject: installing gcc4.1.2 Message-ID: <1174748293.c7c91b9ctprince@myrealbox.com> -----Original Message----- From: "Annapoorna R" To: gcc-help@gcc.gnu.org Date: Fri, 23 Mar 2007 14:08:48 +0530 Subject: installing gcc4.1.2 ..-- should i do configure for both core and java seperately? ______________________________________ configure flag ---enable-languages='c,java' should accomplish it _____________________________________ -- confused with srcdir and objdir what you have mentioned. - does objdir means the dir where i want to install it? and srcdir is the dir where it got extracted. _____________________________________________ You must configure and build in a directory (objdir) separate from the source and install paths. Tim Prince From aph@redhat.com Sat Mar 24 19:21:00 2007 From: aph@redhat.com (Andrew Haley) Date: Sat, 24 Mar 2007 19:21:00 -0000 Subject: inline asm: How to push PIC reg before seven input operands get loaded? In-Reply-To: <20070324122324.GA3154@drago.uni-regensburg.de> References: <20070324095148.GB1837@drago.uni-regensburg.de> <17925.1912.101064.171511@zebedee.pink> <20070324122324.GA3154@drago.uni-regensburg.de> Message-ID: <17925.27411.531144.236075@zebedee.pink> lynx.abraxas@freenet.de writes: > On 24/03/07 11:11:52, Andrew Haley wrote: > > > I got a bit further with my problem. Now I'm stuck on how to save > > > the register used when -fPIC is enabled to the stack before my > > > seven input operands, needing all registers, get loaded. Is that > > > somehow possible? I couldn't find any examples on the net. It seems > > > not to be necessary in the original code for MSC. > > > > I doubt very much thath is possible. > > Thanks for Your answer. I then wonder why gcc doesn't let me load > the registers from the memory myself. > If I do eg: > > Pixel16 *tileData[4]; uint16 *pDestPixel; Pixel16 *dataPtr, *transDataPtr; > sint32 startX, endX; > __asm__ __volatile__ ( > "push %%ebx \n\t" // save reg for PIC! > //code here using %1 but now reg can be rused: > > "movl %5, %1 \n\t" //no reg left for %5 when gcc should handel it > //but now gcc says: > //error: memory input 5 is not directly addressable > "movl (%1,%%ebx,4), %1 \n\t" //instead of "movl (%5,%%ebx,4), %1 \n\t" > //because m for %5 didn't work here > > //more code using also ebx and ebp > "pop %%ebx \n\t" // restore reg for PIC! > : > : "D" (pDestPixel), "d" (endX), "c" (startX), "a" (transDataPtr), "S" (dataPtr), "m" (tileData) > : "cc" //don't tell gcc about what was done to ebx because of PIC!!! > ); > > gcc complains about: error: memory input 5 is not directly addressable > Why is that? How else should I load the tileData pointer from > memory into a register? I wouldn't be using the "m" constraint for this. Pass in the pointer as an operand using constraint "r" or "g". Something like "g"(&tileData); Can you post some small sample code? Make it the shortest possible programs that shows your problem. Make sure all the types it needs are defined. > > > Also I wonder which -f option that comes with -O2 makes gcc stop reporting: > > > error: can't find a register in class 'LEGACY_REGS' while reloading 'asm' > > > > I guess this is a joke. > > No, it isn't. I wouldn't have asked else wise... Reload has run out of registers. It's telling you that it needs another one. A -f option is not going to give reload another register. > Is it the combination of all -f options in -O2? I coudn't find a > single obviouse one in the manpage. Is it a rule then to include > -O2 or higher if inline asm is used??? No, there's no such rule. You've run out of registers. gcc needs one or two spare registers to work with. The x86 has eight, some of which are used for special purposes. You are using five in your asm. This is a very tight situation. Andrew. From lynx.abraxas@freenet.de Sat Mar 24 20:28:00 2007 From: lynx.abraxas@freenet.de (lynx.abraxas@freenet.de) Date: Sat, 24 Mar 2007 20:28:00 -0000 Subject: inline asm: How to push PIC reg before seven input operands get loaded? In-Reply-To: <17925.27411.531144.236075@zebedee.pink> References: <20070324095148.GB1837@drago.uni-regensburg.de> <17925.1912.101064.171511@zebedee.pink> <20070324122324.GA3154@drago.uni-regensburg.de> <17925.27411.531144.236075@zebedee.pink> Message-ID: <20070324192056.GA1938@drago.uni-regensburg.de> On 24/03/07 18:16:51, Andrew Haley wrote: > > If I do eg: > > > > Pixel16 *tileData[4]; uint16 *pDestPixel; Pixel16 *dataPtr, *transDataPtr; > > sint32 startX, endX; > > __asm__ __volatile__ ( > > "push %%ebx \n\t" // save reg for PIC! > > //code here using %1 but now reg can be rused: > > > > "movl %5, %1 \n\t" //no reg left for %5 when gcc should handel it > > //but now gcc says: > > //error: memory input 5 is not directly addressable > > "movl (%1,%%ebx,4), %1 \n\t" //instead of "movl (%5,%%ebx,4), %1 \n\t" > > //because m for %5 didn't work here > > > > //more code using also ebx and ebp > > "pop %%ebx \n\t" // restore reg for PIC! > > : > > : "D" (pDestPixel), "d" (endX), "c" (startX), "a" (transDataPtr), "S" (dataPtr), "m" (tileData) > > > : "cc" //don't tell gcc about what was done to ebx because of PIC!!! > > ); > > > > gcc complains about: error: memory input 5 is not directly addressable > > > Why is that? How else should I load the tileData pointer from > > memory into a register? > > I wouldn't be using the "m" constraint for this. Pass in the pointer > as an operand using constraint "r" or "g". Something like "g"(&tileData); > > Can you post some small sample code? Make it the shortest possible > programs that shows your problem. Make sure all the types it needs > are defined. This is a problem. My task is to tranlate this inline asm written for MSC to gcc. It's from a big game (Call to Power II, CTP2). I've attached a file with the function that contains the code. But it won't compile withou a lot modifications outside the source tree. At L131 my translation starts. It has the constrains I got it to compile with but segfaults then. I noticed that using any other var than tileData works with "m". Could it be a problem for gcc to use the double pointer here: Pixel16 **tileData ? > > > > > Also I wonder which -f option that comes with -O2 makes gcc stop reporting: > > > > error: can't find a register in class 'LEGACY_REGS' while reloading 'asm' > > > > > > I guess this is a joke. > > > > No, it isn't. I wouldn't have asked else wise... > > Reload has run out of registers. It's telling you that it needs > another one. A -f option is not going to give reload another > register. The point is, if I just add -O2 to the g++ cammand, this error disappears without having changed anything in the code or the number of register the part uses. It seems that an option in -O2 or above lets g++ be able to cope with the registers I have left it (ebx and ebp, esp). I found this solution quite often on the net. > > > Is it the combination of all -f options in -O2? I coudn't find a > > single obviouse one in the manpage. Is it a rule then to include > > -O2 or higher if inline asm is used??? > > No, there's no such rule. You've run out of registers. > > gcc needs one or two spare registers to work with. The x86 has eight, > some of which are used for special purposes. You are using five in > your asm. This is a very tight situation. Compiling all this with -fomit-frame-pointer: Can gcc not push all registers, and give me all seven without esp? I also tryed to use "R" instead of "m" for tileData. It compiled without errors even when I had specified -fPIC. -fPIC seems to use ebx so I pushed and poped that in my asm code. But when looking at the disassembly I had to see gcc used ebx for tileData and not ebp. But if I specified "b" it complains about: error: PIC register %ebx clobbered in asm Is this a bug in gcc??? Is there a constraint just for ebp so I don't have to use "R" and hope it gets into ebp? > > Andrew. Thanks Andrew Lynx -------------- next part -------------- compiled with: g++ -DHAVE_CONFIG_H -I. -I. -I../../../ctp2_code/os/include -I../../../ctp2_code/os/nowin32 -I../../../ctp2_code -I../../.. -I../../../ctp2_code/os/include -I../../../ctp2_code/ctp -I../../../ctp2_code/ctp/ctp2_utils -I../../../ctp2_code/ctp/ctp2_rsrc -I../../../ctp2_code/ctp/debugtools -I../../../ctp2_code/ui/interface -I../../../ctp2_code/ui/netshell -I../../../ctp2_code/robot/utility -I../../../ctp2_code/robot/pathing -I../../../ctp2_code/robot/aibackdoor -I../../../ctp2_code/gfx/spritesys -I../../../ctp2_code/gfx/tilesys -I../../../ctp2_code/gfx/gfx_utils -I../../../ctp2_code/gs/database -I../../../ctp2_code/gs/fileio -I../../../ctp2_code/gs/gameobj -I../../../ctp2_code/gs/utility -I../../../ctp2_code/gs/world -I../../../ctp2_code/net/io -I../../../ctp2_code/net/general -I../../../ctp2_code/ui/aui_utils -I../../../ctp2_code/ui/aui_sdl -I../../../ctp2_code/ui/aui_directx -I../../../ctp2_code/ui/aui_ctp2 -I../../../ctp2_code/ui/aui_common -I../../../ctp2_code/libs/anet/h -I../../../ctp2_code/mm -I../../../ctp2_code/robotcom/backdoor -I../../../ctp2_code/gs/slic -I../../../ctp2_code/gs/slic -I../../../ctp2_code/gfx/layers -I../../../ctp2_code/mapgen -I../../../ctp2_code/ui/freetype -I../../../ctp2_code/sound -I../../../ctp2_code/GameWatch/gamewatch -I../../../ctp2_code/GameWatch/gwciv -I../../../ctp2_code/ctp/fingerprint -I../../../ctp2_code/ui/slic_debug -I../../../ctp2_code/gs/outcom -I../../../ctp2_code/ctp -I../../../ctp2_code/ui/aui_common -I../../../ctp2_code/ui/ldl -I../../../ctp2_code/ui/ldl -I../../../ctp2_code/gs/events -I../../../ctp2_code/gs/newdb -I../../../ctp2_code/gs/newdb -I../../../ctp2_code/ai/diplomacy -I../../../ctp2_code/ai/mapanalysis -I../../../ctp2_code/ai/strategy/scheduler -I../../../ctp2_code/ai/strategy/agents -I../../../ctp2_code/ai/strategy/goals -I../../../ctp2_code/ai/strategy/squads -I../../../ctp2_code/ai -I../../../ctp2_code/ai/CityManagement -I/usr/local/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/X11R6/include -Wall -Wno-unused-variable -fms-extensions -fmessage-length=0 -frtti -fexceptions -g -O2 -fomit-frame-pointer -MT tiledraw.lo -MD -MP -MF .deps/tiledraw.Tpo -c tiledraw.cpp -fPIC -DPIC -fleading-underscore -o .libs/tiledraw.o void TiledMap::DrawTransitionTileScaled(aui_Surface *surface, const MapPoint &pos, sint32 x, sint32 y, sint32 destWidth, sint32 destHeight) { Pixel16 *dataPtr; sint32 x, y; sint32 startX, endX; TileInfo *tileInfo; BaseTile *baseTile, *transitionBuffer; uint16 index; Pixel16 *transData, *transDataPtr; static Pixel16 defaultPixel[4] = {0xf800, 0x07e0, 0x001f, 0xf81f}; if (!surface) surface = m_surface; ypos+=k_TILE_PIXEL_HEADROOM; if (xpos < 0) return; if (xpos > surface->Width() - k_TILE_PIXEL_WIDTH) return; if (ypos < 0) return; if (ypos > surface->Height() - k_TILE_PIXEL_HEIGHT) return; tileInfo = GetTileInfo(pos); Assert(tileInfo != NULL); if (tileInfo == NULL) return; index = tileInfo->GetTileNum(); baseTile = m_tileSet->GetBaseTile(index); if (baseTile == NULL) return; Pixel16 *data = baseTile->GetTileData(); Pixel16 *tileData[4]; sint32 tilesetIndex = g_theTerrainDB->Get(tileInfo->GetTerrainType())->GetTilesetIndex(); uint16 tilesetIndex_short = (uint16) tilesetIndex; #ifdef _DEBUG Assert(tilesetIndex == ((sint32) tilesetIndex_short)); #endif tileData[0] = m_tileSet->GetTransitionData(tilesetIndex_short, tileInfo->GetTransition(0), 0); tileData[1] = m_tileSet->GetTransitionData(tilesetIndex_short, tileInfo->GetTransition(1), 1); tileData[2] = m_tileSet->GetTransitionData(tilesetIndex_short, tileInfo->GetTransition(2), 2); tileData[3] = m_tileSet->GetTransitionData(tilesetIndex_short, tileInfo->GetTransition(3), 3); transitionBuffer = m_tileSet->GetBaseTile(static_cast((tilesetIndex * 100) + 99)); if(transitionBuffer) { transData = transitionBuffer->GetTileData(); transDataPtr = transData; } else { transData = NULL; transDataPtr = NULL; } dataPtr = data; uint8 *pSurfBase; pSurfBase = m_surfBase; sint32 surfWidth = m_surfWidth; sint32 surfHeight = m_surfHeight; sint32 surfPitch = m_surfPitch; Pixel16 srcPixel, transPixel = 0; uint16 *pDestPixel = (Pixel16 *)(pSurfBase + ypos * surfPitch + 2 * xpos); { for (y=0; y>1); } } } From tprince@myrealbox.com Sat Mar 24 20:42:00 2007 From: tprince@myrealbox.com (Timothy C Prince) Date: Sat, 24 Mar 2007 20:42:00 -0000 Subject: inline asm: How to push PIC reg before seven input operands get loaded? Message-ID: <1174768131.c7c2e05ctprince@myrealbox.com> -----Original Message----- From: lynx.abraxas@freenet.de To: gcc-help@gcc.gnu.org, Andrew Haley Date: Sat, 24 Mar 2007 20:20:56 +0100 Subject: Re: inline asm: How to push PIC reg before seven input operands get loaded? This is a problem. My task is to tranlate this inline asm written for MSC to gcc. It's from a big game (Call to Power II, CTP2). I've attached a file with the function that contains the code. But it won't compile withou a lot modifications outside the source tree. ________________________________________ Commercial compilers, including icc, have options to accept MS asm and compile for linux. If you're going to spend time on source translation, you'd likely get better results with C. Tim Prince From aph@redhat.com Sat Mar 24 22:15:00 2007 From: aph@redhat.com (Andrew Haley) Date: Sat, 24 Mar 2007 22:15:00 -0000 Subject: inline asm: How to push PIC reg before seven input operands get loaded? In-Reply-To: <20070324192056.GA1938@drago.uni-regensburg.de> References: <20070324095148.GB1837@drago.uni-regensburg.de> <17925.1912.101064.171511@zebedee.pink> <20070324122324.GA3154@drago.uni-regensburg.de> <17925.27411.531144.236075@zebedee.pink> <20070324192056.GA1938@drago.uni-regensburg.de> Message-ID: <17925.36122.323917.231376@zebedee.pink> lynx.abraxas@freenet.de writes: > On 24/03/07 18:16:51, Andrew Haley wrote: > > > If I do eg: > > > > > > Pixel16 *tileData[4]; uint16 *pDestPixel; Pixel16 *dataPtr, *transDataPtr; > > > sint32 startX, endX; > > > __asm__ __volatile__ ( > > > "push %%ebx \n\t" // save reg for PIC! > > > //code here using %1 but now reg can be rused: > > > > > > "movl %5, %1 \n\t" //no reg left for %5 when gcc should handel it > > > //but now gcc says: > > > //error: memory input 5 is not directly addressable > > > "movl (%1,%%ebx,4), %1 \n\t" //instead of "movl (%5,%%ebx,4), %1 \n\t" > > > //because m for %5 didn't work here > > > > > > //more code using also ebx and ebp > > > "pop %%ebx \n\t" // restore reg for PIC! > > > : > > > : "D" (pDestPixel), "d" (endX), "c" (startX), "a" (transDataPtr), "S" (dataPtr), "m" (tileData) > > > > > : "cc" //don't tell gcc about what was done to ebx because of PIC!!! > > > ); > > > > > > gcc complains about: error: memory input 5 is not directly addressable > > > > > Why is that? How else should I load the tileData pointer from > > > memory into a register? > > > > I wouldn't be using the "m" constraint for this. Pass in the pointer > > as an operand using constraint "r" or "g". Something like "g"(&tileData); > > > > Can you post some small sample code? Make it the shortest possible > > programs that shows your problem. Make sure all the types it needs > > are defined. > > This is a problem. My task is to tranlate this inline asm written for MSC to > gcc. It's from a big game (Call to Power II, CTP2). I've attached a file with > the function that contains the code. But it won't compile withou a lot > modifications outside the source tree. And you can't figure out how to provide the typedefs it needs... > At L131 my translation starts. It has the constrains I got it to compile with > but segfaults then. I noticed that using any other var than tileData works > with "m". Could it be a problem for gcc to use the double pointer here: > Pixel16 **tileData ? > > > > > Also I wonder which -f option that comes with -O2 makes gcc stop > reporting: > > > > > error: can't find a register in class 'LEGACY_REGS' while reloading > 'asm' > > > > > > > > I guess this is a joke. > > > > > > No, it isn't. I wouldn't have asked else wise... > > > > Reload has run out of registers. It's telling you that it needs > > another one. A -f option is not going to give reload another > > register. > > The point is, if I just add -O2 to the g++ cammand, this error disappears > without having changed anything in the code or the number of register the part > uses. Sure, because gcc is optimizing, and thus it uses fewer registers. > It seems that an option in -O2 or above lets g++ be able to cope with the > registers I have left it (ebx and ebp, esp). I found this solution quite often > on the net. > > > Is it the combination of all -f options in -O2? I coudn't find a > > > single obviouse one in the manpage. Is it a rule then to include > > > -O2 or higher if inline asm is used??? > > > > No, there's no such rule. You've run out of registers. > > > > gcc needs one or two spare registers to work with. The x86 has eight, > > some of which are used for special purposes. You are using five in > > your asm. This is a very tight situation. > > Compiling all this with -fomit-frame-pointer: > > Can gcc not push all registers, and give me all seven without esp? > > I also tryed to use "R" instead of "m" for tileData. It compiled > without errors even when I had specified -fPIC. Excellent. That one is solved, then. > -fPIC seems to use ebx so I pushed and poped that in my asm > code. But when looking at the disassembly I had to see gcc used ebx > for tileData and not ebp. OK. > But if I specified "b" it complains about: error: PIC register > %ebx clobbered in asm > > Is this a bug in gcc??? Is there a constraint just for ebp so I > don't have to use "R" and hope it gets into ebp? Why do you care that it is in ebp? Why do you not allow gcc to choose the register? You seem to want to use explicit registers in your asm, but I can't see any reason why you want to do that. gcc usually works better when you let gcc choose the registers. Andrew. From lynx.abraxas@freenet.de Sun Mar 25 01:08:00 2007 From: lynx.abraxas@freenet.de (lynx.abraxas@freenet.de) Date: Sun, 25 Mar 2007 01:08:00 -0000 Subject: inline asm: How to push PIC reg before seven input operands get loaded? In-Reply-To: <17925.36122.323917.231376@zebedee.pink> References: <20070324095148.GB1837@drago.uni-regensburg.de> <17925.1912.101064.171511@zebedee.pink> <20070324122324.GA3154@drago.uni-regensburg.de> <17925.27411.531144.236075@zebedee.pink> <20070324192056.GA1938@drago.uni-regensburg.de> <17925.36122.323917.231376@zebedee.pink> Message-ID: <20070324221539.GA5159@drago.uni-regensburg.de> On 24/03/07 20:42:02, Andrew Haley wrote: > > This is a problem. My task is to tranlate this inline asm written for MSC to > > gcc. It's from a big game (Call to Power II, CTP2). I've attached a file with > > the function that contains the code. But it won't compile withou a lot > > modifications outside the source tree. > > And you can't figure out how to provide the typedefs it needs... > > > At L131 my translation starts. It has the constrains I got it to compile with > > but segfaults then. I noticed that using any other var than tileData works > > with "m". Could it be a problem for gcc to use the double pointer here: > > Pixel16 **tileData ? > > > > The point is, if I just add -O2 to the g++ cammand, this error disappears > > without having changed anything in the code or the number of register the part > > uses. > > Sure, because gcc is optimizing, and thus it uses fewer registers. Is there then an option to gcc that lets gcc push all registers before asm so that I can use what I need without having to hope gcc lets me use all registers? > > Compiling all this with -fomit-frame-pointer: > > > > Can gcc not push all registers, and give me all seven without esp? > > > > I also tryed to use "R" instead of "m" for tileData. It compiled > > without errors even when I had specified -fPIC. > > Excellent. That one is solved, then. > > > -fPIC seems to use ebx so I pushed and poped that in my asm > > code. But when looking at the disassembly I had to see gcc used ebx > > for tileData and not ebp. > > OK. No, because it makes me a hard night to get ebx stay unclobbered and then it just uses it itself! Why can't it use ebp which I left empty for gcc because I can't directly assign it to a variable. > > > But if I specified "b" it complains about: error: PIC register > > %ebx clobbered in asm > > > > Is this a bug in gcc??? Is there a constraint just for ebp so I > > don't have to use "R" and hope it gets into ebp? > > Why do you care that it is in ebp? Why do you not allow gcc to choose > the register? You seem to want to use explicit registers in your asm, > but I can't see any reason why you want to do that. gcc usually works > better when you let gcc choose the registers. > I tried with just "r". But then gcc complains about not enough registers as it seems not wanting to use ebp and it still doesn't want to give up on ebx for PIC. Another reason is I don't know how to specify a register in the asm code that is still empty. Like in my problem I need at least one empty register apart the six preloaded ones. I use ebx there, so I can circumvent the PIC problem. Is there a way to specify an empty register without a direct name? And %dx I use because there is no way mentioned in the docs how to reduce the size when using eg %3. Lynx From mohsen@pahlevanzadeh.org Sun Mar 25 14:18:00 2007 From: mohsen@pahlevanzadeh.org (Mohsen Pahlevanzadeh) Date: Sun, 25 Mar 2007 14:18:00 -0000 Subject: mean of an error Message-ID: <46063514.4070501@pahlevanzadeh.org> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Dear all, I wanna know when i receive "Conflicting types for 'x'" (x is a variable that it's mentioned to a data type),What does mean that error? Yours,Mohsen -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGBjUU/ZBAvBh9bHIRAl+DAJ9YhbzLoff9o/IBUEeyeh/fgq3N6gCcD8Cg j/QsKpS5jFgVSv3fmqIooCE= =NEPI -----END PGP SIGNATURE----- From rattan@cps.cmich.edu Sun Mar 25 15:37:00 2007 From: rattan@cps.cmich.edu (ISHWAR RATTAN) Date: Sun, 25 Mar 2007 15:37:00 -0000 Subject: mean of an error In-Reply-To: <46063514.4070501@pahlevanzadeh.org> References: <46063514.4070501@pahlevanzadeh.org> Message-ID: It means that there is data type conflict between usage and declaration. Correct data type for a function etc (from library/system call) are explicitly listed in the man page, and you must use/declare/define exactly like that. -ishwar On Sun, 25 Mar 2007, Mohsen Pahlevanzadeh wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Dear all, > I wanna know when i receive "Conflicting types for 'x'" (x is a > variable that it's mentioned to a data type),What does mean that error? > Yours,Mohsen > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.6 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iD8DBQFGBjUU/ZBAvBh9bHIRAl+DAJ9YhbzLoff9o/IBUEeyeh/fgq3N6gCcD8Cg > j/QsKpS5jFgVSv3fmqIooCE= > =NEPI > -----END PGP SIGNATURE----- > From aph@redhat.com Sun Mar 25 17:45:00 2007 From: aph@redhat.com (Andrew Haley) Date: Sun, 25 Mar 2007 17:45:00 -0000 Subject: inline asm: How to push PIC reg before seven input operands get loaded? In-Reply-To: <20070324221539.GA5159@drago.uni-regensburg.de> References: <20070324095148.GB1837@drago.uni-regensburg.de> <17925.1912.101064.171511@zebedee.pink> <20070324122324.GA3154@drago.uni-regensburg.de> <17925.27411.531144.236075@zebedee.pink> <20070324192056.GA1938@drago.uni-regensburg.de> <17925.36122.323917.231376@zebedee.pink> <20070324221539.GA5159@drago.uni-regensburg.de> Message-ID: <17926.38646.862945.296058@zebedee.pink> lynx.abraxas@freenet.de writes: > On 24/03/07 20:42:02, Andrew Haley wrote: > > Is there then an option to gcc that lets gcc push all registers before asm so > that I can use what I need without having to hope gcc lets me use all > registers? No. > > > But if I specified "b" it complains about: error: PIC register > > > %ebx clobbered in asm > > > > > > Is this a bug in gcc??? Is there a constraint just for ebp so I > > > don't have to use "R" and hope it gets into ebp? > > > > Why do you care that it is in ebp? Why do you not allow gcc to choose > > the register? You seem to want to use explicit registers in your asm, > > but I can't see any reason why you want to do that. gcc usually works > > better when you let gcc choose the registers. > > I tried with just "r". But then gcc complains about not enough > registers as it seems not wanting to use ebp and it still doesn't > want to give up on ebx for PIC. Please, give us a test case. > Another reason is I don't know how to specify a register in the asm > code that is still empty. Like in my problem I need at least one > empty register apart the six preloaded ones. I use ebx there, so I > can circumvent the PIC problem. Is there a way to specify an empty > register without a direct name? Sure, you just need to use an input/ouput register operand. It's in the docs. > And %dx I use because there is no way mentioned in the docs how to > reduce the size when using eg %3. How to reduce the size of what? This doesn't make any sense to me. Please, give us a test case. Andrew. From bazil@agenstvo.com Sun Mar 25 17:53:00 2007 From: bazil@agenstvo.com (Dmitriy Gorbenko) Date: Sun, 25 Mar 2007 17:53:00 -0000 Subject: Finding source files - No such file or directory Message-ID: <4606DF78.8050203@agenstvo.com> Hi. I have an trouble: some day under root user I compile program in /tmp/a directory. Next, I remove /tmp/a, logout from root into regular user, and tries to compile again same program, but now in my own home directory (from clean source code - no ojbect files, no libtool dependencies - only .cpp files). Then I started GDB, and tries to debug my program. I was confused: ---------------8<---------------------------------------------- Breakpoint 1, main (argc=2, argv=0x7fffdf192608) at cgateway.cpp:120 120 TAgent::postAgent(cmd, channel.c_str(), data, size); (gdb) step TAgent::postAgent (cmd=111, channel=0x50c3a8 "acm", retchannel=0x0, data=0x0, size=0, bAutoRemove=true, tid=0, safeData=0x0, safeDataSize=0) at Agent.cpp:132 132 Agent.cpp: No such file or directory in Agent.cpp (gdb) ---------------8<---------------------------------------------- When I restore /tmp/a directory, put where source code and start again GDB: ---------------8<---------------------------------------------- Breakpoint 1, main (argc=2, argv=0x7fffdb2aa728) at cgateway.cpp:120 120 TAgent::postAgent(cmd, channel.c_str(), data, size); (gdb) step TAgent::postAgent (cmd=111, channel=0x50c3a8 "acm", retchannel=0x0, data=0x0, size=0, bAutoRemove=true, tid=0, safeData=0x0, safeDataSize=0) at Agent.cpp:132 132 bool TAgent::postAgent(unsigned int cmd, const char* channel, const char* retchannel, void* data, size_t size, bool bAutoRemove, const pthread_t tid, void* safeData, size_t safeDataSize) (gdb) ---------------8<---------------------------------------------- I tries to get some info from GDB: (gdb) show directories Source directories searched: $cdir:$cwd (gdb) But no one hint to find /tmp/a directory. Could you tell me, how GDB knows about /tmp/a directory? Thanks. From aph@redhat.com Sun Mar 25 18:26:00 2007 From: aph@redhat.com (Andrew Haley) Date: Sun, 25 Mar 2007 18:26:00 -0000 Subject: Finding source files - No such file or directory In-Reply-To: <4606DF78.8050203@agenstvo.com> References: <4606DF78.8050203@agenstvo.com> Message-ID: <17926.46846.96819.570630@zebedee.pink> Dmitriy Gorbenko writes: > > But no one hint to find /tmp/a directory. > > Could you tell me, how GDB knows about /tmp/a directory? readelf --debug Look for the Directory Table entry. Andrew. From bazil@agenstvo.com Sun Mar 25 22:40:00 2007 From: bazil@agenstvo.com (Dmitriy Gorbenko) Date: Sun, 25 Mar 2007 22:40:00 -0000 Subject: Finding source files - No such file or directory In-Reply-To: <17926.46846.96819.570630@zebedee.pink> References: <4606DF78.8050203@agenstvo.com> <17926.46846.96819.570630@zebedee.pink> Message-ID: <4606E90E.1090803@agenstvo.com> Andrew Haley writes: > Dmitriy Gorbenko writes: > > > > But no one hint to find /tmp/a directory. > > > > Could you tell me, how GDB knows about /tmp/a directory? > > readelf --debug > > Look for the Directory Table entry. > > Andrew. > I resolve the problem by myself - I make a great mistake: I forgot type 'make install' - the program uses some libraries, and that libraries uses source files from /tmp/a directory. Stupid mistake. But thanks for `readelf` hint. From dima.sorkin@gmail.com Mon Mar 26 10:57:00 2007 From: dima.sorkin@gmail.com (Dima Sorkin) Date: Mon, 26 Mar 2007 10:57:00 -0000 Subject: member class Message-ID: Hi. It _seems_ that g++ -pedantic -Wall (any version) allows the nested member classes to access the private types of an enclosing class. Should it be this way? It is contrary to B.Stroustrup "The C++ prog lang" C.11.3 Regards, Dima. From aph@redhat.com Mon Mar 26 11:42:00 2007 From: aph@redhat.com (Andrew Haley) Date: Mon, 26 Mar 2007 11:42:00 -0000 Subject: member class In-Reply-To: References: Message-ID: <17927.42779.869626.882742@zebedee.pink> Dima Sorkin writes: > Hi. > It _seems_ that g++ -pedantic -Wall (any version) allows > the nested member classes to access the private types of > an enclosing class. > > Should it be this way? It is contrary to > B.Stroustrup "The C++ prog lang" C.11.3 It's a bit more complicated than that. Before you post a bug, have a look at 11.8, Nested Classes, in ISO/IEC 14882, Programming languages: C++. Andrew. From aph@redhat.com Mon Mar 26 11:48:00 2007 From: aph@redhat.com (Andrew Haley) Date: Mon, 26 Mar 2007 11:48:00 -0000 Subject: Where is ld.so and libdl.so built from In-Reply-To: <76EBE649FB0E0E4DA883B5840459059F143A4C2252@AA-EXMSG-C412.southpacific.corp.microsoft.com> References: <76EBE649FB0E0E4DA883B5840459059F143A4C2252@AA-EXMSG-C412.southpacific.corp.microsoft.com> Message-ID: <17927.45456.892788.31302@zebedee.pink> Mayank Kumar writes: > In gcc packages, I could not find ld.so and libdl.so > Binutils only contains ld. Redirected to gcc-help@gcc.gnu.org. Please don't ask user questions on the gcc mailing list. > Where can I find the gnu source code for libdl.so and ld.so In glibc. Andrew. From mayank@microsoft.com Mon Mar 26 17:28:00 2007 From: mayank@microsoft.com (Mayank Kumar) Date: Mon, 26 Mar 2007 17:28:00 -0000 Subject: Where is ld.so and libdl.so built from In-Reply-To: <17927.45456.892788.31302@zebedee.pink> References: <76EBE649FB0E0E4DA883B5840459059F143A4C2252@AA-EXMSG-C412.southpacific.corp.microsoft.com> <17927.45456.892788.31302@zebedee.pink> Message-ID: <76EBE649FB0E0E4DA883B5840459059F143A4C2255@AA-EXMSG-C412.southpacific.corp.microsoft.com> Thanks for your help, I will take care of this. Thanks Mayank -----Original Message----- From: Andrew Haley [mailto:aph@redhat.com] Sent: Monday, March 26, 2007 5:12 PM To: Mayank Kumar Cc: gcc-help@gcc.gnu.org Subject: Re: Where is ld.so and libdl.so built from Mayank Kumar writes: > In gcc packages, I could not find ld.so and libdl.so > Binutils only contains ld. Redirected to gcc-help@gcc.gnu.org. Please don't ask user questions on the gcc mailing list. > Where can I find the gnu source code for libdl.so and ld.so In glibc. Andrew. From kourama@teksavvy.com Mon Mar 26 18:09:00 2007 From: kourama@teksavvy.com (kourama) Date: Mon, 26 Mar 2007 18:09:00 -0000 Subject: "char *" diff in header & func arg list? Message-ID: <9677694.post@talk.nabble.com> I have noticed something that seems wrong to me, and I'd like to know if anyone can confirm the bug or explain the seemingly strange behaviour. Attached is a set of files which demonstrates the problem: http://www.nabble.com/file/7426/a.c a.c http://www.nabble.com/file/7427/b.c b.c http://www.nabble.com/file/7428/Makefile Makefile When the aa function in a.c declares "char *arg" in it's argument list, it gets a pointer, which means that "char *arg" is equivalent to "char arg[]" in the argument list. However, in the file b.c, the declaration "extern char *myarray" is treated differently from "extern char myarray[]" It seems to me that, based on the context, the two should be equivalent, but GCC doesn't treat them that way. So, is this a bug, legacy behaviour or is this just another wrinkle in the sharpei puppy that is C? Many thanks. -- View this message in context: http://www.nabble.com/%22char-*%22-diff-in-header---func-arg-list--tf3468423.html#a9677694 Sent from the gcc - Help mailing list archive at Nabble.com. From eljay@adobe.com Mon Mar 26 18:26:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Mon, 26 Mar 2007 18:26:00 -0000 Subject: "char *" diff in header & func arg list? In-Reply-To: <9677694.post@talk.nabble.com> Message-ID: Hi kourama, These two things are mostly interchangeable for most purposes as a parameter: char array[]; char* pointer; On the caller's side, arg1 degenerates into something that almost is the same as: char* const arg1; C proponents would say this is a good thing. I've been working in C++ long enough to consider it a bit of a wart (but C++ has far more atrocious warts than this to worry about), as part of the C legacy. However, this is an outright mismatch: extern char array[]; extern char* pointer; char array[] = "good"; char pointer[] = "bad"; Why? Because an array of characters is not a pointer to an array of characters. The declaration does not match the definition. > So, is this a bug, legacy behaviour or is this just another wrinkle in the sharpei puppy that is C? In this case, not a wrinkle, not a "legacy C" issue. It is a PEBKAC bug. HTH, --Eljay From kourama@teksavvy.com Mon Mar 26 23:40:00 2007 From: kourama@teksavvy.com (kourama) Date: Mon, 26 Mar 2007 23:40:00 -0000 Subject: "char *" diff in header & func arg list? In-Reply-To: References: <9677694.post@talk.nabble.com> Message-ID: <9678711.post@talk.nabble.com> John Love-Jensen wrote: > > Why? Because an array of characters is not a pointer to an array of > characters. The declaration does not match the definition. > Ah, of course. I was effectly casting the array to a pointer type in the extern declaration. Thanks. Honestly, am I dim or is that a subtle "gotcha"? eh...don't answer that. -- View this message in context: http://www.nabble.com/%22char-*%22-diff-in-header---func-arg-list--tf3468423.html#a9678711 Sent from the gcc - Help mailing list archive at Nabble.com. From viet@horslimites.org Mon Mar 26 23:49:00 2007 From: viet@horslimites.org (viet@horslimites.org) Date: Mon, 26 Mar 2007 23:49:00 -0000 Subject: _ZTV vs _ZTI Message-ID: <39242.198.73.165.1.1174952441.squirrel@courrier.horslimites.org> Hi, I have an archive file, when I do a nm on it, I can see. 00000000 V _ZTV13VLH_Container the compile option to create the objects for the archive (.a) is gcc -c -Wno-ctor-dtor-privacy -fno-rtti -MMD -pthread -Wno-deprecated -Wall -O2 I have an .so that link with the above archive, when I do an nm on it, I can see: U _ZTI13VLH_Container the compile option to creates objects for the .so is g++ -pipe -Wall -fPIC -rdynamic -g I'm guessing that the problem for the undefined symbol is a compile option. What is the difference between _ZTV and _ZTI? When linking my so, I put the archive at the end. Any idea? Regards, VLH From iant@google.com Tue Mar 27 01:17:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Tue, 27 Mar 2007 01:17:00 -0000 Subject: _ZTV vs _ZTI In-Reply-To: <39242.198.73.165.1.1174952441.squirrel@courrier.horslimites.org> References: <39242.198.73.165.1.1174952441.squirrel@courrier.horslimites.org> Message-ID: viet@horslimites.org writes: > I'm guessing that the problem for the undefined symbol is a compile > option. What is the difference between _ZTV and _ZTI? _ZTV is a virtual table. _ZTI is a typeinfo table (for RTTI). I don't know why you are seeing the undefined symbol in the .so. Ian From storri@torri.org Tue Mar 27 09:51:00 2007 From: storri@torri.org (Stephen Torri) Date: Tue, 27 Mar 2007 09:51:00 -0000 Subject: Command flags for debugging template code Message-ID: <1174958247.3599.15.camel@localhost.localdomain> I have a C++ project that uses the boost graph library. Now the reason I am emailing here is that I was wondering for general C++ code that uses templates what flags should I use to enable gdb to stop in a template function? For example if I had a header file that had: class Fruit { public: template void print_Contents ( Basket* container_ptr ) { std::cout << container_ptr->dump() << std::endl; } }; Assuming that I had a class that supported the function dump() I could then use this function. Well as I understand it the definition in the header for the function dump() will be inlined anywhere it is used in the code. Is that correct? If it is then unless I keep careful management of print_Contents I may not know its called. In the boost graph library there are a lot of ways certain functions are used but require a indepth understanding of which are called explicitly or implicitly. I would like such that if I used flags X, Y and Z with the g++ compiler I can call gdb to stop in function print_Contents. Do I make sense? Stephen From aph@redhat.com Tue Mar 27 11:43:00 2007 From: aph@redhat.com (Andrew Haley) Date: Tue, 27 Mar 2007 11:43:00 -0000 Subject: _ZTV vs _ZTI In-Reply-To: <39242.198.73.165.1.1174952441.squirrel@courrier.horslimites.org> References: <39242.198.73.165.1.1174952441.squirrel@courrier.horslimites.org> Message-ID: <17928.59652.476218.739876@zebedee.pink> viet@horslimites.org writes: > > I have an archive file, when I do a nm on it, I can see. > > 00000000 V _ZTV13VLH_Container vtable for VLH_Container > the compile option to create the objects for the archive (.a) is > > gcc -c -Wno-ctor-dtor-privacy -fno-rtti -MMD -pthread -Wno-deprecated > -Wall -O2 > > I have an .so that link with the above archive, when I do an nm on it, I > can see: > U _ZTI13VLH_Container typeinfo for VLH_Container > the compile option to creates objects for the .so is > > g++ -pipe -Wall -fPIC -rdynamic -g > > I'm guessing that the problem for the undefined symbol is a compile > option. What is the difference between _ZTV and _ZTI? They're totally different things. Andrew. From eljay@adobe.com Tue Mar 27 11:58:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Tue, 27 Mar 2007 11:58:00 -0000 Subject: Command flags for debugging template code In-Reply-To: <1174958247.3599.15.camel@localhost.localdomain> Message-ID: Hi Stephen, One of the problems with debugging (depending on the debugger and environment) is break points with inline functions. To give me a debug-able spot I can drop a breakpoint on, I've done this before: // --- Fruit.h --- void EljayBreakpoint(); class Fruit { public: template void print_Contents(Basket* container_ptr) { EljayBreakpoint(); std::cout << container_ptr->dump() << std::endl; } }; // --- Fruit.cpp --- #include "Fruit.h" void EljayBreakpoint() { std::cerr << "EljayBreakpoint: you are here\n"; } And then I set the breakpoint inside EljayBreakpoint. I now realize I haven't needed to do this trick in many years. So either the debuggers are better on the platforms I'm using and can sensically step into inline functions, or I'm making less boo-boos. HTH, --Eljay From jfranzoy@yahoo.com.ar Tue Mar 27 13:12:00 2007 From: jfranzoy@yahoo.com.ar (Juan Carlos Franzoy) Date: Tue, 27 Mar 2007 13:12:00 -0000 Subject: can __exchange_and_add be used from outside? Message-ID: <3426.14943.qm@web32709.mail.mud.yahoo.com> Hello. I write because I was wondering if __exchange_and_add can be used from user code or it's an internal detail of libstdc++. I have to implement a library with AtomicSet and AtomicAdd. The library must be portable across solaris/sparc, linux/x86 and hpux11/parisc. If the answer is no, do anybody know how to do it? Thanks. ------------------------------------------------------------ Juan Carlos Franzoy Proyect Leader mailto:jfranzoy@yahoo.com.ar ------------------------------------------------------------ __________________________________________________ Pregunt?. Respond?. Descubr?. Todo lo que quer?as saber, y lo que ni imaginabas, est? en Yahoo! Respuestas (Beta). ?Probalo ya! http://www.yahoo.com.ar/respuestas From iant@google.com Tue Mar 27 14:02:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Tue, 27 Mar 2007 14:02:00 -0000 Subject: can __exchange_and_add be used from outside? In-Reply-To: <3426.14943.qm@web32709.mail.mud.yahoo.com> References: <3426.14943.qm@web32709.mail.mud.yahoo.com> Message-ID: Juan Carlos Franzoy writes: > Hello. I write because I was wondering if __exchange_and_add can be used from user code or it's an internal detail of libstdc++. > > I have to implement a library with AtomicSet and AtomicAdd. The library must be portable across solaris/sparc, linux/x86 and hpux11/parisc. > > If the answer is no, do anybody know how to do it? gcc provides these calls as extensions: http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html Ian From rajesh.pethe@gmail.com Tue Mar 27 14:06:00 2007 From: rajesh.pethe@gmail.com (Rajesh Pethe) Date: Tue, 27 Mar 2007 14:06:00 -0000 Subject: Compiling gcc 3.3.2 on AIX 64 bit platform Message-ID: <6cf874de0703270702j5c41a92fq1cf49adfd3503535@mail.gmail.com> Hi All, I need to install gcc compiler on AIX ( powerpc-ibm-aix5.2.0.0 ) but there is no working C compiler available on host. Is building a native C compiler a solution for this? I tried doing that using 'sh configure --enable-bootstrap --prefix...' and it is still looking for a working compiler. Error - Assembler: /tmp/ccuFE7td.s: line 10: 1252-191 Only .llong should be used for relocatable expressions. *** The command 'gcc -o conftest -O2 conftest.c' failed. *** You must set the environment variable CC to a working compiler. I have already tried setting OBJECT_MODE environment variable. I have no idea why the C compiler is not working. Any inputs, links will be much appreciated. Regards Rajesh From storri@torri.org Tue Mar 27 14:17:00 2007 From: storri@torri.org (Stephen Torri) Date: Tue, 27 Mar 2007 14:17:00 -0000 Subject: Command flags for debugging template code In-Reply-To: References: Message-ID: <1175004353.3908.0.camel@localhost.localdomain> Thanks for the programming idea. That is certainly an easy way of doing what I want. Stephen On Tue, 2007-03-27 at 06:43 -0500, John Love-Jensen wrote: > Hi Stephen, > > One of the problems with debugging (depending on the debugger and > environment) is break points with inline functions. > > To give me a debug-able spot I can drop a breakpoint on, I've done this > before: > > // --- Fruit.h --- > void EljayBreakpoint(); > > class Fruit > { > public: > > template > void print_Contents(Basket* container_ptr) > { > EljayBreakpoint(); > std::cout << container_ptr->dump() << std::endl; > } > }; > > // --- Fruit.cpp --- > #include "Fruit.h" > void EljayBreakpoint() > { > std::cerr << "EljayBreakpoint: you are here\n"; > } > > And then I set the breakpoint inside EljayBreakpoint. > > I now realize I haven't needed to do this trick in many years. So either > the debuggers are better on the platforms I'm using and can sensically step > into inline functions, or I'm making less boo-boos. > > HTH, > --Eljay > From rqooptometrist@greencore.ie Tue Mar 27 15:35:00 2007 From: rqooptometrist@greencore.ie (MMarian Damon) Date: Tue, 27 Mar 2007 15:35:00 -0000 Subject: bucknell matthews Message-ID: <068a01c77005$3ddf04f0$5157f5a0@vexecutivej> We told you yesterday this would make a move up 10% in 1 Day and its just the 1st day, Imagine Check this company out CRITICAL Care N E W Sym-CCTI Extremely b ullish at 22 Cents Short or long, this one cant go wrong up 10% in 1 Day and its just the 1st day, Imagine where it will be in 5 days Get in this gem tomorrow, Catch an easy doubler!! D'Antoni said. ''We're in a little bit of a funk right now. Discombobulated. We exhaustion. ''We're still feeling it,'' Steve Nash said. ''It was a big win. got 25 points from Leandro Barbosa , never led in this one and fell behind by championships and we haven't been close to doing either in a lot of ways." ----- Original Message ----- From: "MMarian Damon" To: Sent: Thursday, March 22, 2007 8:27 PM Subject: bucknell matthews > Check this company out > CRITICAL Care N E W > Sym-CCTI > Extremely b ullish at 22 Cents > Short or long, this one cant go wrong From jbousch@altran-tech.net Tue Mar 27 15:43:00 2007 From: jbousch@altran-tech.net (jbousch@altran-tech.net) Date: Tue, 27 Mar 2007 15:43:00 -0000 Subject: Embedded arm-elf-gcc Message-ID: <34437.81.255.205.37.1175009719.squirrel@81.255.205.37> Hi everybody, I'm currently working in a company, as embedded developper, which use gnu tools. I have a good experience about non gnu compiler tools and i need help because the most disavantage of gcc compiler is the almost unexistant support for developper. I work on an embedded software for an ARM7TDMI target processor (Phillips LPC 2214) and i have to locate the software in the target. So here comes the link command file (arm.ln) with wich i am supposed to set the memory map. The thing is that i can't find any tutorial about link comand file so i don't know how to write it manually. If anybody knows something about link comand file or any book or web site reference i would apreciate it a lot. Thanks in advance From iant@google.com Tue Mar 27 15:52:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Tue, 27 Mar 2007 15:52:00 -0000 Subject: Embedded arm-elf-gcc In-Reply-To: <34437.81.255.205.37.1175009719.squirrel@81.255.205.37> References: <34437.81.255.205.37.1175009719.squirrel@81.255.205.37> Message-ID: jbousch@altran-tech.net writes: > I'm currently working in a company, as embedded developper, which use gnu > tools. I have a good experience about non gnu compiler tools and i need > help because the most disavantage of gcc compiler is the almost unexistant > support for developper. > > I work on an embedded software for an ARM7TDMI target processor (Phillips > LPC 2214) and i have to locate the software in the target. So here comes > the link command file (arm.ln) with wich i am supposed to set the memory > map. The thing is that i can't find any tutorial about link comand file so > i don't know how to write it manually. > > If anybody knows something about link comand file or any book or web site > reference i would apreciate it a lot. Please send questions only to gcc-help@gcc.gnu.org, not also to gcc@gnu.org. Thanks. First let me say that there are several companies which sell support for developers using the GNU tools. If you want support, it is available. The link command file is described in the linker manual. The linker is not part of gcc; it is part of the GNU binutils. Here is the online version of the documentation for version 2.17: http://sourceware.org/binutils/docs-2.17/ld/index.html Ian From osv@javad.com Tue Mar 27 16:38:00 2007 From: osv@javad.com (Sergei Organov) Date: Tue, 27 Mar 2007 16:38:00 -0000 Subject: Embedded arm-elf-gcc In-Reply-To: <34437.81.255.205.37.1175009719.squirrel@81.255.205.37> (jbousch@altran-tech.net's message of "Tue, 27 Mar 2007 17:35:19 +0200 (CEST)") References: <34437.81.255.205.37.1175009719.squirrel@81.255.205.37> Message-ID: <87abxy1y7f.fsf@javad.com> jbousch@altran-tech.net writes: > Hi everybody, > > I'm currently working in a company, as embedded developper, which use gnu > tools. I have a good experience about non gnu compiler tools and i need > help because the most disavantage of gcc compiler is the almost unexistant > support for developper. Really?! My experience is quite opposite. > I work on an embedded software for an ARM7TDMI target processor (Phillips > LPC 2214) and i have to locate the software in the target. So here comes > the link command file (arm.ln) with wich i am supposed to set the memory > map. The thing is that i can't find any tutorial about link comand file so > i don't know how to write it manually. > > If anybody knows something about link comand file or any book or web site > reference i would apreciate it a lot. -- Sergei. From mrs@apple.com Tue Mar 27 17:09:00 2007 From: mrs@apple.com (Mike Stump) Date: Tue, 27 Mar 2007 17:09:00 -0000 Subject: Embedded arm-elf-gcc In-Reply-To: <34437.81.255.205.37.1175009719.squirrel@81.255.205.37> References: <34437.81.255.205.37.1175009719.squirrel@81.255.205.37> Message-ID: On Mar 27, 2007, at 8:35 AM, jbousch@altran-tech.net wrote: > I'm currently working in a company, as embedded developper, which > use gnu > tools. I have a good experience about non gnu compiler tools and i > need > help because the most disavantage of gcc compiler is the almost > unexistant > support for developper. You must be paying the wrong people for support. :-) Find new people to pay. > I work on an embedded software for an ARM7TDMI target processor > (Phillips > LPC 2214) and i have to locate the software in the target. So here > comes > the link command file (arm.ln) with wich i am supposed to set the > memory > map. The thing is that i can't find any tutorial about link comand > file so > i don't know how to write it manually. I'd try the LD manual. > If anybody knows something about link comand file or any book or > web site > reference i would apreciate it a lot. Also, there is a search tool called google at google.com that is able to find all sort of things. For example, you could type "linker documentation", and it would have answered your question in about 140ms, which should be more than 50% faster than the speed at which we can answer your questions. Also, this is the wrong list, gcc-help is for help using gcc. From steve.kreyer@web.de Wed Mar 28 11:02:00 2007 From: steve.kreyer@web.de (Steve Kreyer) Date: Wed, 28 Mar 2007 11:02:00 -0000 Subject: wrong GCC-configuration? (./specs: Is a directory) In-Reply-To: References: <4603FD3F.5000600@blueSpirit.la> <46043721.7070705@blueSpirit.la> Message-ID: <46094EFB.8020403@web.de> Hi, only a guess: Can it be, that gcc searches also in LIBRARY_PATH for the specs file ? If so, maybe you have to check your LIBRARY_PATH environment variable, if this contains a fullstop. Or maybe just play with it and find out how gcc behaves to the content of this variable. Maybe you should set it to /usr/lib/gcc/target/gcc-version directory, if this is the directory where your default specs file is located. Regards, Steve Ian Lance Taylor wrote: > Karl Krach writes: > > >> Ian Lance Taylor wrote: >> >>> Karl Krach writes: >>> >>> >>>> What I figured out: My problem is that my GCC reads the specs from the >>>> current directory (if available). >>>> >>> This is not normal behaviour. There is something odd about your GCC. >>> Or you've done something like set the environment variable >>> GCC_EXEC_PREFIX to ".". >>> >> I've already checked all environment variables. There is only >> $GCC_SPECS and it's empty. But this variable (if empty) has no effect >> to GCC's behavior. >> > > GCC_SPECS does nothing with standard gcc. > > >> And yes, I'm also sure that it's not the normal behavior. But I've no >> idea which parameters to change. >> > > I think you must be using patched source code. I have no other way of > explaining what you are seeing. Well, maybe you configured gcc with > "--prefix=." but that would probably cause other problems. > > Ian > > -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3245 bytes Desc: S/MIME Cryptographic Signature URL: From dinabandhu@lifetreeindia.com Wed Mar 28 11:21:00 2007 From: dinabandhu@lifetreeindia.com (Dinabandhu Mitra) Date: Wed, 28 Mar 2007 11:21:00 -0000 Subject: Problem With templates Message-ID: <006501c77128$86b8b170$cf01a8c0@dinu> Hi, ? The following code does not compile. The code seems all right and it compiles on MSVC, HP-UX aCC and Solaris CC (Forte) compiler. I don?t really know why it does not on g++. I have tried gcc 3.4.5, 4.0.2 on linux. ? Any work around is also ok. ? #include ? ? template class X { public: ??? struct B ??? { ??? }; ??? void method() ??? { ??????? B b; ??????? std::list::iterator c; ??? } }; ? int main() { }??????????????????? ? The error is given below ? ? test_std.cpp: In member function `void X::method()': test_std.cpp:14: error: expected `;' before "c" ? ? Regards, ? Dinabandhu Mitra From domen.vrankar@gmail.com Wed Mar 28 11:22:00 2007 From: domen.vrankar@gmail.com (Domen Vrankar) Date: Wed, 28 Mar 2007 11:22:00 -0000 Subject: list of warning messages Message-ID: <1d9535c10703280421h50245179qa2244d0b2fb1e721@mail.gmail.com> Hi, does anyone know if there is somekind of documentation that contains list and description of all warning/error messages that gcc outputs? r. Domen From daniel.llorens@bluewin.ch Wed Mar 28 12:22:00 2007 From: daniel.llorens@bluewin.ch (=?ISO-8859-1?Q?Daniel_Llorens_del_R=EDo?=) Date: Wed, 28 Mar 2007 12:22:00 -0000 Subject: Problem With templates In-Reply-To: <006501c77128$86b8b170$cf01a8c0@dinu> References: <006501c77128$86b8b170$cf01a8c0@dinu> Message-ID: <72210264-D96B-4FE9-B394-C872E0F71101@bluewin.ch> On 28 Mar, 2007, at 13:02, Dinabandhu Mitra wrote: > std::list::iterator c; try typename std::list::iterator c; From dinabandhu@lifetreeindia.com Wed Mar 28 12:30:00 2007 From: dinabandhu@lifetreeindia.com (Dinabandhu Mitra) Date: Wed, 28 Mar 2007 12:30:00 -0000 Subject: Problem With templates In-Reply-To: <72210264-D96B-4FE9-B394-C872E0F71101@bluewin.ch> Message-ID: <006b01c77133$a9dcf750$cf01a8c0@dinu> Thanks a lot ... it worked. I am just wondering how this works on other compilers ... is it a issue with gcc or other compilers? -----Original Message----- From: Daniel Llorens del R?o [mailto:daniel.llorens@bluewin.ch] Sent: Wednesday, March 28, 2007 4:52 PM To: Dinabandhu Mitra; gcc-help@gcc.gnu.org Subject: Re: Problem With templates On 28 Mar, 2007, at 13:02, Dinabandhu Mitra wrote: > std::list::iterator c; try typename std::list::iterator c; From aph@redhat.com Wed Mar 28 13:17:00 2007 From: aph@redhat.com (Andrew Haley) Date: Wed, 28 Mar 2007 13:17:00 -0000 Subject: Problem With templates In-Reply-To: <006b01c77133$a9dcf750$cf01a8c0@dinu> References: <72210264-D96B-4FE9-B394-C872E0F71101@bluewin.ch> <006b01c77133$a9dcf750$cf01a8c0@dinu> Message-ID: <17930.24528.153425.55629@zebedee.pink> Dinabandhu Mitra writes: > Thanks a lot ... it worked. I am just wondering how this works on other > compilers ... is it a issue with gcc or other compilers? gcc has improved its standards compliance. Andrew. > > -----Original Message----- > From: Daniel Llorens del R??o [mailto:daniel.llorens@bluewin.ch] > Sent: Wednesday, March 28, 2007 4:52 PM > To: Dinabandhu Mitra; gcc-help@gcc.gnu.org > Subject: Re: Problem With templates > > > On 28 Mar, 2007, at 13:02, Dinabandhu Mitra wrote: > > > std::list::iterator c; > > try > > typename std::list::iterator c; > > > -- Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Directors: Michael Cunningham (USA), Charlie Peters (USA) and David Owens (Ireland) From eljay@adobe.com Wed Mar 28 14:05:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Wed, 28 Mar 2007 14:05:00 -0000 Subject: strict C++ mode Message-ID: Hi everyone, Is there a way to get GCC to compile C++ in a "strict C++" mode? By "strict C++" I mean that when I include , I get symbols that are required by ISO 14882, but I don't get symbols that are not specified in ISO 14882. So I'd get: std::printf But I would not get: ::printf And I would not get any #define's that are not required by ISO 14882. (Not including header guards that have a double-underscore or start with underscore-capital letter.) Thanks, --Eljay From gonwg@hotmail.com Wed Mar 28 14:19:00 2007 From: gonwg@hotmail.com (Michael Gong) Date: Wed, 28 Mar 2007 14:19:00 -0000 Subject: what's this syntax ? Message-ID: Hi, Can anyone tell me what the "..." syntax is called in following function definition ? *************************************************************************** struct physid_mask { unsigned long mask [(((256)+32-1/32)]; }; typedef struct physid_mask physid_mask_t; static inline __attribute__((always_inline)) physid_mask_t ioapic_phys_id_map(physid_mask_t phys_id_map) { return ( { physid_mask_t __physid_mask = { { [0 ... (((256)+32 -1)/32)-1] = 0UL <--- Is it designated initializer ??? } }; __physid_mask.mask[0] = 0x0F; __physid_mask; } ); } *************************************************************************** Thanks. Mike From eljay@adobe.com Wed Mar 28 14:31:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Wed, 28 Mar 2007 14:31:00 -0000 Subject: what's this syntax ? In-Reply-To: Message-ID: Hi Michael, I think the '...' is called an ellipsis in the array initializer. So you can do something like: int array[10] = { [4] = 9, [1 ... 2] = 88, [7 ... 9] = 1 }; It's valid C99 code. IIRC, it's *NOT* valid C90 or C++98 code. (I'm not sure if GCC provides convenience extensions that you may have to disable in a C90 or C++98 environment.) You may find this output of interest: gcc -S test.c cat test.s HTH, --Eljay From gonwg@hotmail.com Wed Mar 28 14:33:00 2007 From: gonwg@hotmail.com (Michael Gong) Date: Wed, 28 Mar 2007 14:33:00 -0000 Subject: what's this syntax ? References: Message-ID: Hi, John, Thanks for reply and the information is very helpful. However, to clarify a bit, I don't think it's a valid C99 code. According to gcc manual, http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Designated-Inits.html#Designated-Inits .. To initialize a range of elements to the same value, write `[first ... last] = value'. This is a GNU extension. For example, int widths[] = { [0 ... 9] = 1, [10 ... 99] = 2, [100] = 3 }; .. Thanks. Mike ----- Original Message ----- From: "John Love-Jensen" To: "Michael Gong" ; "MSX to GCC" Sent: Wednesday, March 28, 2007 9:19 AM Subject: Re: what's this syntax ? > Hi Michael, > > I think the '...' is called an ellipsis in the array initializer. > > So you can do something like: > > int array[10] = { [4] = 9, [1 ... 2] = 88, [7 ... 9] = 1 }; > > It's valid C99 code. > > IIRC, it's *NOT* valid C90 or C++98 code. (I'm not sure if GCC > provides > convenience extensions that you may have to disable in a C90 or C++98 > environment.) > > You may find this output of interest: > > gcc -S test.c > cat test.s > > HTH, > --Eljay > > From dinabandhu@lifetreeindia.com Wed Mar 28 14:42:00 2007 From: dinabandhu@lifetreeindia.com (Dinabandhu Mitra) Date: Wed, 28 Mar 2007 14:42:00 -0000 Subject: Problem With templates In-Reply-To: <17930.24528.153425.55629@zebedee.pink> Message-ID: <009001c77146$00049c20$cf01a8c0@dinu> Ok ... Thx. -----Original Message----- From: Andrew Haley [mailto:aph@redhat.com] Sent: Wednesday, March 28, 2007 6:00 PM To: Dinabandhu Mitra Cc: 'Daniel Llorens del R?o'; gcc-help@gcc.gnu.org Subject: RE: Problem With templates Dinabandhu Mitra writes: > Thanks a lot ... it worked. I am just wondering how this works on other > compilers ... is it a issue with gcc or other compilers? gcc has improved its standards compliance. Andrew. > > -----Original Message----- > From: Daniel Llorens del R?o [mailto:daniel.llorens@bluewin.ch] > Sent: Wednesday, March 28, 2007 4:52 PM > To: Dinabandhu Mitra; gcc-help@gcc.gnu.org > Subject: Re: Problem With templates > > > On 28 Mar, 2007, at 13:02, Dinabandhu Mitra wrote: > > > std::list::iterator c; > > try > > typename std::list::iterator c; > > > -- Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Directors: Michael Cunningham (USA), Charlie Peters (USA) and David Owens (Ireland) From eljay@adobe.com Wed Mar 28 14:56:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Wed, 28 Mar 2007 14:56:00 -0000 Subject: what's this syntax ? In-Reply-To: Message-ID: Hi Michael, > However, to clarify a bit, I don't think it's a valid C99 code. Hmmm, I think you are correct. It appears to be a GNU extension. (I haven't programmed in C since 1990, so I haven't bumped into the extension.) Thanks for the finding the link. Sincerely, --Eljay From iant@google.com Wed Mar 28 17:36:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Wed, 28 Mar 2007 17:36:00 -0000 Subject: list of warning messages In-Reply-To: <1d9535c10703280421h50245179qa2244d0b2fb1e721@mail.gmail.com> References: <1d9535c10703280421h50245179qa2244d0b2fb1e721@mail.gmail.com> Message-ID: "Domen Vrankar" writes: > does anyone know if there is somekind of documentation that contains > list and description of all warning/error messages that gcc outputs? There is no such documentation. Sorry. Ian From Vladimir.Simonov@acronis.com Wed Mar 28 18:04:00 2007 From: Vladimir.Simonov@acronis.com (Vladimir Simonov) Date: Wed, 28 Mar 2007 18:04:00 -0000 Subject: gcc forgets to decrease esp after function call In-Reply-To: <17918.51298.795800.290992@zebedee.pink> References: <45F15674.9000701@acronis.com> <17905.22833.766154.45450@zebedee.pink> <45F1681A.6030307@acronis.com> <17905.28252.856544.931176@zebedee.pink> <45F180B3.50901@acronis.com> <17905.33869.537927.207102@zebedee.pink> <45F1A223.6060406@acronis.com> <17905.42424.400663.138838@zebedee.pink> <45F292DA.30804@acronis.com> <17908.16759.282405.262830@zebedee.pink> <45F653D5.8070500@acronis.com> <17910.32685.453760.827798@zebedee.pink> <45F6E269.1050201@acronis.com> <17910.58546.897282.378139@zebedee.pink> <45F80E6C.5090601@acronis.com> <17913.5853.465646.305627@zebedee.pink> <45F92EC7.2000106@acronis.com> <17913.12323.646294.479431@zebedee.pink> <45F984DB.3050201@acronis.com> <17918.27050.815012.142815@zebedee.pink> <45FEBBAD.1090604@acronis.com> <17918.51298.795800.290992@zebedee.pink> Message-ID: <460AA7A2.50205@acronis.com> Andrew Haley wrote: > Vladimir Simonov writes: > > > > > > Andrew Haley wrote: > > > Vladimir Simonov writes: > > > > Andrew Haley wrote: > > > > > Vladimir Simonov writes: > > > > > > Andrew Haley wrote: > > > > > > > Vladimir Simonov writes: > > > > > > > > > > Fillet that, and you will have a test case that can be submitted. > > > > > > > > > > > > It requires a lot of mannual work - remove a peace of code, then > > > > > > check that the test can be built, the check that the bug did not > > > > > > disappear, etc. > > > > > > > > > > It's your code, so presumably you are familiar with it. I stepped > > > > > though the code in gdb, and it seemed that not many routines were > > > > > actually involved. > > > > > > > > We have tried to minimize the test but without significant success. > > > > If we try to create simple test case from scratch we can't > > > > reproduce the problem. I have a feeling the problem appears > > > > if huge templated code involved into codegeneration. > > > > > > > > If I understand correct it is impossible to file this > > > > bug to gcc bugzilla - it does not permit attachements. > > > > > > > > Do you think I need to post the problem to some another > > > > list to get it solved? Or just leave it( and you :) ) alone? > > > > > > It all depends on what you need. I have this feeling that your > > > problem may well be fixed by a more recent g++. It's hard to be sure, > > > because your test case does not even compile with a more recent g++. > > > This is, I suspect, becasue we have improved g++ to be closer to the > > > real ISO C++ standard. > > > > > > g++ Version 4.3 reports a number of type mismatch errors in the area > > > that may be causing problems. It is quite possible that if you fix > > > these errors your problem will go away. > > Hi, Unfortunatelly I had no time to play with gcc 4.3 but we have some progress. 1. We put the function returning object into "for". So the test always crashes if generated code in incorrect ("sub $0x4, esp" after function call is missed). The previous test not always crashed if esp corrupted. It depended on how esp is used after call(and function exit method - via "add XXX, esp" or "mov ebp, esp"). Now stack is "eaten" by "for" if "sub $0x4, esp" is missed. 2. Then we found optimization option which leads to incorrect code generation. It is -ftree-sra. At the moment our problem is solved. Probably new test and knowlege about the option will help somebody to find and to fix the bug. Thank you. Regards Vladimir -------------- next part -------------- A non-text attachment was scrubbed... Name: gcc_bug.tgz Type: application/x-gzip Size: 81947 bytes Desc: not available URL: From rbanfield@flenvironmental.org Wed Mar 28 18:25:00 2007 From: rbanfield@flenvironmental.org (Robert Banfield) Date: Wed, 28 Mar 2007 18:25:00 -0000 Subject: Seemingly identical gcc versions, except one searches subdirectories with -I Message-ID: <460AAE2C.1040205@flenvironmental.org> I have come across this problem and despite my searches I have been unable to find a solution. I have two Fedora Core 6 machines. Both have the same version of gcc/g++ and the development programs/libraries installed. Both are x86_64. When I run the command: [rbanfiel@localhost BobBackup]$ g++ -v -Ijasper-uuid/src/libjasper/include -Iinclude -Igdal/port -Igdal/gcore -Igdal/alg -Igdal/ogr -Igdal/frmts -Izlib -Ipoco/XML/include -Ipoco/Foundation/include -Iinfo-zip -DUSE_ZLIB -DNO_CRYPT -DHAVE_JASPER_UUID -D_unzip_H -Dcimg_display_type=0 -c abc.cpp -o abc.o I get largely the same output, except for the result. On one machine, it compiles (yay!). On the other machine, it complains about a missing header file. The header file cpl_config.h is located in gdal/ogr/ogrsf_frmts/dgn/dist which is a subdirectory of gdal/ogr which is specified on the command line above. I can successfully get it to compile by using -Igdal/ogr/ogrsf_frmts/dgn/dist. Unfortunately there are tons of subdirectories in the various libraries I am including, and I'd love to not have to specify each and every one. A diff on the outputs of both versions with the -v flag shows the following: 7c7 < /usr/libexec/gcc/x86_64-redhat-linux/4.1.1/cc1plus -quiet -v -Ijasper-uuid/src/libjasper/include -Iinclude -Igdal/port -Igdal/gcore -Igdal/alg -Igdal/ogr -Igdal/frmts -Izlib -Ipoco/XML/include -Ipoco/Foundation/include -Iinfo-zip -D_GNU_SOURCE -DUSE_ZLIB -DNO_CRYPT -DHAVE_JASPER_UUID -D_unzip_H -Dcimg_display_type=0 abc.cpp -quiet -dumpbase abc.cpp -mtune=generic -auxbase-strip abc.o -version -o /tmp/ccwnikzF.s --- > /usr/libexec/gcc/x86_64-redhat-linux/4.1.1/cc1plus -quiet -v -Ijasper-uuid/src/libjasper/include -Iinclude -Igdal/port -Igdal/gcore -Igdal/alg -Igdal/ogr -Igdal/frmts -Izlib -Ipoco/XML/include -Ipoco/Foundation/include -Iinfo-zip -D_GNU_SOURCE -DUSE_ZLIB -DNO_CRYPT -DHAVE_JASPER_UUID -D_unzip_H -Dcimg_display_type=0 abc.cpp -quiet -dumpbase abc.cpp -mtune=generic -auxbase-strip abc.o -version -o /tmp/ccsoGgbf.s // The only difference is the /tmp/cc??????.s file 31c31 < GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 --- > GGC heuristics: --param ggc-min-expand=46 --param ggc-min-heapsize=31513 // I tried specifying these parameters manually on the second machine with no change in result 33,35c33,37 < as -V -Qy -o abc.o /tmp/ccwnikzF.s < GNU assembler version 2.17.50.0.6-2.fc6 (x86_64-redhat-linux) using BFD version 2.17.50.0.6-2.fc6 20061020 --- > In file included from gdal/port/cpl_vsi.h:87, > from gdal/port/cpl_string.h:84, > from abc.h:25, > from abc.cpp:24: > gdal/port/cpl_port.h:148:24: error: cpl_config.h: No such file or directory // One compiles, the other doesn't. I have checked my environment also and come up with nothing which would explain the difference in behaviors. Finally, here is a log from the compile on the machine in which it worked. Using built-in specs. Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux Thread model: posix gcc version 4.1.1 20070105 (Red Hat 4.1.1-51) /usr/libexec/gcc/x86_64-redhat-linux/4.1.1/cc1plus -quiet -v -Ijasper-uuid/src/libjasper/include -Iinclude -Igdal/port -Igdal/gcore -Igdal/alg -Igdal/ogr -Igdal/frmts -Izlib -Ipoco/XML/include -Ipoco/Foundation/include -Iinfo-zip -D_GNU_SOURCE -DUSE_ZLIB -DNO_CRYPT -DHAVE_JASPER_UUID -D_unzip_H -Dcimg_display_type=0 weokml.cpp -quiet -dumpbase weokml.cpp -mtune=generic -auxbase-strip weokml.o -version -o /tmp/ccOGy0G5.s ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../x86_64-redhat-linux/include" #include "..." search starts here: #include <...> search starts here: jasper-uuid/src/libjasper/include include gdal/port gdal/gcore gdal/alg gdal/ogr gdal/frmts zlib poco/XML/include poco/Foundation/include info-zip /usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../include/c++/4.1.1 /usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../include/c++/4.1.1/x86_64-redhat-linux /usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../include/c++/4.1.1/backward /usr/local/include /usr/lib/gcc/x86_64-redhat-linux/4.1.1/include /usr/include End of search list. GNU C++ version 4.1.1 20070105 (Red Hat 4.1.1-51) (x86_64-redhat-linux) compiled by GNU C version 4.1.1 20070105 (Red Hat 4.1.1-51). GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: c1be8c277545876a2f11bc40e8290a2f as -V -Qy -o weokml.o /tmp/ccOGy0G5.s GNU assembler version 2.17.50.0.6-2.fc6 (x86_64-redhat-linux) using BFD version 2.17.50.0.6-2.fc6 20061020 Thank you very much for your time and assistance, Robert From satyaakam@gmail.com Wed Mar 28 18:35:00 2007 From: satyaakam@gmail.com (satyaakam goswami) Date: Wed, 28 Mar 2007 18:35:00 -0000 Subject: [AIX] gcc cannot compile huge c file Message-ID: <6491e1350703281125r1af2703cia8a9a696769b2489@mail.gmail.com> Hello All, We have been hit by this bug http://gcc.gnu.org/bugzilla/show_bug.cgi?id=378, We are getting the same error "line 599772: The displacement must be greater than or equal to -32768 and less than or equal to 32767." on AIX 5.3.0.0 , with gcc 3.2.3. Bug is in Suspended state, does look to be fixed in near future, any workaround for this bug will surely help. TIA Satya From dima.sorkin@gmail.com Wed Mar 28 19:56:00 2007 From: dima.sorkin@gmail.com (Dima Sorkin) Date: Wed, 28 Mar 2007 19:56:00 -0000 Subject: OpenMP on gcc Message-ID: Hi. I have some c++ code that should compile both under GCCs (starting from gcc 3.1 to 4.0) and other compiler. I want to insert OpenMP pragmas into code, to optimize it. 1) Starting from which version does GCC support OpenMP ? 2) Will old versions of GCC just ignore OpenMP pragmas, or these will cause errors ? Thank you. Dima. From wjposer@ldc.upenn.edu Wed Mar 28 21:29:00 2007 From: wjposer@ldc.upenn.edu (William J Poser) Date: Wed, 28 Mar 2007 21:29:00 -0000 Subject: command line order of object files and libraries Message-ID: <20070328195556.E0603B290E@lorax.ldc.upenn.edu> I have always (since 1982) believed that when compiling C on *nix object files should precede libraries on the command line since the linker processes files in the same order and only loads library routines to which it has seen references at that point. This belief is supported by the Single Unix spec and by the current gcc info files (under "Link Options"), as well as other documents that I have been able to find, such as the Apple Developer docs for gcc. Yesterday I tried to compile a program I encountered on Freshmeat where the link failed because the Makefile had the libraries before the object files. When I raised this with the author of the program, he said that I was only the second person in many years to encounter this problem and that he himself uses gcc on GNU/Linux and did not encounter it. I have heard that there are linkers that do not work this way, but do not recall ever actually encountering one, and am surprised to hear of this behavior with gcc on GNU/Linux. Have I misunderstood the expected behavior of gcc? If not, can anyone explain why the author of the program in question describes such different behavior? Thanks. Bill From ferad.zyulkyarov@bsc.es Wed Mar 28 22:14:00 2007 From: ferad.zyulkyarov@bsc.es (Ferad Zyulkyarov) Date: Wed, 28 Mar 2007 22:14:00 -0000 Subject: OpenMP on gcc In-Reply-To: References: Message-ID: As I know, OpenMP is being implemented since version 4.2+ But these gcc versions does not have official release. Based on my experience, I compiled few simple OpenMP programs in gcc and I was satisfied. > 1) Starting from which version does GCC support OpenMP ? As I know 4.2 > 2) Will old versions of GCC just ignore OpenMP pragmas, or these > will cause errors ? Based on the pragma specification unknown pragmas are ignored. But you have to deal with the omp_* stuff (i.e. omp_set_lock function) Regards, Ferad -- Ferad Zyulkyarov Barcelona Supercomputing Center From n8tm@aol.com Wed Mar 28 22:38:00 2007 From: n8tm@aol.com (Tim Prince) Date: Wed, 28 Mar 2007 22:38:00 -0000 Subject: OpenMP on gcc In-Reply-To: References: Message-ID: <460AE8BC.3030504@aol.com> ferad.zyulkyarov@bsc.es wrote: > As I know, OpenMP is being implemented since version 4.2+ But these > gcc versions does not have official release. Based on my experience, I > compiled few simple OpenMP programs in gcc and I was satisfied. > The one problem I have had is that gfortran rejects EQUIVALENCE in threadprivate COMMON blocks, as used extensively in legacy applications. I haven't investigated whether any standards bear on this (admittedly undesirable) practice. From ferad.zyulkyarov@bsc.es Wed Mar 28 23:10:00 2007 From: ferad.zyulkyarov@bsc.es (Ferad Zyulkyarov) Date: Wed, 28 Mar 2007 23:10:00 -0000 Subject: OpenMP on gcc In-Reply-To: <460AE8BC.3030504@aol.com> References: <460AE8BC.3030504@aol.com> Message-ID: Hi, My e-mail address appears on the previous message under this thread. I would like to ask the admins if it is possible to delete it (because of the spam). Thanks in advance, Ferad From iant@google.com Wed Mar 28 23:41:00 2007 From: iant@google.com (Ian Lance Taylor) Date: Wed, 28 Mar 2007 23:41:00 -0000 Subject: command line order of object files and libraries In-Reply-To: <20070328195556.E0603B290E@lorax.ldc.upenn.edu> References: <20070328195556.E0603B290E@lorax.ldc.upenn.edu> Message-ID: wjposer@ldc.upenn.edu (William J Poser) writes: > I have always (since 1982) believed that when compiling C on *nix > object files should precede libraries on the command line since > the linker processes files in the same order and only loads > library routines to which it has seen references at that point. > This belief is supported by the Single Unix spec and by > the current gcc info files (under "Link Options"), > as well as other documents that I have been able to find, > such as the Apple Developer docs for gcc. > > Yesterday I tried to compile a program I encountered > on Freshmeat where the link failed because the Makefile > had the libraries before the object files. When I raised > this with the author of the program, he said that I was > only the second person in many years to encounter this > problem and that he himself uses gcc on GNU/Linux and did > not encounter it. I have heard that there are linkers > that do not work this way, but do not recall ever actually > encountering one, and am surprised to hear of this > behavior with gcc on GNU/Linux. > > Have I misunderstood the expected behavior of gcc? > If not, can anyone explain why the author of the > program in question describes such different > behavior? Thanks. This is a question about the linker, not about the compiler. The linker is part of the GNU binutils. See http://sourceware.org/binutils/. You are correct in your description of how the GNU linker behaves: it retains the order of object files and libraries, and the order matters. However, this is mostly only true when using .a archives. When using .so shared libraries things work differently. Perhaps the GNU/Linux build uses shared libraries? Ian From wjposer@ldc.upenn.edu Thu Mar 29 00:06:00 2007 From: wjposer@ldc.upenn.edu (William J Poser) Date: Thu, 29 Mar 2007 00:06:00 -0000 Subject: command line order of object files and libraries Message-ID: <20070328234102.64982B2790@lorax.ldc.upenn.edu> Just to close this off, it looks like the problem is that on most systems the library in question is usually dynamically linked, in which case the ordering constraints do not apply, and that the problem only arises on the odd system like my desktop in which either the shared library does not exist or is in a different directory lower on the path so that static linkage is attempted. Bill From sgk@troutmask.apl.washington.edu Thu Mar 29 01:27:00 2007 From: sgk@troutmask.apl.washington.edu (Steve Kargl) Date: Thu, 29 Mar 2007 01:27:00 -0000 Subject: OpenMP on gcc In-Reply-To: <460AE8BC.3030504@aol.com> References: <460AE8BC.3030504@aol.com> Message-ID: <20070329000545.GA53241@troutmask.apl.washington.edu> On Wed, Mar 28, 2007 at 03:14:20PM -0700, Tim Prince wrote: > ferad.zyulkyarov@bsc.es wrote: > >As I know, OpenMP is being implemented since version 4.2+ But these > >gcc versions does not have official release. Based on my experience, I > >compiled few simple OpenMP programs in gcc and I was satisfied. > > > > The one problem I have had is that gfortran rejects EQUIVALENCE in > threadprivate COMMON blocks, as used extensively in legacy applications. > I haven't investigated whether any standards bear on this (admittedly > undesirable) practice. The OpenMP vwrsion 2.5 spec is available on line. A variable can only appear in a threadprivate directive in the scope in which it is declared. It must not be an element of a common block or be declared in an EQUIVALENCE statement. -- Steve From eager@eagercon.com Thu Mar 29 01:54:00 2007 From: eager@eagercon.com (Michael Eager) Date: Thu, 29 Mar 2007 01:54:00 -0000 Subject: Seemingly identical gcc versions, except one searches subdirectories with -I In-Reply-To: <460AAE2C.1040205@flenvironmental.org> References: <460AAE2C.1040205@flenvironmental.org> Message-ID: <460B15FF.3040607@eagercon.com> Robert Banfield wrote: > > In file included from gdal/port/cpl_vsi.h:87, > > from gdal/port/cpl_string.h:84, > > from abc.h:25, > > from abc.cpp:24: > > gdal/port/cpl_port.h:148:24: error: cpl_config.h: No such file or > directory I'll take it that cpl_config.h does exist on both systems. Are the versions of cpl_port.h identical? -- Michael Eager eager@eagercon.com 1960 Park Blvd., Palo Alto, CA 94306 650-325-8077 From glegoo@gmail.com Thu Mar 29 02:27:00 2007 From: glegoo@gmail.com (Wei Hu) Date: Thu, 29 Mar 2007 02:27:00 -0000 Subject: How to dump all the optimization flags enabled? Message-ID: <5be025980703281853r340a4a80rebb337bde8d5004b@mail.gmail.com> Hello, Is there a way to tell gcc to print out all the effective optimization flags when it compiles a C file? I know the manual tells you what flags are set at different optimization levels, but I'm still looking for an answer to my question because it will be useful to my project. Thanks! From quanhn@cse.unsw.EDU.AU Thu Mar 29 05:55:00 2007 From: quanhn@cse.unsw.EDU.AU (Quan H. Nguyen) Date: Thu, 29 Mar 2007 05:55:00 -0000 Subject: need help: gcc rtl function calls Message-ID: <34450.129.94.173.0.1175135254.squirrel@webmail.cse.unsw.edu.au> Dear gcc, I am currently a PhD student at CSE, UNSW, Australia. I am looking a way to output the memory address of an insn (rtx), in the format="%lu". At the moment, I know how to get the memory address like: find_mem_reference( insn, &mem, write); address= XEXP (mem, 0); Also I know that I need to place some rtl codes like: start_sequence(); ...... end_sequence(); But I could not find any hints to create a function call to place into the dots. Even with a simple call to the builtin printf e.g. expand_builtin_printf(). Don't know how to create argument list, formating, and function call. I am looking around on the internet, gcc documentation, mailing list ... for a month, but could not solve this. Look forward to your advice. Many thanks. Regards, Quan From facundofc@gmail.com Thu Mar 29 06:52:00 2007 From: facundofc@gmail.com (Facundo Ciccioli) Date: Thu, 29 Mar 2007 06:52:00 -0000 Subject: Shifting: what's going on? Message-ID: <56aed05a0703282255ybc55393xeeb8215606fe8cc7@mail.gmail.com> Hi. What follows applies to gcc (GCC) 3.4.2 (mingw-special), platform x86-32bits. This code: int main() { unsigned long long a= 1; unsigned s= 63; a= (a << s); return 0; } generates this assembler (removing preamble and prologue stuff): movl $1, -8(%ebp) movl $0, -4(%ebp) movl $63, -12(%ebp) movl -12(%ebp), %ecx movl -8(%ebp), %eax movl -4(%ebp), %edx shldl %cl,%eax, %edx sall %cl, %eax testb $32, %cl je L2 movl %eax, %edx movl $0, %eax L2: movl %eax, -8(%ebp) movl %edx, -4(%ebp) This is fine, and works as I expect. However, this code: int main() { unsigned long long a; unsigned s= 63; a= (1 << s); return 0; } generates this assembler: movl $63, -12(%ebp) movl -12(%ebp), %ecx movl $1, %eax sall %cl, %eax cltd movl %eax, -8(%ebp) movl %edx, -4(%ebp) which is... wrong. Not only the results aren't what they should, but looking a little harder, the assembler generated doesn't seem to make sense. What's with the CLTD instruction there? If I change s (the shifted amount) to be 63 (31 is equivalent, because only 5 bits of %cl are used) then the result are a bunch of 1's because the sign of %eax goes all over %edx. And that's only one problem. If s is between 62 and 32, the 1 appears in %eax instead of being in %edx, where it should. This is obviusly not urgent, since the first code is perfectly acceptable and applicable to what I am doing, but I just got curious. Thanks a lot. FaQ From me@rupey.net Thu Mar 29 08:52:00 2007 From: me@rupey.net (Rupert Wood) Date: Thu, 29 Mar 2007 08:52:00 -0000 Subject: Shifting: what's going on? In-Reply-To: <56aed05a0703282255ybc55393xeeb8215606fe8cc7@mail.gmail.com> References: <56aed05a0703282255ybc55393xeeb8215606fe8cc7@mail.gmail.com> Message-ID: <085701c771ce$cf608780$6e219680$@net> Facundo Ciccioli wrote: > unsigned long long a; > unsigned s= 63; > > a= (1 << s); The problem is that 1 is a signed integer constant not an unsigned long long constant, and there's no mechanism to automatically spot that you really meant it to be an unsigned long long constant. So this code does mean compute a shift on a 32-bit integer then extend the result into a 64-bit variable. Try: a = (1ULL << s); instead. Rup. ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ From tim@klingt.org Thu Mar 29 09:39:00 2007 From: tim@klingt.org (Tim Blechmann) Date: Thu, 29 Mar 2007 09:39:00 -0000 Subject: asm problem with and without -fPIC on x86 Message-ID: <1175158653.9488.57.camel@localhost> hi all, i've got the following problem: i am using the atomic_ops library to use the cmpxchg8b opcode. the specific section for x86 machines looks like this: __asm__ __volatile__("lock; cmpxchg8b %0; setz %1" : "=m"(*addr), "=q"(result) : "m"(*addr), "d" (old_val1), "a" (old_val2), "c" (new_val1), "b" (new_val2) : "memory"); unfortunately, this doesn't compile, when building as a shared library with the -fPIC flag, as the `b` register can't be used. so i wrote a workaround: __asm__ __volatile__("push %%ebx; movl %6,%%ebx; lock; cmpxchg8b %0; setz %1; pop %%ebx" : "=m"(*addr), "=q"(result) : "m"(*addr), "d" (old_val1), "a" (old_val2), "c" (new_val1), "m" (new_val2) : "memory"); this piece of code works fine if the -fPIC flag is enabled. but when compiling this without -fPIC and switching on optimization (-O), the code compiles, but doesn't work correctly anymore. without optimization it works fine, though. is this a compiler bug or a user bug? thanks in advance, tim -- tim@klingt.org ICQ: 96771783 http://tim.klingt.org Nothing exists until or unless it is observed. An artist is making something exist by observing it. And his hope for other people is that they will also make it exist by observing it. I call it 'creative observation.' Creative viewing. William S. Burroughs -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: From aph@redhat.com Thu Mar 29 09:42:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 29 Mar 2007 09:42:00 -0000 Subject: How to dump all the optimization flags enabled? In-Reply-To: <5be025980703281853r340a4a80rebb337bde8d5004b@mail.gmail.com> References: <5be025980703281853r340a4a80rebb337bde8d5004b@mail.gmail.com> Message-ID: <17931.35118.255175.388522@zebedee.pink> Wei Hu writes: > Hello, > > Is there a way to tell gcc to print out all the effective optimization > flags when it compiles a C file? > I know the manual tells you what flags are set at different > optimization levels, but I'm still looking for an answer to my > question because it will be useful to my project. Yes. -fverbose-asm dumps the flags to the .s file. Andrew. -- Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK Registered in England and Wales No. 3798903 From aph@redhat.com Thu Mar 29 09:47:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 29 Mar 2007 09:47:00 -0000 Subject: Shifting: what's going on? In-Reply-To: <56aed05a0703282255ybc55393xeeb8215606fe8cc7@mail.gmail.com> References: <56aed05a0703282255ybc55393xeeb8215606fe8cc7@mail.gmail.com> Message-ID: <17931.35327.294152.153125@zebedee.pink> Facundo Ciccioli writes: > Hi. What follows applies to gcc (GCC) 3.4.2 (mingw-special), platform > x86-32bits. > > This code: > > int main() { > unsigned long long a= 1; > unsigned s= 63; > > a= (a << s); > > return 0; > } > generates this assembler (removing preamble and prologue stuff): > > movl $1, -8(%ebp) > movl $0, -4(%ebp) > movl $63, -12(%ebp) > movl -12(%ebp), %ecx > movl -8(%ebp), %eax > movl -4(%ebp), %edx > shldl %cl,%eax, %edx > sall %cl, %eax > testb $32, %cl > je L2 > movl %eax, %edx > movl $0, %eax > L2: > movl %eax, -8(%ebp) > movl %edx, -4(%ebp) > > This is fine, and works as I expect. > However, this code: > > int main() { > unsigned long long a; > unsigned s= 63; > > a= (1 << s); > > return 0; > } > generates this assembler: > > movl $63, -12(%ebp) > movl -12(%ebp), %ecx > movl $1, %eax > sall %cl, %eax > cltd > movl %eax, -8(%ebp) > movl %edx, -4(%ebp) > which is... wrong. Not only the results aren't what they should, but > looking a little harder, the assembler generated doesn't seem to make > sense. What's with the CLTD instruction there? If I change s (the > shifted amount) to be 63 (31 is equivalent, because only 5 bits of %cl > are used) then the result are a bunch of 1's because the sign of %eax > goes all over %edx. And that's only one problem. If s is between 62 > and 32, the 1 appears in %eax instead of being in %edx, where it > should. > > This is obviusly not urgent, since the first code is perfectly > acceptable and applicable to what I am doing, but I just got curious. This is an arithmetic overflow, and is explicitly undefined. One result is as good as any other. What do you expect the code to do? Andrew. -- Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK Registered in England and Wales No. 3798903 From aph@redhat.com Thu Mar 29 10:03:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 29 Mar 2007 10:03:00 -0000 Subject: asm problem with and without -fPIC on x86 In-Reply-To: <1175158653.9488.57.camel@localhost> References: <1175158653.9488.57.camel@localhost> Message-ID: <17931.35605.37170.525947@zebedee.pink> Tim Blechmann writes: > hi all, > > i've got the following problem: > i am using the atomic_ops library to use the cmpxchg8b opcode. the > specific section for x86 machines looks like this: > > __asm__ __volatile__("lock; cmpxchg8b %0; setz %1" > : "=m"(*addr), "=q"(result) > : "m"(*addr), "d" (old_val1), "a" (old_val2), > "c" (new_val1), "b" (new_val2) : "memory"); > > unfortunately, this doesn't compile, when building as a shared library > with the -fPIC flag, as the `b` register can't be used. > so i wrote a workaround: > > __asm__ __volatile__("push %%ebx; movl %6,%%ebx; lock; cmpxchg8b %0; setz %1; pop %%ebx" > : "=m"(*addr), "=q"(result) > : "m"(*addr), "d" (old_val1), "a" (old_val2), > "c" (new_val1), "m" (new_val2) : "memory"); > > this piece of code works fine if the -fPIC flag is enabled. but when > compiling this without -fPIC and switching on optimization (-O), the > code compiles, but doesn't work correctly anymore. without optimization > it works fine, though. > > is this a compiler bug or a user bug? You know, this would have been *so* much easier to figure out it you'd provided a test case. Andrew. -- Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK Registered in England and Wales No. 3798903 From brian@dessent.net Thu Mar 29 13:05:00 2007 From: brian@dessent.net (Brian Dessent) Date: Thu, 29 Mar 2007 13:05:00 -0000 Subject: asm problem with and without -fPIC on x86 References: <1175158653.9488.57.camel@localhost> Message-ID: <460B8ED0.4BB7DB28@dessent.net> Tim Blechmann wrote: > i've got the following problem: > i am using the atomic_ops library to use the cmpxchg8b opcode. the > specific section for x86 machines looks like this: > > __asm__ __volatile__("lock; cmpxchg8b %0; setz %1" > : "=m"(*addr), "=q"(result) > : "m"(*addr), "d" (old_val1), "a" (old_val2), > "c" (new_val1), "b" (new_val2) : "memory"); > > unfortunately, this doesn't compile, when building as a shared library > with the -fPIC flag, as the `b` register can't be used. > so i wrote a workaround: > > __asm__ __volatile__("push %%ebx; movl %6,%%ebx; lock; cmpxchg8b %0; setz %1; pop %%ebx" > : "=m"(*addr), "=q"(result) > : "m"(*addr), "d" (old_val1), "a" (old_val2), > "c" (new_val1), "m" (new_val2) : "memory"); > > this piece of code works fine if the -fPIC flag is enabled. but when > compiling this without -fPIC and switching on optimization (-O), the > code compiles, but doesn't work correctly anymore. without optimization > it works fine, though. > > is this a compiler bug or a user bug? Can't you just use the builtin and let gcc worry about it? result = __sync_bool_compare_and_swap (*addr, old_val, new_val); http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html#index-g_t_005f_005fsync_005fbool_005fcompare_005fand_005fswap-2118 Brian From ssam0201@yahoo.co.in Thu Mar 29 14:26:00 2007 From: ssam0201@yahoo.co.in (sameer sinha) Date: Thu, 29 Mar 2007 14:26:00 -0000 Subject: gcc-3.4.6 build failed for Ada Message-ID: <205577.98660.qm@web8504.mail.in.yahoo.com> hello i am trying to build gcc for Language ada for cross target. after successful building in my build directory. i reached the directory gcc/ ans i ran the command $ make gnatlib then i got the error,which i am unable to understad what this is???? please help f any one can help to me........................... the error is as follows: ../../xgcc -B../../ -c -g -O2 -W -Wall -gnatpg a-comlin.adb -o a-comlin.o +===========================GNAT BUG DETECTED==============================+ | 3.4.6 (i960-unknown-coff) Storage_Error stack overflow (or erroneous memory access)| | Error detected at a-comlin.adb:36:17 | | Please submit a bug report; see http://gcc.gnu.org/bugs.html. | | Include the entire contents of this bug box in the report. | | Include the exact gcc or gnatmake command that you entered. | | Also include sources listed below in gnatchop format | | (concatenated together with no headers between files). | +==========================================================================+ compilation abandoned. Thanks & Regards sameer kumar sinha Project Engineer C-DAC Knowledge Park #1, Old Madras Road Bangalore - 560 038, INDIA __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/ From renegade22@gmx.net Thu Mar 29 14:58:00 2007 From: renegade22@gmx.net (Robert Meier) Date: Thu, 29 Mar 2007 14:58:00 -0000 Subject: newlib and interworking Message-ID: <20070329142548.243920@gmx.net> Hi all, i try to compile newlib (on suse linux 10.1 with gcc 4.0.2 20050901) which supports interworking. i hope you can help me. i have to compile these three packages newlib-1.13.0 gcc-3.4.3 binutlis-2.15 i had comiled the newlib and gcc with: ../gcc-3.4.3/configure --target=arm-elf --with-float=soft --enable-multilib --enable-interwork --enable-languages=c,c++ --enable-target-optspace --disable-newlib-multithread 2>&1 | tee ../configure-gcc.out and binutils with: ../(binutils)/configure --target=arm-elf --with-float=soft --enable-multilib --enable-interwork after successfully compiling this error occurs: /usr/local/lib/gcc/arm-elf/3.4.3/../../../../arm-elf/bin/ld: Warning: /usr/local/lib/gcc/arm-elf/3.4.3/../../../../arm-elf/lib/thumb/libc.a(strlen.o) does not support interworking, whereas Foo.elf does and this many times i also did not have the directories which are in the inet are often specified like: /usr/local/arm-elf/lib/interwork /usr/local/arm-elf/lib/mthumb/interwork i only have /usr/local/arm-elf/lib/mthumb Does smb. know what my problem could be? Thx, Robert Meier -- "Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ... Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail From facundofc@gmail.com Thu Mar 29 15:05:00 2007 From: facundofc@gmail.com (Facundo Ciccioli) Date: Thu, 29 Mar 2007 15:05:00 -0000 Subject: Shifting: what's going on? In-Reply-To: <17931.35327.294152.153125@zebedee.pink> References: <56aed05a0703282255ybc55393xeeb8215606fe8cc7@mail.gmail.com> <17931.35327.294152.153125@zebedee.pink> Message-ID: <56aed05a0703290758o64818a1av84efd4e3f4b0f141@mail.gmail.com> I expect to get a 1 in the s-th bit of a, and zeroes in all other bits. I don't know why you say that's an arithmetic overflow, if unsigned long long is 64 bits long and it has a 63-th bit (the last one). Anyway, Rupert Wood comment works, thanks a lot. FaQ 2007/3/29, Andrew Haley : > Facundo Ciccioli writes: > > Hi. What follows applies to gcc (GCC) 3.4.2 (mingw-special), platform > > x86-32bits. > > > > This code: > > > > int main() { > > unsigned long long a= 1; > > unsigned s= 63; > > > > a= (a << s); > > > > return 0; > > } > > generates this assembler (removing preamble and prologue stuff): > > > > movl $1, -8(%ebp) > > movl $0, -4(%ebp) > > movl $63, -12(%ebp) > > movl -12(%ebp), %ecx > > movl -8(%ebp), %eax > > movl -4(%ebp), %edx > > shldl %cl,%eax, %edx > > sall %cl, %eax > > testb $32, %cl > > je L2 > > movl %eax, %edx > > movl $0, %eax > > L2: > > movl %eax, -8(%ebp) > > movl %edx, -4(%ebp) > > > > This is fine, and works as I expect. > > However, this code: > > > > int main() { > > unsigned long long a; > > unsigned s= 63; > > > > a= (1 << s); > > > > return 0; > > } > > generates this assembler: > > > > movl $63, -12(%ebp) > > movl -12(%ebp), %ecx > > movl $1, %eax > > sall %cl, %eax > > cltd > > movl %eax, -8(%ebp) > > movl %edx, -4(%ebp) > > which is... wrong. Not only the results aren't what they should, but > > looking a little harder, the assembler generated doesn't seem to make > > sense. What's with the CLTD instruction there? If I change s (the > > shifted amount) to be 63 (31 is equivalent, because only 5 bits of %cl > > are used) then the result are a bunch of 1's because the sign of %eax > > goes all over %edx. And that's only one problem. If s is between 62 > > and 32, the 1 appears in %eax instead of being in %edx, where it > > should. > > > > This is obviusly not urgent, since the first code is perfectly > > acceptable and applicable to what I am doing, but I just got curious. > > This is an arithmetic overflow, and is explicitly undefined. One > result is as good as any other. What do you expect the code to do? > > Andrew. > > -- > Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK > Registered in England and Wales No. 3798903 > From Vladimir.Simonov@acronis.com Thu Mar 29 15:06:00 2007 From: Vladimir.Simonov@acronis.com (Vladimir Simonov) Date: Thu, 29 Mar 2007 15:06:00 -0000 Subject: How to dump all the optimization flags enabled? In-Reply-To: <17931.35118.255175.388522@zebedee.pink> References: <5be025980703281853r340a4a80rebb337bde8d5004b@mail.gmail.com> <17931.35118.255175.388522@zebedee.pink> Message-ID: <460BD5A1.3080900@acronis.com> Andrew Haley wrote: > Wei Hu writes: > > Hello, > > > > Is there a way to tell gcc to print out all the effective optimization > > flags when it compiles a C file? > > I know the manual tells you what flags are set at different > > optimization levels, but I'm still looking for an answer to my > > question because it will be useful to my project. > > Yes. -fverbose-asm dumps the flags to the .s file. > > Andrew. > Hi, Sorry, if probably a bit offtopic from subj. I've created flags lists for -O0 and -O2, made diff (see attach) and built my project both with -O0 and -O2 -fno-{all options marked by + in diff}. I've expected that results(binaries) will be equal. But they are different. Are my expectations correct? Or -O0 and -O2 -fno-{all options marked by + in diff} are not the same? Regards Vladimir -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: opts.diff URL: From aph@redhat.com Thu Mar 29 15:07:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 29 Mar 2007 15:07:00 -0000 Subject: Shifting: what's going on? In-Reply-To: <56aed05a0703290758o64818a1av84efd4e3f4b0f141@mail.gmail.com> References: <56aed05a0703282255ybc55393xeeb8215606fe8cc7@mail.gmail.com> <17931.35327.294152.153125@zebedee.pink> <56aed05a0703290758o64818a1av84efd4e3f4b0f141@mail.gmail.com> Message-ID: <17931.54731.338355.53605@zebedee.pink> Facundo Ciccioli writes: > FaQ > > 2007/3/29, Andrew Haley : > > Facundo Ciccioli writes: > > > > > > This is obviusly not urgent, since the first code is perfectly > > > acceptable and applicable to what I am doing, but I just got curious. > > > > This is an arithmetic overflow, and is explicitly undefined. One > > result is as good as any other. What do you expect the code to do? > > > I expect to get a 1 in the s-th bit of a, and zeroes in all other > bits. I don't know why you say that's an arithmetic overflow, if > unsigned long long is 64 bits long and it has a 63-th bit (the last > one). > > Anyway, Rupert Wood comment works, thanks a lot. So, even after Rupert Wood's explanation, you still don't realize that you had written an arithmetic overflow? Let's have a look at your code: int main() { unsigned long long a; unsigned s= 63; a= (1 << s); return 0; } This expression is a 32-bit signed integer constant 1 shifted left 63 places, which overflows: (1 << s); You then assign the result of this overflow to the 64-bit signed integer variable a: a= (1 << s); Andrew. -- Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK Registered in England and Wales No. 3798903 From eljay@adobe.com Thu Mar 29 15:11:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Thu, 29 Mar 2007 15:11:00 -0000 Subject: Shifting: what's going on? In-Reply-To: <56aed05a0703290758o64818a1av84efd4e3f4b0f141@mail.gmail.com> Message-ID: Hi Facundo, > I expect to get a 1 in the s-th bit of a, and zeroes in all other > bits. I don't know why you say that's an arithmetic overflow, if > unsigned long long is 64 bits long and it has a 63-th bit (the last > one). You are not dealing with an unsigned long long that is 64-bits. You are dealing with a signed int that is 32-bits. Shifting a number by an amount equal-to-or-greater-than its bitsize has undefined behavior. --Eljay From aph@redhat.com Thu Mar 29 15:21:00 2007 From: aph@redhat.com (Andrew Haley) Date: Thu, 29 Mar 2007 15:21:00 -0000 Subject: How to dump all the optimization flags enabled? In-Reply-To: <460BD5A1.3080900@acronis.com> References: <5be025980703281853r340a4a80rebb337bde8d5004b@mail.gmail.com> <17931.35118.255175.388522@zebedee.pink> <460BD5A1.3080900@acronis.com> Message-ID: <17931.55047.268978.189667@zebedee.pink> Vladimir Simonov writes: > > Andrew Haley wrote: > > Wei Hu writes: > > > Hello, > > > > > > Is there a way to tell gcc to print out all the effective optimization > > > flags when it compiles a C file? > > > I know the manual tells you what flags are set at different > > > optimization levels, but I'm still looking for an answer to my > > > question because it will be useful to my project. > > > > Yes. -fverbose-asm dumps the flags to the .s file. > > Sorry, if probably a bit offtopic from subj. > > I've created flags lists for -O0 and -O2, > made diff (see attach) and built my project > both with -O0 and -O2 -fno-{all options marked by + in diff}. > > I've expected that results(binaries) will be equal. > But they are different. > > Are my expectations correct? > Or -O0 and -O2 -fno-{all options marked > by + in diff} are not the same? I don't really understand your question, but if you're asking "if I set all individual optimization flags but don't set -O, will that still optimize?" the answer is no. If you're asking "f I unset all individual optimization flags but set -O2, will that be the same as -O0", the answer is no. Andrew. -- Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK Registered in England and Wales No. 3798903 From Vladimir.Simonov@acronis.com Thu Mar 29 15:27:00 2007 From: Vladimir.Simonov@acronis.com (Vladimir Simonov) Date: Thu, 29 Mar 2007 15:27:00 -0000 Subject: How to dump all the optimization flags enabled? In-Reply-To: <17931.55047.268978.189667@zebedee.pink> References: <5be025980703281853r340a4a80rebb337bde8d5004b@mail.gmail.com> <17931.35118.255175.388522@zebedee.pink> <460BD5A1.3080900@acronis.com> <17931.55047.268978.189667@zebedee.pink> Message-ID: <460BD987.6070000@acronis.com> Andrew Haley wrote: > Vladimir Simonov writes: > > > > Andrew Haley wrote: > > > Wei Hu writes: > > > > Hello, > > > > > > > > Is there a way to tell gcc to print out all the effective optimization > > > > flags when it compiles a C file? > > > > I know the manual tells you what flags are set at different > > > > optimization levels, but I'm still looking for an answer to my > > > > question because it will be useful to my project. > > > > > > Yes. -fverbose-asm dumps the flags to the .s file. > > > > Sorry, if probably a bit offtopic from subj. > > > > I've created flags lists for -O0 and -O2, > > made diff (see attach) and built my project > > both with -O0 and -O2 -fno-{all options marked by + in diff}. > > > > I've expected that results(binaries) will be equal. > > But they are different. > > > > Are my expectations correct? > > Or -O0 and -O2 -fno-{all options marked > > by + in diff} are not the same? > > I don't really understand your question, but if you're asking "if I > set all individual optimization flags but don't set -O, will that > still optimize?" the answer is no. If you're asking "f I unset all > individual optimization flags but set -O2, will that be the same as > -O0", the answer is no. > > Andrew. > The second one. Do you know a way to turn on optimization flags step by step from -O0 till -O2? Thank you. Vladimir From eljay@adobe.com Thu Mar 29 20:04:00 2007 From: eljay@adobe.com (John Love-Jensen) Date: Thu, 29 Mar 2007 20:04:00 -0000 Subject: How to dump all the optimization flags enabled? In-Reply-To: <460BD987.6070000@acronis.com> Message-ID: Hi Vladimir, >Do you know a way to turn on optimization flags step by step from -O0 till -O2? No, not possible. Not all optimizations are controlled by specific flags. Some are controlled by -O setting. And -O0 disables all optimizations, even those specified with a specific flag. Sincerely, --Eljay From flopbucket@hotmail.com Thu Mar 29 22:36:00 2007 From: flopbucket@hotmail.com (Flop Bucket) Date: Thu, 29 Mar 2007 22:36:00 -0000 Subject: tree-ssa optimizations In-Reply-To: <17922.46674.998692.167622@zebedee.pink> Message-ID: > > 1) I know that auto-vectorization is done on GIMPLE. > > I think I need to understand entire syntax GIMPLE to > > understand internal files of gcc which does > > auto-vectorization like tree-vectorizer.c. > > Isn't it? > > 2)Where can I get complete syntax of GIMPLE? > >gcc/tree.def > > 3) Is it possible to compile a .gimple/.ssa/.rtl file? > >No. Yes it is. You need to use gicc (was a symlink in previous releases as gimple-gcc). This will compile your .rtl file and generate the proper autovectorization code for you on architectures that support it. > > > Actually I want to modify above representations of > > a .c program and compile the modified file. > > If it is possible tell me how to do? > This can be done, see above. You need to skip the first phases and front end which generates the parse tree, and inject your modifications into the middle-stage where the p-code is generated. Take a look at gimple-gcc. _________________________________________________________________ Watch free concerts with Pink, Rod Stewart, Oasis and more. Visit MSN Presents today. http://music.msn.com/presents?icid=ncmsnpresentstagline&ocid=T002MSN03A07001 From electrofox@gmail.com Thu Mar 29 23:50:00 2007 From: electrofox@gmail.com (Edd Johnson) Date: Thu, 29 Mar 2007 23:50:00 -0000 Subject: Installing gcc: compiler? Message-ID: So gcc needs an existing ISO C90 compiler? Which should I use, and where should I get it. I am running Red Hat EL 4. I'm running in circles trying to install a few things, because they all depend on each other. Any help would be appreciated Thanks, Max (PS, I have the gcc source, but cannot install it. I have no existing c compiler installed. I do not have gcc on my system installation disks.) From chatterjee.digvijoy@gmail.com Fri Mar 30 01:25:00 2007 From: chatterjee.digvijoy@gmail.com (Digvijoy Chatterjee) Date: Fri, 30 Mar 2007 01:25:00 -0000 Subject: g++ option to generate code after template instantiation Message-ID: <9dd10b1d0703291650h31dd2047h7f50254c87b136ca@mail.gmail.com> when i say std::vector is there an option to g++ generate template instantiated source ,before converting C++ to assembly which could show me how the vector looks.... when the appropriate parameters are replaced template struct _Vector_base { struct _Vector_impl : public _Alloc { int* _M_start; int* _M_finish;............. This is a simple example , but if there is such an option this could be really helpful ,to understand complex template instantiations. Thx Digz From sergio.giro.ar@gmail.com Fri Mar 30 01:56:00 2007 From: sergio.giro.ar@gmail.com (Sergio Giro) Date: Fri, 30 Mar 2007 01:56:00 -0000 Subject: Check of throw qualifiers Message-ID: Dear, I would like to know if there are unimplemented checks related to throw qualifiers. E.g., if I have two methods int theClass::oneMethod() throw (AnException) { throw AnException(); return 1; } int theClass::otherMethod () throw () { return oneMethod(); } Should this be an error? gcc does not complain about that. In addition, if I use the method this way try { otherMethod() } catch(AnException); the exception is not catched (because of the "throw ()", I guess). This seems to be quite strange, I think that the idea of using throw qualifiers is to enforce that the only exceptions the caller needs to catch are those declared in the qualifier. So, the "throw ()" should not be possible. I think that the throw () should be possible only if all the invocations to methods throwing exceptions are enclosed into try { } catch blocks. Quoting the manual, is it a "Regrettable thing we can't change" or a "Known problem"? Cheers, Sergio From narkewoody@gmail.com Fri Mar 30 02:37:00 2007 From: narkewoody@gmail.com (Steven Woody) Date: Fri, 30 Mar 2007 02:37:00 -0000 Subject: How to read the linker map file? Message-ID: hi, i used -Wl,-Map=map.txt,--crossref to generated a map file. but i fond the contents in the file are not easy to understand. is there a document or readme descripting what're in the file? thanks. -- woody then sun rose thinly from the sea and the old man could see the other boats, low on the water and well in toward the shore, spread out across the current. From glegoo@gmail.com Fri Mar 30 03:01:00 2007 From: glegoo@gmail.com (Wei Hu) Date: Fri, 30 Mar 2007 03:01:00 -0000 Subject: How to dump all the optimization flags enabled? In-Reply-To: <1175140467.5262.1.camel@localhost.localdomain> References: <5be025980703281853r340a4a80rebb337bde8d5004b@mail.gmail.com> <1175140467.5262.1.camel@localhost.localdomain> Message-ID: <5be025980703291937o4fb8d41dn434448d278861bcb@mail.gmail.com> Thanks to all for the kind answers! On 3/28/07, Ramana Radhakrishnan wrote: > > > On Wed, 2007-03-28 at 21:53 -0400, Wei Hu wrote: > > Hello, > > > > Is there a way to tell gcc to print out all the effective optimization > > flags when it compiles a C file? > > -fverbose-asm prints out all the optimization options to the assembler > files. So a combination of --save-temps and -fverbose-asm + some > scripting magic could do the trick for you . > > cheers > Ramana > -- > cheers > Ramana > > Ramana Radhakrishnan > IDE & Tools Group > Celunite Inc (www.celunite.com) > > > From ken.lu@intel.com Fri Mar 30 05:40:00 2007 From: ken.lu@intel.com (Lu, Ken) Date: Fri, 30 Mar 2007 05:40:00 -0000 Subject: About address alignment of unicode string data Message-ID: <1C601A6A3344064EB423D0C1E83B717B015371FE@pdsmsx411.ccr.corp.intel.com> Hello: I have question about GCC which is in different behavior with MS VC. See following code: wchar_t *TestStr = L"MyString"; If built by MSVC, the address TestStr would align at 16-bit boundary that mean TestStr's address is even. Because the data of L"MyString" is unicode code string. But if build by GCC, the address of TestStr is even or odd but not always even. I have tried many GCC compiler options but seems not compiler options can make the address of TestStr align to even address. My GCC version is 4.0.2. Who can tell me how to control the alignment of const Unicode data L"" in GCC? Thanks. - K Best Regard! ------------------------------------------------------------------------ ------------ Hear and you forget; see and you remember; do and you understand. --Confucius "The content of this message is my personal opinion only and although I am an employee of Intel, the statements I make here in no way represent Intel's position on the issue, nor am I authorized to speak on behalf of Intel on this matter" From tprince@myrealbox.com Fri Mar 30 08:06:00 2007 From: tprince@myrealbox.com (Tim Prince) Date: Fri, 30 Mar 2007 08:06:00 -0000 Subject: Installing gcc: compiler? In-Reply-To: References: Message-ID: <460CA2C1.7080002@myrealbox.com> Edd Johnson wrote: > So gcc needs an existing ISO C90 compiler? Which should I use, and > where should I get it. I am running Red Hat EL 4. The gcc which comes in the development tools option of your Red Hat is the most obvious choice for building gcc. From dreams_arpit@yahoo.co.in Fri Mar 30 08:29:00 2007 From: dreams_arpit@yahoo.co.in (arpit jain) Date: Fri, 30 Mar 2007 08:29:00 -0000 Subject: GDB-6.4 Build Message-ID: <129976.18474.qm@web8414.mail.in.yahoo.com> Hiiii, I have build GDB-6.3 on Linux for some embedded target i.e. cross builded GDB-6.3 for some different target processor.I have builded it succesfully on my host system but wat i am getting is simulator only that comes with GDB for that target.There is no binary for GDB itself so that I can debug my appication. I am getting "i***-unknown-coff-run" binary file only. Q. Can someone plz tell me how to get that GDB also with simulator? Thanks Arpit __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/ From olivier.delannoy@gmail.com Fri Mar 30 10:17:00 2007 From: olivier.delannoy@gmail.com (Olivier Delannoy) Date: Fri, 30 Mar 2007 10:17:00 -0000 Subject: Code Generator: usage of the #line directive Message-ID: <2b9a46b30703300129r12d33701k50fbf6330020bd23@mail.gmail.com> Hello, I have written a code generator which takes an XML document and generate a C++ file. The XML document contains text element which contains C++ code. I would like to be able to locate error message based on the start of the text element. I think the #line directive is to be use for this but I have trouble marking the end of an included section. The code from the XML document behave really like an include and I would like to report errors in the same way. Thanks for your help. -- Olivier Delannoy ATER PRiSM Laboratory Versailles University, FRANCE From eljay@adobe.com Fri Mar 30 11:10:00 2007 From: eljay@adobe.com (John (Eljay) Love-Jensen) Date: Fri, 30 Mar 2007 11:10:00 -0000 Subject: Check of throw qualifiers References: Message-ID: Hi Sergio, > Should this be an error? gcc does not complain about that. It's an error. It's a runtime error, not something GCC will complain about. >Quoting the manual, is it a "Regrettable thing we can't change" or a "Known problem"? In my opinion, a known "C++ exceptions are not as nice as Java exceptions, and I wish they were" regrettable thing we can't change. HTH, --Eljay From cppljevans@suddenlink.net Fri Mar 30 12:27:00 2007 From: cppljevans@suddenlink.net (Larry Evans) Date: Fri, 30 Mar 2007 12:27:00 -0000 Subject: g++-4.3 alignas(const-expr) fails; workaround? Message-ID: <460CE1A0.6030205@suddenlink.net> With g++-4.3-20070323, alignas(2) fails compile with message indicating it needs a type instead of constant expression. Is there any workaround. For example, could I: typedef unsigned char work_around[const-expr]; unsigned char alignas(work_around) actual_var[const-expr] ? TIA. -Larry From vivek.list@gmail.com Fri Mar 30 12:42:00 2007 From: vivek.list@gmail.com (vivek tyagi) Date: Fri, 30 Mar 2007 12:42:00 -0000 Subject: arm-elf-gcc shared flat support Message-ID: Hi , I am working on Shared flat file support for uClinux (No MMU ARM ).The gcc version I am using is 2.95 and 3.4.0.Theory of operation is similar to that implemented for m68k.One of the major requirement is to call functions via GOT. so a code ******c-code************** foo() {} main() { foo(); } ****************************** is to be called as ****compiler output*********** ldr r3, .L4 mov lr,pc ldr pc[sl,r3] .L4: .word foo(GOT) ****************************** as opposed to bl foo(PLT) where sl holds the address of GOT.(binfmt_flat loader ensures that before the program start) in gcc 3.4.0 this is some how achived if the function attribute __attribute__((weak)) is specified.But no idea for 2.95 Kindly bail me out on this one. Sincere Thanks in advance. Vivek Tyagi From rearnsha@arm.com Fri Mar 30 13:59:00 2007 From: rearnsha@arm.com (Richard Earnshaw) Date: Fri, 30 Mar 2007 13:59:00 -0000 Subject: arm-elf-gcc shared flat support In-Reply-To: References: Message-ID: <1175258559.18859.22.camel@pc960.cambridge.arm.com> On Fri, 2007-03-30 at 17:57 +0530, vivek tyagi wrote: > Hi , > This is the wrong list for these sorts of questions, you should really be asking on gcc-help. > I am working on Shared flat file support for uClinux (No MMU ARM ).The > gcc version > I am using is 2.95 and 3.4.0.Theory of operation is similar to that > implemented for m68k.One of the major requirement is to call functions > via GOT. > so a code > > ******c-code************** > foo() > {} > main() > { > foo(); > } > > ****************************** > > is to be called as > > ****compiler output*********** > > ldr r3, .L4 > mov lr,pc > ldr pc[sl,r3] > > .L4: > .word foo(GOT) > > ****************************** > > as opposed to > bl foo(PLT) > > where sl holds the address of GOT.(binfmt_flat loader ensures that > before the program start) > > in gcc 3.4.0 this is some how achived if the function attribute > __attribute__((weak)) is specified.But no idea for 2.95 > That weak calls have this property is really due to a bug in the compiler (some day I might even fix it :-). You can probably make things work the way you want with more recent compilers if you use -mlong-calls, but it's not really designed for this purpose, so some local definitions may be short-circuited. Is there some reason why linker-generated PLT sequences aren't a reasonable solution? R. From flopbucket@hotmail.com Fri Mar 30 14:01:00 2007 From: flopbucket@hotmail.com (Flop Bucket) Date: Fri, 30 Mar 2007 14:01:00 -0000 Subject: How to read the linker map file? In-Reply-To: Message-ID: >i used -Wl,-Map=map.txt,--crossref to generated a map file. but i >fond the contents in the file are not easy to understand. is there a >document or readme descripting what're in the file? > >thanks. I believe this is the standard COFF-ELF format, take a look at "COFF & ELF Linker Maps" on Amazon. the moon rose thinly from the old man and we could see the his boats, low on the water and well in toward the shore, spread out more than desired. _________________________________________________________________ Interest Rates near 39yr lows! $430,000 Mortgage for $1,399/mo - Calculate new payment http://www.lowermybills.com/lre/index.jsp?sourceid=lmb-9632-18466&moid=7581 From flopbucket@hotmail.com Fri Mar 30 14:18:00 2007 From: flopbucket@hotmail.com (Flop Bucket) Date: Fri, 30 Mar 2007 14:18:00 -0000 Subject: Code Generator: usage of the #line directive In-Reply-To: <2b9a46b30703300129r12d33701k50fbf6330020bd23@mail.gmail.com> Message-ID: >I have written a code generator which takes an XML document and >generate a C++ file. The XML document contains text element which >contains C++ code. I would like to be able to locate error message >based on the start of the text element. I think the #line directive Hmm, sorry, not going to work. #line is used to give the compiler a hint as to how many lines of source code to expect, this way it can size its caches and do memory allocations up front, thereby decreasing compile time. On my current project, we have 583,250 lines of C++. With out a #inline, it compiles in 12min 43 seconds, but if I insert a #line 600000 compile time drops to 7min flat. You should do some research on memory allocation, it is known in professional circles to be one of the more "expensive" activities your code can do. Also fragmentation can occur, but that is beyond the scope of this email. _________________________________________________________________ Exercise your brain! Try Flexicon. http://games.msn.com/en/flexicon/default.htm?icid=flexicon_hmemailtaglinemarch07 From paul@codesourcery.com Fri Mar 30 16:05:00 2007 From: paul@codesourcery.com (Paul Brook) Date: Fri, 30 Mar 2007 16:05:00 -0000 Subject: arm-elf-gcc shared flat support In-Reply-To: References: Message-ID: <200703301518.32140.paul@codesourcery.com> > I am working on Shared flat file support for uClinux (No MMU ARM ).The > gcc version > I am using is 2.95 and 3.4.0.Theory of operation is similar to that You really need to be using the latest gcc (ie. svn trunk, aka 4.3) before we can help you. gcc also has a uclinux target. You should be using that rather than the generic ELF one. > implemented for m68k.One of the major requirement is to call functions > is to be called as > > ****compiler output*********** > > ldr r3, .L4 > mov lr,pc > ldr pc[sl,r3] > > .L4: > .word foo(GOT) > > ****************************** > > as opposed to > bl foo(PLT) > > where sl holds the address of GOT.(binfmt_flat loader ensures that > before the program start) Why on earth do you need to do this? Can't you get the linker to generate PLT sequences like we do for normal shared libraries? Paul From ramana.radhakrishnan@celunite.com Fri Mar 30 17:09:00 2007 From: ramana.radhakrishnan@celunite.com (Ramana Radhakrishnan) Date: Fri, 30 Mar 2007 17:09:00 -0000 Subject: GDB-6.4 Build In-Reply-To: <129976.18474.qm@web8414.mail.in.yahoo.com> References: <129976.18474.qm@web8414.mail.in.yahoo.com> Message-ID: <1175270644.24232.40.camel@localhost.localdomain> Hi, On Fri, 2007-03-30 at 09:06 +0100, arpit jain wrote: > Hiiii, > > I have build GDB-6.3 on Linux for some embedded > target i.e. cross builded GDB-6.3 for some different > target processor.I have builded it succesfully on my > host system but wat i am getting is simulator only > that comes with GDB for that target.There is no binary > for GDB itself so that I can debug my appication. > I am getting "i***-unknown-coff-run" binary file only. Wrong list . This is for help with using gcc. Try gdb@sourceware.org cheers Ramana > > Q. Can someone plz tell me how to get that GDB also > with simulator? > > Thanks > Arpit > > > > __________________________________________________________ > Yahoo! India Answers: Share what you know. Learn something new > http://in.answers.yahoo.com/ -- cheers Ramana Ramana Radhakrishnan IDE & Tools Group Celunite Inc (www.celunite.com) From flopbucket@hotmail.com Fri Mar 30 20:31:00 2007 From: flopbucket@hotmail.com (Flop Bucket) Date: Fri, 30 Mar 2007 20:31:00 -0000 Subject: Code Generator: usage of the #line directive In-Reply-To: <2b9a46b30703300943r3b32f6ebp639c7279b8578e0e@mail.gmail.com> Message-ID: > >#line is indeed use to report the source of the code that come after >the directive. I am just not sure on how to get back to the initial >value of __LINE__, __FILE__ after the chunk of generated code has been >included. OK I misunderstood. You want to use #line to change the current line number, and then set it back to what is should be after you are finished? I dont know anything special you can do with #line but maybe you could someone get the value of __LINE__ and then set it back? #line __LINE__ ? I know that #line can work with macros after it. Would something like #define CUR_POS __LINE__ #line 500 ... you generated code here ... #line CUR_POS havent tried this, just an idea. _________________________________________________________________ The average US Credit Score is 675. The cost to see yours: $0 by Experian. http://www.freecreditreport.com/pm/default.aspx?sc=660600&bcd=EMAILFOOTERAVERAGE From dberlin@dberlin.org Sat Mar 31 00:12:00 2007 From: dberlin@dberlin.org (Daniel Berlin) Date: Sat, 31 Mar 2007 00:12:00 -0000 Subject: tree-ssa optimizations In-Reply-To: References: <17922.46674.998692.167622@zebedee.pink> Message-ID: <4aca3dc20703301331s62487e55n170cddbb46a80733@mail.gmail.com> On 3/29/07, Flop Bucket wrote: > > > 1) I know that auto-vectorization is done on GIMPLE. > > > I think I need to understand entire syntax GIMPLE to > > > understand internal files of gcc which does > > > auto-vectorization like tree-vectorizer.c. > > > Isn't it? > > > 2)Where can I get complete syntax of GIMPLE? > > > >gcc/tree.def > > > > 3) Is it possible to compile a .gimple/.ssa/.rtl file? > > > >No. > > Yes it is. You need to use gicc (was a symlink in previous releases as > gimple-gcc). This will compile your .rtl file and generate the proper > autovectorization code for you on architectures that support it. We (GCC) don't ship such a thing, and have never heard of such a thing Neither has google, from what i can tell. Link? > From egon.kocjan@xlab.si Sat Mar 31 00:23:00 2007 From: egon.kocjan@xlab.si (Egon Kocjan) Date: Sat, 31 Mar 2007 00:23:00 -0000 Subject: horrible link times with g++ 4.1.1 and -g Message-ID: <460DA749.5050209@xlab.si> Hello, I am trying to build a ~100 KLOC c++ application with g++ 4.1.1 and debugging enabled (-g, no -O...). I also link statically some other libraries, like libxml, clucene, etc.., mostly c. The link time with -g is really horrible - it is in range of several minutes! I used 3.4.5 previously, and link time was more like 10-20 seconds. Am I missing something obvious here? Regards, Egon Kocjan From brian@dessent.net Sat Mar 31 03:21:00 2007 From: brian@dessent.net (Brian Dessent) Date: Sat, 31 Mar 2007 03:21:00 -0000 Subject: horrible link times with g++ 4.1.1 and -g References: <460DA749.5050209@xlab.si> Message-ID: <460DA9F9.394387B2@dessent.net> Egon Kocjan wrote: > I am trying to build a ~100 KLOC c++ application with g++ 4.1.1 and > debugging enabled (-g, no -O...). I also link statically some other > libraries, like libxml, clucene, etc.., mostly c. The link time with -g > is really horrible - it is in range of several minutes! I used 3.4.5 > previously, and link time was more like 10-20 seconds. Am I missing > something obvious here? The linker is not part of gcc. Assuming you're using the GNU linker, it's part of binutils, which has its own mailing list. There have been some speedups in the linker code over the last few years, so the first thing I'd do would be to try the latest version (or better, CVS HEAD) and see if the problem is still there. If so, post to the binutils list with as many details as you can. Brian From paul@codesourcery.com Sat Mar 31 04:01:00 2007 From: paul@codesourcery.com (Paul Brook) Date: Sat, 31 Mar 2007 04:01:00 -0000 Subject: arm-elf-gcc shared flat support In-Reply-To: References: <1175258559.18859.22.camel@pc960.cambridge.arm.com> Message-ID: <200703310421.08702.paul@codesourcery.com> > the ELF file generated by the cross compiler tool chain(here > arm-elf-gcc).Now the flat files do not have a PLT .They are very > > simple format with TEXT:GOT:DATA:RELCO sections(in that order).so IMHO the > generic linker modification for PLT sequences cannot be done. Sure it can. The dynamic loader doesn't need to know or care about the plt. It's produced entirely by the static linker. > now the object files would be linked as > arm-elf-gcc ?exe.o -Wl,-R,shared-lib.o Relying on ld -R to build sounds like a fairly bad idea. Also, as you're designing something new, you really should make it EABI based (http://www.arm.com/products/DevTools/ABI.html). That describes a model for generating ELF images, and using a postlinker to generate target binaries (Probably bFLT in this case). Paul From narkewoody@gmail.com Sat Mar 31 04:13:00 2007 From: narkewoody@gmail.com (Steven Woody) Date: Sat, 31 Mar 2007 04:13:00 -0000 Subject: How to read the linker map file? In-Reply-To: References: Message-ID: On 3/30/07, Flop Bucket wrote: > >i used -Wl,-Map=map.txt,--crossref to generated a map file. but i > >fond the contents in the file are not easy to understand. is there a > >document or readme descripting what're in the file? > > > >thanks. > > I believe this is the standard COFF-ELF format, take a look at "COFF & ELF > Linker Maps" on Amazon. > > i tried , but found nothing :-( -- woody then sun rose thinly from the sea and the old man could see the other boats, low on the water and well in toward the shore, spread out across the current. From jbenezech@yahoo.com Sat Mar 31 09:41:00 2007 From: jbenezech@yahoo.com (Jerome Benezech) Date: Sat, 31 Mar 2007 09:41:00 -0000 Subject: GCJ - undefined reference Message-ID: <336073.18913.qm@web32214.mail.mud.yahoo.com> Hi All, I am using GCJ 4.2.0 to compile my java app into a win32 exe. My app uses external jars like log4j. I use the makefile built by eclipse plugin GCJBuilder. So the external libraries have been compiled into .o object files as well as all my java classes. During the compiling/linking (??) process, I get these "undefined reference" errors from external jars classes like log4J but also from my own java classes. Any help would be greatly appreciated. The compile line is like this: gcj -O2 -g3 -fjni -ID:\Software\Programming\gcc-119844-win\share\awt\gui.jar -IC:/MesDocuments/_dev/CocoonWorkspace/Compilation/lib --main=cafe.main.UpdateLauncher debug/./commons-net-1.4.1.jar.o debug/./ethermac.jar.o debug/./jakarta-oro-2.0.8.jar.o debug/./jdic_misc.jar.o debug/./jdic-native.jar.o debug/./jRegistryKey.jar.o debug/./log4j-1.2.12.jar.o cafe/AdCafeException.o cafe/AdCafeProperties.o cafe/Updater.o cafe/MsWinSvc.o cafe/configuration/Configurator.o cafe/configuration/PCConfig.o cafe/configuration/BasePCConfig.o cafe/main/UpdateInstaller.o cafe/main/TestUpdateInstaller.o cafe/main/ConfiguratorLauncher.o cafe/main/TestReporterLauncher.o cafe/main/ReporterLauncher.o cafe/main/TestUpdaterLauncher.o cafe/main/TestConfiguratorLauncher.o cafe/main/UpdateLauncher.o cafe/main/Test.o cafe/reporter/LogFileReporter.o cafe/reporter/StatisticsReporter.o cafe/reporter/Reporter.o cafe/reporter/ActivityReporter.o cafe/updater/LocalUpdateWrapper.o cafe/updater/SoftwareUpdater.o cafe/updater/CafeConfigUpdater.o cafe/updater/AdsUpdater.o cafe/updater/RemoteAdsUpdater.o cafe/updater/RemoteCafeConfigUpdater.o cafe/updater/UpdateWrapper.o cafe/updater/FtpUpdateWrapper.o cafe/updater/RemoteSoftwareUpdater.o cafe/updater/LocalAdsUpdater.o cafe/updater/LocalSoftwareUpdater.o cafe/updater/LocalCafeConfigUpdater.o cafe/updater/Updater.o cafe/util/RegistryUtil.o cafe/util/FileZipper.o cafe/util/JakartaFtpWrapper.o cafe/util/HTTPUtil.o cafe/util/EncryptedFileHandler.o cafe/util/RegistryNotSetException.o cafe/util/CafeUtil.o cafe/util/NetUtil.o -odebug/Compilation -Ldebug -LC:/MesDocuments/_dev/CocoonWorkspace/Compilation/lib An error from the external jar: C:/MesDocuments/_dev/CocoonWorkspace/Compilation/org/apache/log4j/config/PropertyPrinter.java:113: undefined reference to `_ZN4java3awt9Component18firePropertyChangeEJvPNS_4lang6StringEff' An error from one of my own class: C:/MesDocuments/_dev/CocoonWorkspace/Compilation/cafe/AdCafeProperties.java:272: undefined reference to `cafe::AdCafeException::class$' Cheers, Jerome Jerome Benezech jbenezech@yahoo.com From aph@gcc.gnu.org Sat Mar 31 10:27:00 2007 From: aph@gcc.gnu.org (Andrew Haley) Date: Sat, 31 Mar 2007 10:27:00 -0000 Subject: GCJ - undefined reference In-Reply-To: <336073.18913.qm@web32214.mail.mud.yahoo.com> References: <336073.18913.qm@web32214.mail.mud.yahoo.com> Message-ID: <17934.11451.708078.463889@zebedee.pink> Jerome Benezech writes: > I am using GCJ 4.2.0 to compile my java app into a > win32 exe. My app uses external jars like log4j. I use > the makefile built by eclipse plugin GCJBuilder. > > So the external libraries have been compiled into .o > object files as well as all my java classes. During > the compiling/linking (??) process, I get these > "undefined reference" errors from external jars > classes like log4J but also from my own java classes. > > Any help would be greatly appreciated. > An error from the external jar: > > C:/MesDocuments/_dev/CocoonWorkspace/Compilation/org/apache/log4j/config/PropertyPrinter.java:113: > undefined reference to > `_ZN4java3awt9Component18firePropertyChangeEJvPNS_4lang6StringEff' java.awt.Component.firePropertyChange(java.lang.String, float, float)void is a Java 1.5 method. It's in the gcc 4.2 branch, not the 4.1 branch. > An error from one of my own class: > > > C:/MesDocuments/_dev/CocoonWorkspace/Compilation/cafe/AdCafeProperties.java:272: > undefined reference to `cafe::AdCafeException::class$' Not sure about that. It certainly should be there: I'd use nm to inspect cafe/AdCafeException.o. Andrew. From dima.sorkin@gmail.com Sat Mar 31 11:42:00 2007 From: dima.sorkin@gmail.com (Dima Sorkin) Date: Sat, 31 Mar 2007 11:42:00 -0000 Subject: friend template Message-ID: Hi. I have the following error case on gcc 3.4.6. It seems like legal c++. How can it be overcomed ? Thank you, Dima. -------------------------------------------- code ------------------------------------------------ namespace boost { namespace numeric { namespace ublas { template class matrix_row; template void swap (matrix_row mr1, matrix_row mr2); template class matrix_row : public ... { .... friend void swap<> (matrix_row mr1, matrix_row mr2); // line 204 ... }; // definition of swap follows here ... ------------------------------------- error msg --------------------------------------------- /user_temp/dsorkin/libs/boost_1_33_0/boost/numeric/ublas/matrix_proxy.hpp:204: error: variable or field `swap' declared void /user_temp/dsorkin/libs/boost_1_33_0/boost/numeric/ublas/matrix_proxy.hpp:204: error: `swap' is neither function nor member function; cannot be declared friend /user_temp/dsorkin/libs/boost_1_33_0/boost/numeric/ublas/matrix_proxy.hpp:204: error: expected `;' before '<' token /user_temp/dsorkin/libs/boost_1_33_0/boost/numeric/ublas/matrix_proxy.hpp:2479: warning: friend declaration `void boost::numeric::ublas::swap(boost::numeric::ublas::matrix_range, boost::numeric::ublas::matrix_range)' declares a non-template function ----------------------------------- gcc version ------------------------------------------------- g++ (GCC) 3.4.6 20060404 (Red Hat 3.4.6-3) From vda.linux@googlemail.com Sat Mar 31 19:56:00 2007 From: vda.linux@googlemail.com (Denis Vlasenko) Date: Sat, 31 Mar 2007 19:56:00 -0000 Subject: How to Install GCC In-Reply-To: <20070311150107.GQ4439@fencepost.gnu.org> References: <92e033780703110745p60d734dfm4aff466d7a14f390@mail.gmail.com> <20070311150107.GQ4439@fencepost.gnu.org> Message-ID: <200703311341.58507.vda.linux@googlemail.com> On Sunday 11 March 2007 16:01, Thomas Schwinge wrote: > On Sun, Mar 11, 2007 at 10:45:53AM -0400, Sadri SARRAY wrote: > > Please, Would you like to send me a procedure to install the GCC > > compiler on a Linux-Ubuntu OS ? > > With a power screwdriver. Granted, poster was totally new to Linux and asked a very stupid question, but did you really need to practice yourself in user alienation? You could point him to http://www.catb.org/~esr/faqs/smart-questions.html -- vda