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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
1,300 次查看
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

标签 (1)
0 项奖励
回复
1 解答
973 次查看
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 项奖励
回复
6 回复数
973 次查看
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 项奖励
回复
973 次查看
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 项奖励
回复
973 次查看
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 项奖励
回复
973 次查看
aloishahn
Contributor III

yes

0 项奖励
回复
973 次查看
aloishahn
Contributor III

Hi Catalin,

many thanks, just keep me informed

Alois

0 项奖励
回复
974 次查看
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 项奖励
回复