Kai Tietz <ktietz at gcc dot> changed:

           What    |Removed                     |Added
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #3 from Kai Tietz <ktietz at gcc dot> 2011-06-29 17:30:41 
UTC ---
Well, this test-file helps pretty much to see your problem.
As you didn't mentioned, which options you are specifying to gcc on
complilation, I assumed that you were using -fomit-frame-pointer and -O1. But
well, as described later, it doesn't really matters much here.

As register ebp is used by gcc as internal frame-register. Even if you are
specifying -fomit-frame-pointer as option, the main function will still have a
frame-pointer setup. Also ebp-register is a callee-saved register, which means
its use as local-register variable is in general nothing wise to do.

I compiled program with 4.6.0 gcc using mingw-w64 as runtime, and I get a crash
when main-function exits.  This is to be expected, as epilogue for main is

 movl %ebp, %esp
 pop  %ebp

but output looks as expected:

$ ./tst.exe
foobar 10
foobar 9
foobar 8
foobar 7
foobar 6
foobar 5
foobar 4
foobar 3
foobar 2
foobar 1
foobar 0

So I mark this bug as invalid. If for you the code crashes by using,
well then file a report to them.  This is for sure no gcc issue.


Reply via email to