Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 239152

Summary: strange debuging messages with g++ (gcc 4.1.2) & gdb 6.7.1
Product: Gentoo Linux Reporter: pavel sanda <ps>
Component: [OLD] Core systemAssignee: Gentoo Linux bug wranglers <bug-wranglers>
Status: RESOLVED INVALID    
Severity: normal CC: SebastianLuther
Priority: High    
Version: unspecified   
Hardware: x86   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: file.c

Description pavel sanda 2008-09-30 14:18:14 UTC
i got some strange bugs on my system and when i've tried to find out whats the problem i arrive to the attached small example.
when i compile it this way:
g++ pom.c -Wall -g -Wextra

then i launch gdb(6.7.1-r3) and set arguments this way:
set args 0.7 0 10000 10
when i come to the lines:
double alpha=0.1;
alpha=atof(argv[1]);

variable doesn't change its value at all.

can anybody reproduce it?

Reproducible: Always

Steps to Reproduce:
Comment 1 pavel sanda 2008-09-30 14:19:37 UTC
Created attachment 166829 [details]
file.c
Comment 2 pavel sanda 2008-09-30 14:39:59 UTC
perhaps there is nothing wrong with the gcc, only gdb does not recognize it has been compiled via g++. gcc compilation is ok, and printf of alpha works also ok.
Comment 3 Sebastian Luther (few) 2008-09-30 21:01:30 UTC
The reason for this is that your program contains the variable "alpha" twice. If you are not lucky enough gdb prints the wrong one with "print alpha". You can see them both with "info locals". Rename one of your alpha's and you get what you expect. 
Comment 4 pavel sanda 2008-09-30 21:06:32 UTC
aha, so this is not a bug; i will close it then.