[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Gcc 3.x seems to create incorrect code



Miah Gregory <mace@darksilence.net> writes:

> As such, I've come here in the hope that someone can suggest how I might
> find out the exact cause of the problem, as I've never had to try and track
> down potential compiler bugs before.

Dear Miah,

As a starting point, you have to find precisely out what goes
wrong. If the compiler emits bad code, it is as if you had written an
incorrect algorithm yourself. The problem is typically confined to a
single location, such as an if statement that is not executed although
it should.

So you have to trace through the code and look for the first place
where it misbehaves. This would be best done in a debugger, but if
that is not possible, you have add print statements to see how it
traces through the code. Then you will find where the camera should
have been recognized but isn't.

Try to narrow the incorrect statement down as much as
possible. Pointing to the precise function that is miscompiled is
required, pointing to the precise statement or expression would be
good.

Then look at the assembler output; compile this specific translation
unit with -save-temps. If you know assembler, see how the assembler
matches your source code, and find the place where it doesn't match,
then submit a bug report. If you don't know assembler, submit a bug
report right away, including both the preprocessor output and the
assembler file.

We are certainly interested to eliminate all compiler bugs that cause
kernel miscompilation. Please understand, though, that you don't
*necessarily* have encountered a compiler bug: It may be that you rely
on undefined or unspecified behaviour in your code, and that gcc 3.2
choses to interpret your code differently than 2.95. In this case, you
need to correct your code, to only use well-defined constructs.

HTH,
Martin



Reply to: