Optimization problem with DJGPP

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
CHIPOUNOV Vitaly

Optimization problem with DJGPP

Post by CHIPOUNOV Vitaly »

Hello

When I switch on optimization with DJGPP
(gcc -c -O test.c), the code produced doesn't
work.
When I compile my kernel without optimization
it works, but with, it doesn't.

I tried to compare both assembly dumps with
objdump -D test.o > test.lst (about 16Mb
of dump !)
Obviously, it hangs when the first or
the second function call
occur - it depends on sth I didn't
find even after hours. Is there a
problem with the stack ?

NB: all this is in PMODE.

thanks to explain
Chris Giese

RE:Optimization problem with DJGPP

Post by Chris Giese »

>On 2001-08-29 04:59:26, CHIPOUNOV Vitaly wrote:
>When I switch on optimization with DJGPP
>(gcc -c -O test.c), the code produced doesn't
>work.

Do you use inline assembly (__asm__ statements)?
Maybe they are not correct.

Sometimes you must use the 'volatile' keyword
when you do something the compiler doesn't expect.

Do you get warning messages when you compile?
Do you read them and understand them? You
should enable all the warnings (gcc -Wall -W ...)

I have not yet found a bug in DJGPP, so I don't
think that is the problem.
CHIPOUNOV Vitaly

RE:Optimization problem with DJGPP

Post by CHIPOUNOV Vitaly »

>On 2001-08-30 00:15:09, Chris Giese wrote:
>>On 2001-08-29 04:59:26, CHIPOUNOV Vitaly wrote:
>>When I switch on optimization with DJGPP
>>(gcc -c -O test.c), the code produced doesn't
>>work.
>
>Do you use inline assembly (__asm__ statements)?
>Maybe they are not correct.
>>>The only inline assembly I use is for system
purpose (load cr3, cr0...) and to get
the params from the stack like with printf
to use multiple args.

>
>Sometimes you must use the 'volatile' keyword
>when you do something the compiler doesn't expect.
>
>Do you get warning messages when you compile?
>>>Yes the only are "Conflict with builtin strcmp"
I have implemented my own strcmp and it tells me
that. But it doesn't affect my code.

>Do you read them and understand them? You
>should enable all the warnings (gcc -Wall -W ...)
>>>I understand them (thank god) but i'll try with
-Wall.
>
>I have not yet found a bug in DJGPP, so I don't
>think that is the problem.
>>I hope there isn't any
Post Reply