g++-2.95.2 on HP-UX 11.00: return value of main()

Ulrich Windl Ulrich.Windl@rz.uni-regensburg.de
Tue Apr 18 23:05:00 GMT 2000


On 18 Apr 00, at 4:17, Jeffrey A Law wrote:

> 
>   In message < orya6gj113.fsf@zecarneiro.lsd.ic.unicamp.br >you write:
>   > On Apr 14, 2000, "Ulrich Windl" <Ulrich.Windl@rz.uni-regensburg.de> wrote:
>   > 
>   > > So we can say the ANSI standard says it (returning exitcodes from 
>   > > main()) should work?
>   > 
>   > Yep.  It's expected to work.  It's probably a HP-UX 11-specific bug.
>   > One of the issues that needed porting, that hadn't been done by the
>   > time GCC 2.95 was released.
> While hpux11 is not supported in gcc-2.95, this bug sounds like it would
> not be hpux11 specific.

I have not studied the internals, but I can imagine that either the C 
library or the C++ library is responsible for passing the return 
value of main() to the calling environment. However if it works for 
HP-C and HP-C++ it might still be a bug in gcc/g++.

I made a test on the machine where I compiled the binary:

rkdvmhp3:windl(23) % cc e.c
/usr/ccs/bin/ld: (Warning) At least one PA 2.0 object file (e.o) was 
detected. T
he linked output may not run on a PA 1.x system.
rkdvmhp3:windl(24) % a.out
rkdvmhp3:windl(25) % echo $status
11
rkdvmhp3:windl(26) % cat e.c
int main()
{
        return 11;
}

Unfortunately I have no gdb to disassemble here.

Regards,
Ulrich



More information about the Gcc-bugs mailing list