public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Bug in CPP Causes Duplicate Output Lines (3.3.1/cygming special)
@ 2004-01-07 22:26 Yong Lu
  2004-01-10  0:25 ` Jim Wilson
  0 siblings, 1 reply; 3+ messages in thread
From: Yong Lu @ 2004-01-07 22:26 UTC (permalink / raw)
  To: gcc-bugs

[-- Attachment #1: Type: Text/Plain, Size: 4884 bytes --]

1. GCC version.

$ gcc -v
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/specs
Configured with: /GCC/gcc-3.3.1-3/configure --with-gcc --with-gnu-ld --with-gnu-as --prefix=/usr --e
xec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/sbin --mandir=/usr/share/man -
-infodir=/usr/share/info --enable-languages=c,ada,c++,f77,pascal,java,objc --enable-libgcj --enable-
threads=posix --with-system-zlib --enable-nls --without-included-gettext --enable-interpreter --enab
le-sjlj-exceptions --disable-version-specific-runtime-libs --enable-shared --disable-win32-registry
--enable-java-gc=boehm --disable-hash-synchronization --verbose --target=i686-pc-cygwin --host=i686-
pc-cygwin --build=i686-pc-cygwin
Thread model: posix
gcc version 3.3.1 (cygming special)


2. Windows XP with Cygwin:

  949k 2003/09/20 C:\cygwin\bin\cygwin1.dll
    Cygwin DLL version info:
        DLL version: 1.5.5
        DLL epoch: 19
        DLL bad signal mask: 19005
        DLL old termios: 5
        DLL malloc env: 28
        API major: 0
        API minor: 94
        Shared data: 3
        DLL identifier: cygwin1
        Mount registry: 2
        Cygnus registry name: Cygnus Solutions
        Cygwin registry name: Cygwin
        Program options name: Program Options
        Cygwin mount registry name: mounts v2
        Cygdrive flags: cygdrive flags
        Cygdrive prefix: cygdrive prefix
        Cygdrive default prefix:
        Build date: Sat Sep 20 16:31:15 EDT 2003
        CVS tag: cr-0x9b
        Shared id: cygwin1S3

Package Information:

gcc                     3.3.1-3
gcc-ada                 3.3.1-3
gcc-g++                 3.3.1-3
gcc-g77                 3.3.1-3
gcc-mingw               20030911-4
gcc-mingw-ada           20031020-1
gcc-mingw-core          20031020-1
gcc-mingw-g++           20031020-1
gcc-mingw-g77           20031020-1

3. GCC configuration:

Configured with: /GCC/gcc-3.3.1-3/configure --with-gcc --with-gnu-ld --with-gnu-as --prefix=/usr --e
xec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/sbin --mandir=/usr/share/man -
-infodir=/usr/share/info --enable-languages=c,ada,c++,f77,pascal,java,objc --enable-libgcj --enable-
threads=posix --with-system-zlib --enable-nls --without-included-gettext --enable-interpreter --enab
le-sjlj-exceptions --disable-version-specific-runtime-libs --enable-shared --disable-win32-registry
--enable-java-gc=boehm --disable-hash-synchronization --verbose --target=i686-pc-cygwin --host=i686-
pc-cygwin --build=i686-pc-cygwin
Thread model: posix

4. Command line that triggers the bug:

$ gcc -v -save-temps -I. -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0400 -D_X86_=1 -g -mno-cygwin -mcpu
=i686 -O2  -Di386 -D_CRTAPI1=_cdecl  -DXPM_NO_X -U_FILE_DEFINED -Demacs=1 -DWINDOWSNT -DDOS_NT -DHA
VE_CONFIG_H -I../nt/inc -D_UCHAR_T -DHAVE_NTGUI=1 -DUSE_CRT_DLL=1 -DPURESIZE=5000000 -c emacs.c

5. Output.

 /usr/lib/gcc-lib/i686-pc-mingw32/3.3.1/cc1.exe -E -quiet -v -I. -I../nt/inc -D__GNUC__=3 -D__GNUC_M
INOR__=3 -D__GNUC_PATCHLEVEL__=1 -D__MSVCRT__ -D__MINGW32__ -DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ -
DWINNT -idirafter /usr/lib/gcc-lib/i686-pc-mingw32/3.3.1/../../../../include/w32api -idirafter /usr/
lib/gcc-lib/i686-pc-mingw32/3.3.1/../../../../i686-pc-mingw32/lib/../../include/w32api -DWIN32_LEAN_
AND_MEAN -D_WIN32_WINNT=0x0400 -D_X86_=1 -Di386 -D_CRTAPI1=_cdecl -DXPM_NO_X -U_FILE_DEFINED -Demacs
=1 -DWINDOWSNT -DDOS_NT -DHAVE_CONFIG_H -D_UCHAR_T -DHAVE_NTGUI=1 -DUSE_CRT_DLL=1 -DPURESIZE=5000000
 emacs.c -mno-cygwin -mcpu=i686 -O2 emacs.i
ignoring nonexistent directory "/usr/local/include/mingw"
ignoring duplicate directory "/usr/include/mingw"
ignoring duplicate directory "/usr/i686-pc-mingw32/lib/../../include/w32api"
#include "..." search starts here:
#include <...> search starts here:
 .
 ../nt/inc
 /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/include
 /usr/i686-pc-mingw32/include
 /usr/include/w32api
End of search list.
 /usr/lib/gcc-lib/i686-pc-mingw32/3.3.1/cc1.exe -fpreprocessed emacs.i -quiet -dumpbase emacs.c -mno
-cygwin -mcpu=i686 -auxbase emacs -g -O2 -version -o emacs.s
GNU C version 3.3.1 (cygming special) (i686-pc-cygwin)
        compiled by GNU C version 3.3.1 (cygming special).
GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=130941
In file included from s/ms-w32.h:394,
                 from config.h:292,
                 from emacs.c:23:
/usr/i686-pc-mingw32/include/stdio.h:388: error: syntax error before '*' token

6. The preprocessed file (please see the attachment).  Line 478 in the
   preprocessed file triggers the 'syntax error'.  Lines 475 to 478
   are duplicates of lines 462 to 465, and as the result line 478 is
   incorrectly expanded using a macro definition.


Yong Lu

--------------------------
Ph.D. Student
Computer Science Department
Carnegie Mellon University
5000 Forbes Avenue
Pittsburgh, PA 15213-3891


[-- Attachment #2: emacs.i.gz --]
[-- Type: Application/Octet-Stream, Size: 80611 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bug in CPP Causes Duplicate Output Lines (3.3.1/cygming special)
  2004-01-07 22:26 Bug in CPP Causes Duplicate Output Lines (3.3.1/cygming special) Yong Lu
@ 2004-01-10  0:25 ` Jim Wilson
  2004-01-14 11:24   ` Yong Lu
  0 siblings, 1 reply; 3+ messages in thread
From: Jim Wilson @ 2004-01-10  0:25 UTC (permalink / raw)
  To: Yong Lu; +Cc: gcc-bugs

Yong Lu wrote:
> 6. The preprocessed file (please see the attachment).  Line 478 in the
>    preprocessed file triggers the 'syntax error'.  Lines 475 to 478
>    are duplicates of lines 462 to 465, and as the result line 478 is
>    incorrectly expanded using a macro definition.

There isn't enough info to fully understand this problem.  You mentioned 
the problem occured while compiling emacs, but you didn't mention the 
emacs version number.  You gave us preprocessed output which shows the 
error, but since the error occurred during preprocessing, we really need 
the original source not the preprocessor output.

However, given the info I have, this doesn't look like a gcc problem. 
These duplicate lines come from <stdio.h>, and if you look at this file, 
it has two declarations for the function fgetchar/fputchar/fdopen.  The 
first one has underscores, the second doesn't.  Apparently, there is a 
header file someone that converted the second into the first via macros.

The problematic line before cpp is
_CRTIMP int __cdecl     fileno (FILE*);
So it appears that there is also a macro somewhere for fileno which 
converts fileno(arg) to (arg)->_file, which gives us the error we see. 
This is perhaps a bug in emacs sources, or perhaps a bug in cygwin, I 
don't have enough info to tell.  I seriously doubt that this is a gcc bug.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bug in CPP Causes Duplicate Output Lines (3.3.1/cygming special)
  2004-01-10  0:25 ` Jim Wilson
@ 2004-01-14 11:24   ` Yong Lu
  0 siblings, 0 replies; 3+ messages in thread
From: Yong Lu @ 2004-01-14 11:24 UTC (permalink / raw)
  To: wilson; +Cc: gcc-bugs

>>>>> "Jim" == Jim Wilson <wilson@specifixinc.com> writes:


    > However, given the info I have, this doesn't look like a gcc problem. 
    > These duplicate lines come from <stdio.h>, and if you look at this file, 
    > it has two declarations for the function fgetchar/fputchar/fdopen.  The 
    > first one has underscores, the second doesn't.  Apparently, there is a 
    > header file someone that converted the second into the first via macros.

    > The problematic line before cpp is
    > _CRTIMP int __cdecl     fileno (FILE*);
    > So it appears that there is also a macro somewhere for fileno which 
    > converts fileno(arg) to (arg)->_file, which gives us the error we see. 
    > This is perhaps a bug in emacs sources, or perhaps a bug in cygwin, I 
    > don't have enough info to tell.  I seriously doubt that this is a gcc bug.
    > -- 
    > Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com

Thanks for your reply.

I checked the headers and you were right that 'fileno' was define'd elsewhere.
There's a line in a header that comes with emacs (ms-w32.h)

#define fileno    _fileno

and this in turn was expanded to ((FILE*)->_file), and triggered the
error.

- Yong


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-01-14 11:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-07 22:26 Bug in CPP Causes Duplicate Output Lines (3.3.1/cygming special) Yong Lu
2004-01-10  0:25 ` Jim Wilson
2004-01-14 11:24   ` Yong Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).