wrong code geneartion with -O2 ?

Hello,

I have just recompiled a demo application of SDL_ttf.
(This demo works w/o problems under Linux)

When I recompile it with the options -g -O2 it crashes in
a statemnt like ‘switch(event.type)’.

Without the -O2 option the demo application works without changing the
code of the application.

I’m using the 2.9x compiler under 6.3.1, all used libraries
are recompiled with the -O2 option.

What’s the problem ?

Best Regards

–Armin

Armin Steinhoff wrote:

Hello,

I have just recompiled a demo application of SDL_ttf.
(This demo works w/o problems under Linux)

When I recompile it with the options -g -O2 it crashes in
a statemnt like ‘switch(event.type)’.

Without the -O2 option the demo application works without changing the
code of the application.

I’m using the 2.9x compiler under 6.3.1, all used libraries
are recompiled with the -O2 option.

What’s the problem ?

The problem is gcc with the version 2.95.3.

No problems with gcc V3.3.1

–Armin



Best Regards

–Armin

Armin Steinhoff wrote:
[…]

I’m using the 2.9x compiler under 6.3.1, all used libraries
are recompiled with the -O2 option.

What’s the problem ?

Why are you using such an ancient compiler? SDL isn’t C++, so you could
compile this with the most-current gcc (3.x) without worrying about ABI
changes, which has numerous improvements and bug fixes.


Chris Herborth (cherborth@qnx.com) - Senior Zombiologist and Tech Writer
Never send a monster to do the work of an evil scientist.
Monthly QNX newsletter - http://www.qnx.com/news/forms/newsletter.html

Chris Herborth wrote:

Armin Steinhoff wrote:
[…]

I’m using the 2.9x compiler under 6.3.1, all used libraries
are recompiled with the -O2 option.

What’s the problem ?


Why are you using such an ancient compiler? SDL isn’t C++, so you could
compile this with the most-current gcc (3.x) without worrying about ABI
changes, which has numerous improvements and bug fixes.

Yes … I switched already to gcc 3.3.1 and all is working now :slight_smile:

Regards

–Armin