This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
RE: preprocessor/6084: cpp Segmentation Fault
- From: "Gerwin, Joshua A" <joshua dot a dot gerwin at intel dot com>
- To: nobody at gcc dot gnu dot org
- Cc: gcc-prs at gcc dot gnu dot org,
- Date: 29 Mar 2002 19:36:01 -0000
- Subject: RE: preprocessor/6084: cpp Segmentation Fault
- Reply-to: "Gerwin, Joshua A" <joshua dot a dot gerwin at intel dot com>
The following reply was made to PR preprocessor/6084; it has been noted by GNATS.
From: "Gerwin, Joshua A" <joshua.a.gerwin@intel.com>
To: "'neil@gcc.gnu.org'" <neil@gcc.gnu.org>,
"'gcc-bugs@gcc.gnu.org'"<gcc-bugs@gcc.gnu.org>,
"'gcc-prs@gcc.gnu.org'" <gcc-prs@gcc.gnu.org>,
"'joshg@hf.intel.com'" <joshg@hf.intel.com>,
"'nobody@gcc.gnu.org'"<nobody@gcc.gnu.org>,
"'rnesius@ichips.intel.com'"<rnesius@ichips.intel.com>,
"Nguyen, Tuan" <tuan.nguyen@intel.com>,
"'gcc-gnats@gcc.gnu.org'" <gcc-gnats@gcc.gnu.org>
Cc:
Subject: RE: preprocessor/6084: cpp Segmentation Fault
Date: Fri, 29 Mar 2002 11:35:17 -0800
> -----Original Message-----
> From: neil@gcc.gnu.org [mailto:neil@gcc.gnu.org]
> Sent: Friday, March 29, 2002 12:20 AM
> To: gcc-bugs@gcc.gnu.org; gcc-prs@gcc.gnu.org; joshg@hf.intel.com;
> nobody@gcc.gnu.org; rnesius@ichips.intel.com; tuan.nguyen@intel.com
> Subject: Re: preprocessor/6084: cpp Segmentation Fault
>
>
> Synopsis: cpp Segmentation Fault
>
> State-Changed-From-To: open->feedback
> State-Changed-By: neil
> State-Changed-When: Fri Mar 29 00:20:22 2002
> State-Changed-Why:
> Changed to category preprocessor; not a front end issue.
>
> Quite a surpise to me, too. I take pride in cpp not
> segfaulting 8-)
>
> Could you give me a testcase? I can't reproduce it with
> the information supplied.
> Or, could you try 3.0.4? There was a segfault fixed in the
> later 3.0 cycle, triggered by a combination of command
> line options, but I'm not sure which 3.0.x got it.
> Judging by your command line, I suspect it is caused by
> a certain combination of switches; can you reproduce it
> on a simple file like #include <stdio.h> or something?
>
> Alternatively, if you can't produce a simple testcase,
> but can get it to happen on Linux, then please send me the
> files so I can track this down, or tell me where it happens
> when you're debugging the cpp0 binary.
>
> Thanks!
>
> http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&
database=gcc&pr=6084
Sorry about the category thing, I didn't notice a preprocessor category on
the submit form.
The first sighting of the cpp segfault was in a troublesome build of op.c in
the vanilla perl 5.6.1 distribution from CPAN. However, you need not go
there. Using the same command line options, I can get it to segfault
without any source at all, simply by using ^D for stdin. Since an empty
file may be aesthetically unsatisfying, I submit the following:
$ cat ../../../../accessories/hello.c
#include <stdio.h>
#ifdef MATHTEST
#include <math.h>
#endif
main() {
float X;
printf("Hello, World! \n");
#ifdef MATHTEST
X = sqrt(4);
printf("the sqrt of 4 is %f \n", X);
#endif
}
$ /(path/to)/gcc/3.0.3-64/bin/cpp -DPERL_CORE -fno-strict-aliasing
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -mcpu=v9 -m64 -Wa,-xarch=v9 -O3
-m64 -dM -dD -dI -v ../../../../accessories/hello.c
Reading specs from
/(path/to)/gcc/3.0.3-64/lib/gcc-lib/sparcv9-sun-solaris2/3.0.3/specs
Configured with: ../gcc-3.0.3/configure --host=sparcv9-sun-solaris2
--prefix=
/(path/to)/gcc/3.0.3-64 --with-as=/usr/ccs/bin/as
--with-nm=/(path/to)/gcc/3.0.3-64/bin/nm --with-ld=/usr/ccs/bin/ld
Thread model: posix
gcc version 3.0.3
/(path/to)/gcc/3.0.3-64/lib/gcc-lib/sparcv9-sun-solaris2/3.0.3/cpp0 -lang-c
-v -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__
-D__svr4__ -D__SVR4 -D__sparc -D__sun -D__unix -Asystem=unix -Asystem=svr4
-D__OPTIMIZE__ -D__STDC_HOSTED__=1 -dM -dD -dI -D__SIZE_TYPE__=long unsigned
int -D__PTRDIFF_TYPE__=long int -D__WCHAR_TYPE__=int -D__WINT_TYPE__=int
-D__arch64__ -Acpu=sparc64 -Amachine=sparcv9 -D__sparcv9 -DPERL_CORE
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 ../../../../accessories/hello.c
GNU CPP version 3.0.3 (cpplib) (sparc)
ignoring nonexistent directory
"/(path/to)/gcc/3.0.3-64/sparcv9-sun-solaris2/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/(path/to)/gcc/3.0.3-64/lib/gcc-lib/sparcv9-sun-solaris2/3.0.3/include
/usr/include
End of search list.
cpp: Internal error: Segmentation Fault (program cpp0)
Please submit a full bug report.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
A minor experiment in option removal shows that the problem is potentially
tied to the
-dD tag. Compare:
$ /(path/to)/gcc/3.0.3-64/bin/cpp -mcpu=v9 -m64 -Wa,-xarch=v9 -O3 -m64 -dM
-dD ../../../../accessories/hello.c
cpp: Internal error: Segmentation Fault (program cpp0)
Please submit a full bug report.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
$ /usr/intel/pkgs/gcc/3.0.3-64/bin/cpp -mcpu=v9 -m64 -Wa,-xarch=v9 -O3 -m64
-dM ../../../../accessories/hello.c
#define __USER_LABEL_PREFIX__
#define _LONG_LONG_HTOL
#define __SIZE_TYPE__ long unsigned int
#define _LONG_ALIGNMENT 8
#define _LONG_DOUBLE_ALIGNMENT 16
#define P_tmpdir "/var/tmp/"
#define _SSIZE_T
#define __arch64__ 1
#define __PTRDIFF_TYPE__ long int
#define _FILE_OFFSET_BITS 64
#define _ALIGNMENT_REQUIRED 1
#define __HAVE_BUILTIN_SETJMP__ 1
#define _SHORT_ALIGNMENT 2
#define SEEK_SET 0
#define _DOUBLE_ALIGNMENT 8
#define freopen64 freopen
#define putchar(x) putc((x), stdout)
#define ftello64 ftello
#define _NO_FDISK_PRESENT
#define _BIT_FIELDS_HTOL
#define _LONG_LONG_ALIGNMENT 8
etcetera etcetera etcetera
A clue, no?
Josh Gerwin, System Programmer/Analyst
joshua.a.gerwin@intel.com
Intel Corp.
NorthWest Engineering Computing