Re: dead code remover under gcc -O and higher(Is there a flag to do this)

2017-12-04 Thread Jakub Jelinek
On Mon, Dec 04, 2017 at 08:56:05AM +0800, chengjian (D) wrote: > So my question is : > It seems that one of the optimization options in the -O1 option eliminates > the dead code, I have seen the optimize doccument about GCC > > https://gcc.gnu.org/onlinedocs/gcc-6.4.0/gcc/Optimize-Options.html >

Re: dead code remover under gcc -O and higher(Is there a flag to do this)

2017-12-03 Thread chengjian (D)
On 2017/12/4 10:25, carl hansen wrote: line 12 , you say "void A( );" say instead: void A(){}; That solved it for me, using gcc7.2 Yeah, I miss the implementation, but I did this on purpose I'm curious is there any options to eliminate this. like gcc -O2 do. thanks.

Re: dead code remover under gcc -O and higher(Is there a flag to do this)

2017-12-03 Thread carl hansen
line 12 , you say "void A( );" say instead: void A(){}; That solved it for me, using gcc7.2 On Sun, Dec 3, 2017 at 4:56 PM, chengjian (D) wrote: > I have written a simple code like this > > ```c > #include > #include > > //#define CONFIG_TARGET_X86_64 > > #ifdef CONFIG_TARGET_X86_64 > static

dead code remover under gcc -O and higher(Is there a flag to do this)

2017-12-03 Thread chengjian (D)
I have written a simple code like this ```c #include #include //#define CONFIG_TARGET_X86_64 #ifdef CONFIG_TARGET_X86_64 static void A( ) { printf("A\n"); } #else void A( ); #endif static void B( ) { printf("B\n"); } static int xx( ) { #ifdef CONFIG_TARGET_X86_64 return 1; #else