This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

cpp command overwrites input files



I've been trying to test gcc-2.95 by trying to build the NetBSD world for 
the ARM with it, and I've found a nasty gotcha in the new cpp front-end.  
One of the build utils in the NetBSD tree uses the cpp to pre-process 
certain include files with the command

	cpp -nostdinc -idirafter /usr/include -dM /usr/include/sys/ioctl.h 
/usr/include/sys/ioctl_compat.h

This is translated by the new front end (output of cpp -v) to 

Reading specs from /work/rearnsha/gnu/install/lib/gcc-lib/arm-unknown-netbs
d1.4/gcc-2.95/specs
gcc version gcc-2.95 19990622 (prerelease)
 /work/rearnsha/gnu/install/lib/gcc-lib/arm-unknown-netbsd1.4/gcc-2.95/cpp 
-lang-c -nostdinc -v -Dunix -Driscbsd -Darm32 -D__arm32__ -D__arm__ 
-D__NetBSD__ -D__unix__ -D__riscbsd__ -D__arm32__ -D__arm32__ -D__arm__ 
-D__NetBSD__ -D__unix -D__riscbsd -D__arm32 -Asystem(unix) 
-Asystem(NetBSD) -Acpu(arm) -Amachine(arm) -D__CHAR_UNSIGNED__ -dM 
-D__ARM_ARCH_3__ -D__APCS_32__ -D__SOFTFP__ -idirafter /usr/include 
/usr/include/sys/ioctl.h -o /usr/include/sys/ioctl_compat.h
GNU CPP version gcc-2.95 19990622 (prerelease) (ARM/NetBSD)
#include "..." search starts here:
#include <...> search starts here:
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
 /work/rearnsha/gnu/install/lib/gcc-lib/arm-unknown-netbsd1.4/gcc-2.95/../.
./../../include/g++-2
 /work/rearnsha/gnu/install/include
 /work/rearnsha/gnu/install/lib/gcc-lib/arm-unknown-netbsd1.4/gcc-2.95/../.
./../../arm-unknown-netbsd1.4/include
 /work/rearnsha/gnu/install/lib/gcc-lib/arm-unknown-netbsd1.4/gcc-2.95/incl
ude
 /usr/include
End of omitted list.
cpp: /usr/include/sys/ioctl_compat.h: Permission denied
cpp: /usr/include/sys/ioctl_compat.h: Permission denied


Note that the spec has generated a -o option with the final input file as 
the target output file (previously it would have written this to stdout).

Of course, if running as root (as has to be the case when building the 
netbsd system) this will blow away an installed include file.

BTW "cpp -o -" doesn't write to stdout, nor does cpp -E.

IMO this is a nasty regression.

Richard.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]