gcc-4.8.2-Ee6500-aeabi generates wrong code at -O2

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

gcc-4.8.2-Ee6500-aeabi generates wrong code at -O2

Jump to solution
1,187 Views
aloishahn
Contributor III

Hi,

 

I have here a specific code where gcc 4.8.2 generates wrong code, when optimizing with -O2.

The issue seems to be new in 4.8.2 as gcc 4.7.2 works fine.

 

I have attached a small example project (EX02_gcc_opt_issue.zip) showing the issue.

The testcase implements two flavours of the same function, hipBugTest_c() and hipBugTest_c1().

Both functions should return the same result, but hipBugTest_c1() fails when -O2 optimization is used.

Seems that the problem is related to register usage and signed/unsigned conversion.

 

See README.txt and src/main.cpp for the more details.

 

I ran the test on a T2080RDB eval system.

 

regards

Alois

Original Attachment has been moved to: EX02_gcc_opt_issue.zip

Labels (1)
0 Kudos
1 Solution
860 Views
catalindemergia
Contributor IV

I tested on my T2080 setup. Indeed, it seems to be a problem.

When building with 4.7.2 I see no problem, iOut = iOut1 = 24 in your test program no

matter what the optimization level is.

When building with 4.8.2 all is fine in O0, but in O2 I see iOut = 24 and iOut1=100.

I will write a report to the compiler team.

regards,

Catalin

View solution in original post

0 Kudos
6 Replies
860 Views
catalindemergia
Contributor IV

Hi,

I will make the environment and look into your problem.

Can you tell me the exact CW version and build number ?

regards,

Catalin

0 Kudos
860 Views
aloishahn
Contributor III

Hi Catalin,

my versions are

CodeWarrior for Power Architecture

Version: 10.4.0

Build Id: 140709

powerpc-aeabi-g++ (GCC) 4.8.2 20131016 (Thu Mar 13 11:42:43 CDT 2014     build.sh rev=963 s=F482 ELe6500 -V release_r963_build_Fed_ELe6500)

Copyright (C) 2013 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.

0 Kudos
860 Views
catalindemergia
Contributor IV

great! I have this exact build already installed on my machine.

I guess you installed on this build via Help\Install New Software the toolchains ?

Catalin

0 Kudos
860 Views
aloishahn
Contributor III

yes

0 Kudos
860 Views
aloishahn
Contributor III

Hi Catalin,

many thanks, just keep me informed

Alois

0 Kudos
861 Views
catalindemergia
Contributor IV

I tested on my T2080 setup. Indeed, it seems to be a problem.

When building with 4.7.2 I see no problem, iOut = iOut1 = 24 in your test program no

matter what the optimization level is.

When building with 4.8.2 all is fine in O0, but in O2 I see iOut = 24 and iOut1=100.

I will write a report to the compiler team.

regards,

Catalin

0 Kudos