This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more infromation.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
----- Original Message ----- From: RakeshN <rakeshn@kpit.com> > Hello, > > I am using gdb to debug a small program...... > > Prog Name:test.c > > int main() > { > int a,d; > > a=1; > a=a+3; > > } > (...) > > When i print the value of 'a' using print /x a > the value is > > $1 = 0x0 > > Why so? since i have assigned a to 1. With optimizations switched on (-O2 is default) assignments to automatic variables are eliminated when possible (that is, when the automatics are not used as rvalues. Either switch optimizations off (-O0) or make the variables static: int a; int main() { a=1; a=a+3; } > > Thanks for any help Regards, Ralf ..... ô ô ) -----oOOo--(_)---oOOo------ Ralf Guetlein Biotest Medizintechnik GmbH Industriestrasse 19 D-63755 Alzenau Germany --------------------------- Tel. +49 6023 9487-42 Fax. +49 6023 9487-33 ralf.guetlein@biotest-mt.de --------------------------- ------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |