http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46672

           Summary: Problem with fork and buffer
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: debaya...@gmail.com


I typed the following program on my machine:

#include <stdio.h>

int main()
{
 printf("Hello");
 fork();
 printf("World");
}

The output I get is: HelloWorldHelloWorld

I then change line number 5:

#include <stdio.h>

int main()
{
 printf("Hello\n");
 fork();
 printf("World");
}

The output becomes: 

Hello
WorldWorld


So in effect adding a \n eats up a Hello\n as well.
I think this is a bug, but not sure where.

Reply via email to