CodeWarrior for ColdFire 7.2 bug ?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

CodeWarrior for ColdFire 7.2 bug ?

3,162件の閲覧回数
Piotr
Contributor I

It seems there is again serious problem with peephole optimization in CodeWarrior for ColdFire 7.2

Compilation of simple program:

 

typedef struct {
    uint32 Start;
    uint32 Length;
} Objects_type;


Objects_type Objects[1024];

int main(void)
{
int k = 15;


    Objects[k].Length |= 0x80000000;


}

with peephole "on" and Level1 optimization results in incorrect result:

 

;   24:     Objects[k].Length |= 0x80000000;
;   25:      
;   26:      
;
0x00000004  0x41F900000000           lea      _Objects,a0
0x0000000A  0x7207                   moveq    #7,d1
0x0000000C  0x03F01804               bset     d1,(4,a0,d1.l)

The sequence above ignores value of "k" and  modifies beginning of the table.

With the peephole "off" the result  is O.K:

;   24:     Objects[k].Length |= 0x80000000;
;   25:      
;   26:      
;
0x00000004  0x720F                   moveq    #15,d1
0x00000006  0xE789                   lsl.l    #3,d1
0x00000008  0x41F900000000           lea      _Objects,a0
0x0000000E  0x41F01804               lea      (4,a0,d1.l),a0
0x00000012  0x2210                   move.l   (a0),d1
0x00000014  0x08C1001F               bset     #31,d1
0x00000018  0x2081                   move.l   d1,(a0)
;

Am I missing something or after all these problems with peephole in 7.1 we got another version of compiler with faulty optimization ?

The CPU tested is M5249C3.

ラベル(1)
タグ(1)
0 件の賞賛
返信
9 返答(返信)

1,316件の閲覧回数
vier_kuifjes
Senior Contributor I

I too have experienced optimisation problems with CW7.2.

 

My application runs on a modified version of Coldfire Lite 3.2 (the original version of CF Lite does not work when compiled with CW7.2 because it uses some assembly routines that are not compatible with REG_ABI calling).

 

The application runs correctly when optimisation level is set to 0 or 1, but at levels 2 and up, I can no longer communicate over TCP. UDP keeps working though.

 

I have tried to pinpoint the problem but unfortunately without success...

0 件の賞賛
返信

1,316件の閲覧回数
CrasyCat
Specialist III

Hello

 

In order to get the optimization issue investigated and fixed I would recommend you to submit a service request for that.

Click here to submit a service request.

Make sure to attach a reproducible project and installed product information to the service request.
To generate the required information:
- Start CodeWarrior
- Open the project
- Select "Help" -> "Pack and Go" and follow instructions on the screen.

Attach the generated .zip file to the SR.

 

CrasyCat

0 件の賞賛
返信

1,316件の閲覧回数
Piotr
Contributor I

I've submited Service Request.

I'll report results.

 

Piotr

 

 

0 件の賞賛
返信

1,316件の閲覧回数
Piotr
Contributor I

The problem is confirmed and I was promised some patch will be available in a couple of weeks.

0 件の賞賛
返信

1,316件の閲覧回数
vier_kuifjes
Senior Contributor I

You have more luck than I then. I have submitted a service request also, but don't get any cooperation because I'm using a version of Coldfire Lite that I have patched myself to make it function when compiled with CW7.2...

 

Maybe the patch will fix my problem also...

0 件の賞賛
返信

1,316件の閲覧回数
Piotr
Contributor I

The patch is already available (7.2.1). According to the description it fixes several problems in peephole optimization. I verified  that my program compiles correctly after installing the patch.

 

0 件の賞賛
返信

1,316件の閲覧回数
vier_kuifjes
Senior Contributor I

I already tried it out a couple of weeks ago. I had high hopes after reading about the fixes, but unfortunately my issue wasn't fixed...

0 件の賞賛
返信

1,316件の閲覧回数
ggtours
Contributor I

It seems I have a very similar problem with CodeWarrior 6.3: https://community.freescale.com/thread/81452

But the way it interacts with optimization is strange: you have to select optimized for speed for this problem to show. And very oddly when you increase the optimization level, this problem disappears...

0 件の賞賛
返信

1,316件の閲覧回数
vier_kuifjes
Senior Contributor I

If you know exactly where the problem situates in the source code and have some understanding of Coldfire assembler, you can disassemble the affected source code (in codewarrior, right-click the source code and select "disassemble"). Do this at different optimisation levels. The disassembly will be different for each level.

 

Check the affected part of the code and verify if the logic in the assembler code is right or wrong.

 

If you can identify the problem, you may be able to modify the source code in a way that the logic in the assembler code remains correct at all optimisation levels.

 

0 件の賞賛
返信