c/6198: reaching end of main() should cause return with 0
safari@iki.fi
safari@iki.fi
Fri Apr 5 23:16:00 GMT 2002
>Number: 6198
>Category: c
>Synopsis: reaching end of main() should cause return with 0
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Apr 05 17:36:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: safari@iki.fi
>Release: 3.0.4
>Organization:
>Environment:
Linux 2.4.19-pre3-aa2 i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: /mnt/tmpfs/1/gcc-3.0.4/configure
>Description:
http://www.opengroup.org/onlinepubs/007904975/functions/exit.html
says:
"Reaching the end of the main() function has the same behavior as calling exit(0)."
however, gcc does not set %eax register to 0 before `ret', causing (on my system) this program to return with 1:
int main(void) { }
>How-To-Repeat:
>Fix:
trivial ;-D
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list