[gccsdk] GCC 4.1.1 release 1b and pre-release 2: system()/redirection problem

Duncan Moore duncan_moore at ntlworld.com
Wed Jan 7 12:52:56 PST 2009


I've been using VRPC RISC OS 4.39 and GCCSDK GCC 4.1.1 pre-release 2.

Standard ouput is getting lost after a system call, if file redirection is 
used. For example, in the following, "abc" works as expected, but "abc > 
out" loses the second printf output:

*type c.abc
#include <stdio.h>
#include <stdlib.h>

int main(void) {

  printf("1\n");

  if (system("gcc --version")!=0) printf("system error\n");

  printf("2\n");

  return 0;
}
*
*gcc -o abc abc.c
*
*abc
1
gcc (GCC) 4.1.1 (GCCSDK GCC 4.1.1 pre-release 2)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

2
*
*abc > out
*type out
1
gcc (GCC) 4.1.1 (GCCSDK GCC 4.1.1 pre-release 2)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

*

The same thing happens with release 1. With pre-release 1 it seems to work. 
I get:

*abc
1
gcc (GCC) 4.1.1 (GCCSDK GCC 4.1.1 Prerelease 1)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

2
*
*abc > out
gcc (GCC) 4.1.1 (GCCSDK GCC 4.1.1 Prerelease 1)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

*type out
1
2
*

I'm not sure where the output from system() is supposed to go (or even if it 
is clearly defined), but the second printf has not been lost.

Regards

Duncan Moore 





More information about the gcc mailing list