assembler errors when bootstrapping with #pragma optimize "0"

Martin Sebor msebor@gmail.com
Fri Oct 22 02:01:05 GMT 2021


On 10/21/21 6:10 PM, Tom Kacvinsky via Gcc wrote:
> On Thu, Oct 21, 2021 at 8:06 PM Martin Sebor via Gcc <gcc@gcc.gnu.org>
> wrote:
> 
>> I put #pragma GCC optimize "0" at the top of gimplify.c to help
>> me debug something in a bootstrapped compiler.  The file failed
>> to compile with many assembler errors like this:
>>
>> /tmp/ccL9zcXD.s: Assembler messages:
>> /tmp/ccL9zcXD.s:9: Error: CFI instruction used without previous
>> .cfi_startproc
>>
>> I've done this before and had no problems.  Is this supposed to
>> work or was I just lucky when it did before?
>>
> 
> I know the binutils people have been doing work with CFI stuff, so perhaps
> this is a binutils
> issue?  Which version of binutils are you using?  A newer version
> of binutils (or perhaps older)
> might make a difference.

I don't think the problem is Binutils.  The assembly emitted
by GCC changes with the pragma: the functions are missing
.cfi_startproc and .cfi_endproc directives, but have other
.cfi directives.  This happens even when I remove the #pragma
from the file, and the only difference is that I'm compiling
the file with a compiler that includes the same file compiled
with #pragma optimize "0".  So GCC emits different assembly
depending on whether or not its gimplify.c was compiled
optimized.  That seems like a symptom of miscompilation
to me.  The GCC binary, by the way, is stage 2.

Martin

> 
> Regards,
> 
> Tom
> 



More information about the Gcc mailing list