[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



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.

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.

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).

Mads

-- 
Mads Bondo Dydensborg


 
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] *