public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/46814] New: Off by one in "In file included from" with already-preprocessed source
@ 2010-12-06  4:39 dustin at howett dot net
  2010-12-06  5:22 ` [Bug preprocessor/46814] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: dustin at howett dot net @ 2010-12-06  4:39 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46814

           Summary: Off by one in "In file included from" with
                    already-preprocessed source
           Product: gcc
           Version: 4.4.4
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: preprocessor
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: dustin@howett.net


linemap_print_containing_files is reporting invalid line numbers in source that
has already been run through the preprocessor. Tested on 4.2.1, 4.4.1 and
4.4.4, do not immediately have access to higher versions but will check.
This bug is also manifested via -save-temps (!).

Compilers tested:
gcc version 4.4.4 (Gentoo 4.4.4-r1 p1.0, pie-0.4.5), Target: x86_64-linux-gnu
gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu9), Target: x86_64-linux-gnu
gcc version 4.2.1 (Apple Inc. build 5664), Target: i686-apple-darwin10
gcc version 4.2.1 (Apple Inc. build 5664), Target: arm-apple-darwin10

It is best illustrated by the following:

x.cc
----
#include "badheader.h"
int main() { return 42; }

badheader.h
-----------
x;

---
gcc -c -o o/x.o x.cc
In file included from x.cc:1:
badheader.h:1: error: expected constructor, destructor, or type conversion
before ‘;’ token

gcc -E -o o/x.ii x.cc
gcc -c -o o/xii.o o/x.ii
In file included from x.cc:2:
badheader.h:1: error: expected constructor, destructor, or type conversion
before ‘;’ token

-v -save-temps:
$ gcc -v -save-temps -o x x.cc
Using built-in specs.
Target: i686-apple-darwin10
Configured with: /var/tmp/gcc/gcc-5664~38/src/configure --disable-checking
--enable-werror --prefix=/usr --mandir=/share/man
--enable-languages=c,objc,c++,obj-c++
--program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib
--build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10-
--host=x86_64-apple-darwin10 --target=i686-apple-darwin10
--with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5664)
 /usr/libexec/gcc/i686-apple-darwin10/4.2.1/cc1plus -E -quiet -v -imultilib
x86_64 -D__DYNAMIC__ x.cc -fPIC -mmacosx-version-min=10.6.5 -m64 -mtune=core2
-fpch-preprocess -D__private_extern__=extern -o x.ii
ignoring nonexistent directory
"/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../../i686-apple-darwin10/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/4.2.1
 /usr/include/c++/4.2.1/i686-apple-darwin10/x86_64
 /usr/include/c++/4.2.1/backward
 /usr/local/include
 /usr/lib/gcc/i686-apple-darwin10/4.2.1/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.
 /usr/libexec/gcc/i686-apple-darwin10/4.2.1/cc1plus -fpreprocessed x.ii -fPIC
-quiet -dumpbase x.cc -mmacosx-version-min=10.6.5 -m64 -mtune=core2 -auxbase x
-version -D__private_extern__=extern -o x.s
GNU C++ version 4.2.1 (Apple Inc. build 5664) (i686-apple-darwin10)
    compiled by GNU C version 4.2.1 (Apple Inc. build 5664).
GGC heuristics: --param ggc-min-expand=150 --param ggc-min-heapsize=65536
Compiler executable checksum: b2d9fc2676bcbc4fe5c6f07f902dbb00
In file included from x.cc:2:
badheader.h:1: error: expected constructor, destructor, or type conversion
before ‘;’ token

The current preprocessed output for x.cc is as follows:
# 1 "x.cc"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "x.cc"
# 1 "badheader.h" 1
x;
# 2 "x.cc" 2
int main() { return 42; }


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

* [Bug preprocessor/46814] Off by one in "In file included from" with already-preprocessed source
  2010-12-06  4:39 [Bug preprocessor/46814] New: Off by one in "In file included from" with already-preprocessed source dustin at howett dot net
@ 2010-12-06  5:22 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2010-12-06  5:22 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46814

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2010-12-06 05:22:51 UTC ---
Fixed already in 4.5.0.

*** This bug has been marked as a duplicate of bug 36674 ***


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

end of thread, other threads:[~2010-12-06  5:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-06  4:39 [Bug preprocessor/46814] New: Off by one in "In file included from" with already-preprocessed source dustin at howett dot net
2010-12-06  5:22 ` [Bug preprocessor/46814] " pinskia at gcc dot gnu.org

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).