Effect of 'register' keyword on debug info
Rohit Arul Raj
rohitarulraj@gmail.com
Fri May 25 08:07:00 GMT 2012
On Thu, May 24, 2012 at 8:23 PM, Ian Lance Taylor <iant@google.com> wrote:
> Rohit Arul Raj <rohitarulraj@gmail.com> writes:
>
>> 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?
>
> Yes.
>
> Ian
Further, by default the debug info for variables 'd1' and 'f1' are
generated as location expressions. Where as with '-fvar-tracking', the
debug info is generated as location lists.
1) Is it possible to generate location expressions to identify that
the variable has been optimized out?
2) If (1) is not possible and if '-fvar-tracking' gives accurate info
on live variables, why isn't it turned ON by default at '-O0'?
Since the code is compiled at '-O0' should correct debug info be generated?
Thanks for the help,
Rohit
More information about the Gcc-help
mailing list