🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1358

cpp gets SIGBUS on long #include "..." pathname

#1358
From: Andrew Bettison
Date: Wed, 11 Nov 1992 21:42
287 lines
9792 bytes
	The following program, in x.cc, causes an internal compiler
	error; cpp dies with a SIGBUS (signal 10).
	
:::::::: x.cc ::::::::
#include "/extra/src/languages/c++/libg++-2.2/libg++/g++-include/stdio.h"
::::::::::::::::

	Here's the transcript:

$ uname -a
suite.sw.oz.au suite.sw.oz.au 4_52 UMIPS mips
$ pwd
/usr/home/andrewb/tmp
$ ls -l x.cc
-rw-rw----   1 andrewb  softway       74 Nov 11 17:14 x.cc
$ gcc -nostdinc -I- -I/extra/src/languages/c++/libg++-2.2/libg++ -v x.cc
Reading specs from /usr/local/lib/gcc-lib/mips-mips-sysv/2.3.1/specs
gcc version 2.3.1
 /usr/local/lib/gcc-lib/mips-mips-sysv/2.3.1/cpp -lang-c++ -nostdinc -v -I- -I/extra/src/languages/c++/libg++-2.2/libg++ -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dmips -Dunix -Dhost_mips -DMIPSEB -DR3000 -DSYSTYPE_SYSV -D_mips -D_unix -D_host_mips -D_MIPSEB -D_R3000 -D_SYSTYPE_SYSV -D__mips__ -D__unix__ -D__host_mips__ -D__MIPSEB__ -D__R3000__ -D__SYSTYPE_SYSV__ -D___mips__ -D___unix__ -D___host_mips__ -D___MIPSEB__ -D___R3000__ -D___SYSTYPE_SYSV__ -D__mips -D__unix -D__host_mips -D__MIPSEB -D__R300




0 -D__SYSTYPE_SYSV -D___mips -D___unix -D___host_mips -D___MIPSEB -D___R3000 -D___SYSTYPE_SYSV -D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS -D__LANGUAGE_C -D_LANGUAGE_C -DLANGUAGE_C x.cc /usr/tmp/cca09471.i
GNU CPP version 2.3.1 [AL 1.1, MM 28] RISC-OS System V Mips
gcc: Internal compiler error: program cpp got fatal signal 10
$ _

	I suspect this problem has something to do with long
	pathnames to the #include directive.  I changed x.cc to
	use an incomplete pathname, relying on the -I option to
	fill it in.

:::::::: x.cc ::::::::
#include "g++-include/stdio.h"
::::::::::::::::

	The result is that cpp performs properly; giving an error
	message and terminating normally.  Here's the transcript:

$ ls -l x.cc
-rw-rw----   1 andrewb  softway       31 Nov 11 17:36 x.cc
$ gcc -nostdinc -I- -I/extra/src/languages/c++/libg++-2.2/libg++ -v x.cc
Reading specs from /usr/local/lib/gcc-lib/mips-mips-sysv/2.3.1/specs
gcc version 2.3.1
 /usr/local/lib/gcc-lib/mips-mips-sysv/2.3.1/cpp -lang-c++ -nostdinc -v -I- -I/extra/src/languages/c++/libg++-2.2/libg++ -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dmips -Dunix -Dhost_mips -DMIPSEB -DR3000 -DSYSTYPE_SYSV -D_mips -D_unix -D_host_mips -D_MIPSEB -D_R3000 -D_SYSTYPE_SYSV -D__mips__ -D__unix__ -D__host_mips__ -D__MIPSEB__ -D__R3000__ -D__SYSTYPE_SYSV__ -D___mips__ -D___unix__ -D___host_mips__ -D___MIPSEB__ -D___R3000__ -D___SYSTYPE_SYSV__ -D__mips -D__unix -D__host_mips -D__MIPSEB -D__R300




0 -D__SYSTYPE_SYSV -D___mips -D___unix -D___host_mips -D___MIPSEB -D___R3000 -D___SYSTYPE_SYSV -D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS -D__LANGUAGE_C -D_LANGUAGE_C -DLANGUAGE_C x.cc /usr/tmp/cca09808.i
GNU CPP version 2.3.1 [AL 1.1, MM 28] RISC-OS System V Mips
In file included from x.cc:1:
/extra/src/languages/c++/libg++-2.2/libg++/g++-include/stdio.h:69: No include path in which to find stdio.h
$ _

	Here are the included files:

:::::::: /extra/src/languages/c++/libg++-2.2/libg++/g++-include/stdio.h ::::::::
// This may look like C code, but it is really -*- C++ -*-
/* 
Copyright (C) 1988 Free Software Foundation
    written by Doug Lea (dl@rocky.oswego.edu)

This file is part of the GNU C++ Library.  This library is free
software; you can redistribute it and/or modify it under the terms of
the GNU Library General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.  This library is distributed in the hope
that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.  See the GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#ifndef _stdio_h
#ifdef __GNUG__
#pragma interface
#endif

#ifdef __stdio_h_recursive
#include_next <stdio.h>
#else
#define __stdio_h_recursive

// Note:  The #define _stdio_h is at the end of this file,
// in case #include_next <stdio.h> finds an installed version of this
// same file -- we want it to continue until it finds the C version.

#include <_G_config.h>

extern "C" {

#undef NULL

#define fdopen __hide_fdopen
#define fopen __hide_fopen
#define fprintf __hide_fprintf
#define fputs __hide_fputs
#define fread __hide_fread
#define freopen __hide_freopen
#define fscanf __hide_fscanf
#define ftell __hide_ftell
#define fwrite __hide_fwrite
#define new __hide_new /* In case 'new' is used as a parameter name. */
#define perror __hide_perror
#define popen __hide_popen
#define printf __hide_printf
#define puts __hide_puts
#define putw __hide_putw
#define rewind __hide_rewind
#define tempnam __hide_tempnam
#define scanf __hide_scanf
#define setbuf __hide_setbuf
#define setbuffer __hide_setbuffer
#define setlinebuf __hide_setlinebuf
#define setvbuf __hide_setvbuf
#define sprintf __hide_sprintf
#define sscanf __hide_sscanf
#define tempnam __hide_tempnam
#define vfprintf __hide_vfprintf
#define vprintf __hide_vprintf
#define vsprintf __hide_vsprintf
#define _flsbuf __hide__flsbuf

#include_next <stdio.h>

#undef fdopen
#undef fopen
#undef fprintf
#undef fputs
#undef fread
#undef freopen
#undef fscanf
#undef ftell
#undef fwrite
#undef new
#undef perror
#undef popen
#undef printf
#undef puts
#undef putw
#undef rewind
#undef tempnam
#undef scanf
#undef setbuf
#undef setbuffer
#undef setlinebuf
#undef setvbuf
#undef sprintf
#undef sscanf
#undef tempnam
#undef vprintf
#undef vfprintf
#undef vsprintf
#undef _flsbuf

#ifndef NULL
#define NULL _G_NULL
#endif

#ifndef size_t
#define size_t _G_size_t
#endif
}

extern "C" {

int    fclose(FILE*);
FILE*  fdopen(int, const char*);
int    fflush(FILE*);
int    fgetc(FILE*);
char*  fgets(char*, int, FILE *);
FILE*  fopen(const char*, const char*);
int    fprintf(FILE*, const char* ...);
int    fputc(int, FILE*);
int    fputs(const char*, FILE*);
size_t fread(void*, size_t, size_t, FILE*);
#ifdef VMS
FILE*  freopen(const char*, const char*, FILE* ...);
#else
FILE*  freopen(const char*, const char*, FILE*);
#endif
int    fscanf(FILE*, const char* ...);
int    fseek(FILE*, long, int);
long   ftell(FILE *);
size_t fwrite(const void*, size_t, size_t, FILE*);
char*  gets(char*);
int    getw(FILE*);
int    pclose(FILE*);
void   perror(const char*);
FILE*  popen(const char*, const char*);
int    printf(const char* ...);
int    puts(const char*);
int    putw(int, FILE*);
int    rewind(FILE*);
int    scanf(const char* ...);
void   setbuf(FILE*, char*);
void   setbuffer(FILE*, char*, int);
int    setlinebuf(FILE*);
int    setvbuf(FILE*, char*, int, size_t);
int    sscanf(char*, const char* ...);
FILE*  tmpfile();
int    ungetc(int, FILE*);
int    vfprintf _G_ARGS((FILE*, const char*, _G_va_list));
int    vprintf _G_ARGS((const char*, _G_va_list));
_G_sprintf_return_type sprintf _G_ARGS((char*, const char* ...));
_G_sprintf_return_type vsprintf _G_ARGS((char*, const char*, _G_va_list));

extern int _filbuf _G_ARGS((FILE*));
extern int _flsbuf _G_ARGS((unsigned, FILE*));

}

#ifndef L_ctermid
#define L_ctermid	9 
#endif
#ifndef L_cuserid
#define L_cuserid	9
#endif
#ifndef P_tmpdir
#define	P_tmpdir    "/tmp/"
#endif
#ifndef L_tmpnam
#define	L_tmpnam    (sizeof(P_tmpdir) + 15)
#endif

#define _stdio_h 1

#endif
#endif // _stdio_h
::::::::::::::::

:::::::: /extra/src/languages/c++/libg++-2.2/libg++/_G_config.h ::::::::
/* AUTOMATICALLY GENERATED; DO NOT EDIT! */ 
#ifndef _G_config_h
#define _G_config_h
#define _G_NAMES_HAVE_UNDERSCORE 0
#define _G_DOLLAR_IN_LABEL 1
#define _G_HAVE_ST_BLKSIZE 0
#define _G_clock_t int /* default */
#define _G_dev_t short
#define _G_fpos_t long /* default */
#define _G_gid_t unsigned short
#define _G_ino_t unsigned long
#define _G_mode_t int /* default */
#define _G_nlink_t int /* default */
#define _G_off_t long
#define _G_pid_t int /* default */
#define _G_ptrdiff_t long int
#define _G_sigset_t int /* default */
#define _G_size_t unsigned int
#define _G_time_t long
#define _G_uid_t unsigned short
#define _G_wchar_t int
#define _G_ssize_t  int /* default */
/* #define _G_NEED_STDARG_H */
#define _G_va_list char *
#define _G_signal_return_type void
#define _G_sprintf_return_type int
#define _G_BUFSIZ 4096 
#define _G_FOPEN_MAX 32 /* default */
#define _G_FILENAME_MAX 1024 /* default */
#define _G_NULL 0 /* default */
#ifdef _G_USE_PROTOS
#define _G_ARGS(ARGLIST) ARGLIST
#else
#define _G_ARGS(ARGLIST) (...)
#endif
#define _G_SYSV
#define _G_HAVE_SYS_RESOURCE 0
#define _G_HAVE_SYS_SOCKET 1
#define _G_HAVE_SYS_WAIT 1
#define _G_HAVE_UNISTD 1
#define _G_HAVE_DIRENT 1
/* #define _G_BROKEN_SIGNED_CHAR */
/* #define _G_FRIEND_BUG */
#endif /* !_G_config_h */
::::::::::::::::

	I hope this is helpful.

-- 
Andrew Bettison (andrewb@softway.sw.oz.au)
"Gravity.  Not just a good idea.  It's the law."
Technical Details
Message-ID: <199211110642.AA09887@suite.sw.oz.au>
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!iggy.GW.Vitalink.COM!cs.widener.edu!hela.iti.org!usc!cs.utexas.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!suite.sw.oz.AU!andrewb

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!iggy.GW.Vitalink.COM!cs.widener.edu!hela.iti.org!usc!cs.utexas.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!suite.sw.oz.AU!andrewb
From: andrewb@suite.sw.oz.AU (Andrew Bettison)
Subject: cpp gets SIGBUS on long #include "..." pathname
Message-ID: <199211110642.AA09887@suite.sw.oz.au>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 11 Nov 1992 21:42:05 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 278