[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] g++ -O dræber en variabel



On Mon, 20 Jun 2005, Mads Bondo Dydensborg wrote:

> Søndag den 19. juni 2005 23:34 skrev Peter Toft:
> > Jeg har et C++ program der driller. Hvis jeg oversætter med g++ -g, g++,
> > g++ -O -g, så virker det fint - men "g++ -O" så virker det ikke - jeg har
> > sporet problemet til en compilerfejl (Insure++ på koden er "clean"), og
> > det er en variabel som er optimeret forkert væk (hvis jeg skriver et par
> > variable ud på skærmen, så kører det hele. Desværre er det meget kompleks
> > kode, så fejlen er væk hvis jeg reducerer koden.
> >
> > Hvordan kan jeg få g++ til at fortælle mig hvilke variable der er
> > optimeret væk?
> 
> Umiddelbart burde -g ikke have nogen betydning for den kode der bliver 
> genereret, kun hvorvidt der er symboler med.

Jeg er enig - men ser det modsatte...

> Som Jacob skriver, kan du med -S bede den om kun at lave assembler koden.
> 
> Ellers kan du disassemble med nm og sammenligne med og uden -g. Jeg ville 
> blive overrasket hvis der er forskel.

Det er der :)

jeg prøver -S - tak Jacob

> Og, valgrind kan iøvrigt også være god til at vise hvad der foregår. (Ligesom 
> gdb, eller, hvis man alligevel er i gang med insure og den slags, totalview).

valgrind og Insure++ viser alt er ok.

tak

Peter Toft, Ph.D. sslug@sslug http://pto.linux.dk

 Audience:  What do you want, Eric?
 Eric:  I want to live in a world where software doesn't suck.
 Richard:  Any software that isn't free sucks.
 Linus:  I'm interested in free beer.



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:44 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *