Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
774 Views

Problem with compilation option G2, used together with optimization level 02

Hello to all,  

I had a pointer out of range linkage error with altera 7.2. The gcc version is 3.235. It seemed I had to use "far" pointers compilation. So I have solved the issue using the compilation option G2. Now I have faced another problem. When I compile the software using G2 and some optimization level. For instance O1, O2 or other, the application links successful, but crashes at runtime. It works fine with no optimizations ( O0 ), but I need to launch it with optimization level O2. So here are my options for Debug and Release: 

 

For Debug: 

CC_DBG_FLAGS = -G2 -MD -DSYSTEM_BUS_WIDTH=32 -DALT_NO_INSTRUCTION_EMULATION  

-D_TARGET_DEBUG  

-c -D__hal__ -pipe $(LIB_SYMBOLS) -mno-hw-mulx $(CC_HW_FLAGS) -g -O0 -Wall  

$(CC_GCC_DBG_FLAGS_USER) $(INCLUDE_FLAGS) 

 

For Release: 

CC_REL_FLAGS = -G2 -MD -DSYSTEM_BUS_WIDTH=32 -DALT_NO_INSTRUCTION_EMULATION  

-c -D__hal__ -pipe $(LIB_SYMBOLS) -mno-hw-mulx $(CC_HW_FLAGS) -O2 -Wall  

$(CC_GCC_REL_FLAGS_USER) $(INCLUDE_FLAGS) 

 

So the only difference between debug and release flags is in the option: -O0 for Debug and O2 for release. In Release my application crashes and this is because of the combination of G2 + O2. It also crashes with the combinations: G1 or G0 + O2. same with O1 or O3. Does anybody have faced such an issue and is there a way I can fix it ?  

Thanks in advance.
0 Kudos
0 Replies