develooper Front page | perl.perl5.porters | Postings from September 2003

Re: Interesting - [drow@mvista.com: A user's experiences with GCC-3.4 snapshots]

Thread Previous | Thread Next
From:
Graham Barr
Date:
September 17, 2003 14:24
Subject:
Re: Interesting - [drow@mvista.com: A user's experiences with GCC-3.4 snapshots]
Message ID:
1063833863.12362.55.camel@zipper.mutatus.co.uk
On Wed, 2003-09-17 at 22:21, Alan Burlison wrote:
> Graham Barr wrote:
> 
> > Instead of trying to second guess what all optimizers will do, why not 
> > do something you *know* that they cannot do
> > 
> > int
> > main(int argc, char **argv) {
> >   if (argc == 9999) {
> >     extern void *setproctitle();
> >     setproctitle();
> >   }
> >   return 0;
> > }
> 
> That will dump core if you actually run the resulting a.out, and Configure 
> can be told to do so (for those platforms that link even if the symbol 
> doesn't exist - sigh.)  On those platforms it is necessary to actually run 
> the a.out to check the symbol exists - however a call of a function that 
> expects arguments without any usually results in a core dump.

Look closely. It will only attempt to call the function if you pass 9999
arguments on the command line. Given Configure will proabbly call it
with none, the call will never be made.

Graham.

> 
> I think the ((VFUNC*)func != (VFUNC*)main) test is the way to go.


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About