delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2006/12/08/16:05:34

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Subject: Profiling with -pg and arguments to main() - GCC 4.1.0
To: djgpp AT delorie DOT com
X-Mailer: Lotus Notes Release 6.5.4 CCH5 September 12, 2005
Message-ID: <OF3C43306A.9EFD688F-ON8725723E.005FBADE-8725723E.0073AF7A@seagate.com>
From: Gordon DOT Schumacher AT seagate DOT com
Date: Fri, 8 Dec 2006 14:03:36 -0700
X-MIMETrack: Serialize by Router on SV-GW1/Seagate Internet(Release 7.0.1 HF29|March 07, 2006) at
12/08/2006 01:03:39 PM
MIME-Version: 1.0
X-Proofpoint-FWRule: outbound2
X-Proofpoint-Virus-Version: vendor=fsecure engine=4.65.5446:2.3.11,1.2.37,4.0.164 definitions=2006-12-08_07:2006-12-08,2006-12-08,2006-12-08 signatures=0

I've discovered a strange bug in applications compiled with the -pg switch
(at least with the setup I have).  The file test.c contains the following:

#include <stdio.h>
int main(int argc, char *argv[], char *envp[])
{
   printf("argc/argv/envp are at %p %p %p\n", &argc, &argv, &envp);
   return 0;
}

bash-2.05b $ gcc test.c -o test.exe && ./test.exe
argc/argv/envp are at 92c38 92c3c 92c40

bash-2.05b $ gcc test.c -o test.exe -pg && ./test.exe
argc/argv/envp are at 0 4 8


The culprit appears to be my GCC version: I'm running with v4.1.0.  If I
drop back to v4.0.1 it works fine.  I've tried both DJGPP v2.04 and
v2.03; this makes no difference (I am generally using v2.04).

So I'm not quite sure where to go from here in debugging... ideas?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019