This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
cpp bug(s)?
- From: "Jim Cathey" <jimc at f5 dot com>
- To: <gcc-bugs at gcc dot gnu dot org>
- Date: Thu, 20 May 2004 12:21:00 -0700
- Subject: cpp bug(s)?
I was unable to get a (timely?) login into Bugzilla, so here goes...
The following script snippet runs on Solaris, but not on our
newer Linux boxes.
$ cat bug
# Calculate the Verilog sensitivity list for
# the (optional) non-registered FIFO read logic.
SLIST=""
if [[ $REG -eq 0 ]] ; then
SLIST=`awk "BEGIN {for (ii=0; ii<10; ii=ii+1) \
print \"or fdhold[\", ii, \"] \"}" </dev/null`
fi
echo TEST | cpp -C -P -undef -DTEST="$SLIST"
Solaris:
$ cpp --version
2.95.3
$ ksh bug
or fdhold[ 0 ]
or fdhold[ 1 ]
or fdhold[ 2 ]
or fdhold[ 3 ]
or fdhold[ 4 ]
or fdhold[ 5 ]
or fdhold[ 6 ]
or fdhold[ 7 ]
or fdhold[ 8 ]
or fdhold[ 9 ]
$
Linux:
$ cpp --version
cpp --version
cpp (GCC) 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
Copyright (C) 2002 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.
$ ksh bug
ksh bug
or fdhold[ 0 ]
$
It appears that newlines in a -D behave differently now, but the man page
for cpp (still) states:
-D name=definition
Predefine name as a macro, with definition definition. There are
no restrictions on the contents of definition...
which would lead us to believe that the older cpp is 'correct'.
******************************************************************************
Also, adding -traditional to the cpp invocation crashes the newer version.
$ cat bug
# Calculate the Verilog sensitivity list for
# the (optional) non-registered FIFO read logic.
SLIST=""
if [[ $REG -eq 0 ]] ; then
SLIST=`awk "BEGIN {for (ii=0; ii<10; ii=ii+1) \
print \"or fdhold[\", ii, \"] \"}" </dev/null`
fi
echo TEST | cpp -traditional -C -P -undef -DTEST="$SLIST"
Solaris:
$ cpp --version
2.95.3
$ ksh bug
or fdhold[ 0 ]
or fdhold[ 1 ]
or fdhold[ 2 ]
or fdhold[ 3 ]
or fdhold[ 4 ]
or fdhold[ 5 ]
or fdhold[ 6 ]
or fdhold[ 7 ]
or fdhold[ 8 ]
or fdhold[ 9 ]
$
Linux:
$ cpp --version
cpp --version
cpp (GCC) 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
Copyright (C) 2002 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.
$ ksh bug
:1: internal error in rescan, at tradcpp.c:1575
Please submit a full bug report.
See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions.
$
-- Jim Cathey (jimc@f5.com)