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:
Alan Burlison
Date:
September 17, 2003 14:22
Subject:
Re: Interesting - [drow@mvista.com: A user's experiences with GCC-3.4 snapshots]
Message ID:
3F68D071.4070508@uk.sun.com
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.

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

-- 
Alan Burlison
--


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