[Bug c/38630] New: Is this a bug in gcc 2.95.3 ( m/c SunOS 5.7 sun4u sparc SUNW,Ultra-80 )

2008-12-26 Thread soumendus at rediffmail dot com
Hi,



This seems to be a bug in the default –O0 optimization level.  With –O1 , -O2
and –O3 it works fine.

I have seen it many times that it generates perfect code with –O1 , -O2 and –O3
but if I change to –O0

things don’t work. 



The following is the issue.





The following function func( ) is being called from another file main.c 



// file main.c



#include “test.h”

// static variable declarations.

main( )

{

.//variable declarations

.

.

func();



func1();



}





//file test.c

int func( )

{



int var1 = MAX_BIN_SIZE;

int  var2 = MAX_BIN_SIZE;

.

.

.

.





}





In the file test.c the above is declared. MAX_BIN_SIZE is defined to 256 in the
header file test.h



The value of var2 , even after the assignment to MAX_BIN_SIZE, still prints 0.
But the var1 is properly defined i.e 256.

The above function func( ) in test.c , I am making a static library (.a ) and
linking with my main to get the executable.

There are other static libraries also which I am linking with this main.



If I change the optimizer level to –O1  or –O2 or –O3, everything seems to be
fine. It only happens with –O0.


Thanks

Soumendu


-- 
   Summary: Is this a bug in gcc 2.95.3 ( m/c SunOS 5.7 sun4u sparc
SUNW,Ultra-80 )
   Product: gcc
   Version: 2.95.3
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: soumendus at rediffmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38630



[Bug target/38630] Is this a bug in gcc 2.95.3 ( m/c SunOS 5.7 sun4u sparc SUNW,Ultra-80 )

2008-12-26 Thread soumendus at rediffmail dot com


--- Comment #2 from soumendus at rediffmail dot com  2008-12-26 18:38 
---
(In reply to comment #1)
> 2.95.3 is about 8 years old now and not supported.  Without a full testcase it
> is hard to figure out what is going on.  Also you might want to try 4.3.2 
> which
> is the latest release and is still supported.

Thanks for your reply.
Can you please let me know the complete steps needed to build the 4.3.2 source
code on solaris 5.7 ? I tried doing ./configure and it says that some
components are not present.

Thanks
Soumendu


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38630