delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/06/21/07:51:56

From: invalid AT erehwon DOT invalid (Graaagh the Mighty)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Strange behavior of compiler.
Organization: Low Charisma Anonymous
Message-ID: <3b31a893.176123084@news.primus.ca>
References: <3b31a377 DOT 174815003 AT news DOT primus DOT ca>
X-Newsreader: Forte Free Agent 1.11/32.235
Lines: 33
Date: Thu, 21 Jun 2001 07:58:54 GMT
NNTP-Posting-Host: 207.176.153.34
X-Complaints-To: news AT primus DOT ca
X-Trace: news2.tor.primus.ca 993110301 207.176.153.34 (Thu, 21 Jun 2001 03:58:21 EDT)
NNTP-Posting-Date: Thu, 21 Jun 2001 03:58:21 EDT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Thu, 21 Jun 2001 07:46:24 GMT, invalid AT erehwon DOT invalid (Graaagh the
Mighty) sat on a tribble, which squeaked:

>Call frame traceback EIPs:
>  0x01fc0000   0x1fc0000
>  0x0000178b   _main+275, line 195 of bwlsm.c
>  0x00057b7a   ___crt1_startup+174

>gcc bwlsm.c -o bwlsm.exe -lalleg -g -Wall -Werror
>i.e. only default optimizations, nothing whatsoever aggressive.

>The weirdest thing is that the program worked fine until I added some
>debugging printfs to bar, whereupon it started dying before it could
>even *reach* bar...

I have more information. On a hunch I looked at the changes. There was
a bug in one of the debugging bits I added that would in fact have
jumped into never-never land -- *if* "bar" had ever been reached. So
why weren't the call frame traceback EIPs more like:

  0x01fc0000   0x1fc0000
  0x00f00ba7   _bar+42, line 666 of bwlsm.c
  0x0000178b   _main+275, line 195 of bwlsm.c
  0x00057b7a   ___crt1_startup+174

even with no aggressive optimizations? There's no way it was inlining
bar -- not with less than -O3, not with bar as big as it is (~200
loc), and not with bar called via a function pointer!
-- 
Bill Gates: "No computer will ever need more than 640K of RAM." -- 1980
"There's nobody getting rich writing software that I know of." -- 1980
"This antitrust thing will blow over." -- 1998
Combine neo, an underscore, and one thousand sixty-one to make my hotmail addy.

- Raw text -


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