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: 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 Content-type: text/plain; charset=US-ASCII 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 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?