Effect of 'register' keyword on debug info

Rohit Arul Raj rohitarulraj@gmail.com
Thu May 24 07:03:00 GMT 2012


On Thu, May 24, 2012 at 3:40 AM, Ian Lance Taylor <iant@google.com> wrote:
> Rohit Arul Raj <rohitarulraj@gmail.com> writes:
>
>> Looking at the debug info and the generated assembly, the values of
>> variables 'f1' and 'd1' are stored in the same register.
>> Due to this, while debugging, after setting the break point at (A)
>> [line no 8], if we print the value of 'f1' i get the wrong value.
>
>
>> Q: Is this the side effect of using 'register' keyword? If 'f1' is
>> getting optimized out, shouldn't we get that info while debugging?
>
> This question as stated is not really appropriate for the mailing list
> gcc@gcc.gnu.org, which is for the development of GCC itself.  This
> question would be appropriate for gcc-help@gcc.gnu.org.  Please take any
> followups to gcc-help.  Thanks.
>
> This has nothing to do with using the register keyword.
>
> Yes, you should ideally be told when a value is unavailable.  This
> specific area of GCC has been much improved since GCC 4.5.2.
>

Thanks Ian.
I tried with gcc v4.6.3 and get the same behavior.
Should this be considered as a bug with debug info generation then?

>
>> Also, using -fvar-tracking, i get this output while debugging the same
>> code.
>
> That looks like better output to me.
>
> Ian



More information about the Gcc-help mailing list