public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/22590] New: parser hosed
@ 2005-07-21 14:31 igodard at pacbell dot net
  2005-07-21 14:32 ` [Bug c++/22590] " igodard at pacbell dot net
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: igodard at pacbell dot net @ 2005-07-21 14:31 UTC (permalink / raw)
  To: gcc-bugs

Parser seems totally lost

-- 
           Summary: parser hosed
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: igodard at pacbell dot net
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/22590] parser hosed
  2005-07-21 14:31 [Bug c++/22590] New: parser hosed igodard at pacbell dot net
@ 2005-07-21 14:32 ` igodard at pacbell dot net
  2005-07-21 14:49 ` igodard at pacbell dot net
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: igodard at pacbell dot net @ 2005-07-21 14:32 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From igodard at pacbell dot net  2005-07-21 14:31 -------
Created an attachment (id=9319)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9319&action=view)
compiler output


-- 


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


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

* [Bug c++/22590] parser hosed
  2005-07-21 14:31 [Bug c++/22590] New: parser hosed igodard at pacbell dot net
  2005-07-21 14:32 ` [Bug c++/22590] " igodard at pacbell dot net
@ 2005-07-21 14:49 ` igodard at pacbell dot net
  2005-07-21 14:50 ` igodard at pacbell dot net
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: igodard at pacbell dot net @ 2005-07-21 14:49 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From igodard at pacbell dot net  2005-07-21 14:32 -------
Created an attachment (id=9320)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9320&action=view)
source code (compressed)


-- 


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


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

* [Bug c++/22590] parser hosed
  2005-07-21 14:31 [Bug c++/22590] New: parser hosed igodard at pacbell dot net
  2005-07-21 14:32 ` [Bug c++/22590] " igodard at pacbell dot net
  2005-07-21 14:49 ` igodard at pacbell dot net
@ 2005-07-21 14:50 ` igodard at pacbell dot net
  2005-07-21 16:56 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: igodard at pacbell dot net @ 2005-07-21 14:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From igodard at pacbell dot net  2005-07-21 14:49 -------
The actual problem is a missing "#" on a #include statement, so the code is
invalid. But the error is reported not where that occurs but deep inside the
next included file. So this report is actually a complaint about the file
position reported in the diagnostic.

-- 


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


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

* [Bug c++/22590] parser hosed
  2005-07-21 14:31 [Bug c++/22590] New: parser hosed igodard at pacbell dot net
                   ` (2 preceding siblings ...)
  2005-07-21 14:50 ` igodard at pacbell dot net
@ 2005-07-21 16:56 ` pinskia at gcc dot gnu dot org
  2005-07-21 17:59 ` [Bug c++/22590] parser does not recover well after error pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-21 16:56 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #9319|application/octet-stream    |text/plain
          mime type|                            |


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


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

* [Bug c++/22590] parser does not recover well after error
  2005-07-21 14:31 [Bug c++/22590] New: parser hosed igodard at pacbell dot net
                   ` (3 preceding siblings ...)
  2005-07-21 16:56 ` pinskia at gcc dot gnu dot org
@ 2005-07-21 17:59 ` pinskia at gcc dot gnu dot org
  2005-07-21 23:18 ` bangerth at dealii dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-21 17:59 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-21 17:58 -------
Confirmed.
Testcase:
include "core.hh"
typedef unsigned int size_t;
namespace std
{
  using ::size_t;
}

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2005-07-21 17:58:28
               date|                            |
            Summary|parser hosed                |parser does not recover well
                   |                            |after error


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


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

* [Bug c++/22590] parser does not recover well after error
  2005-07-21 14:31 [Bug c++/22590] New: parser hosed igodard at pacbell dot net
                   ` (4 preceding siblings ...)
  2005-07-21 17:59 ` [Bug c++/22590] parser does not recover well after error pinskia at gcc dot gnu dot org
@ 2005-07-21 23:18 ` bangerth at dealii dot org
  2005-07-22  2:30 ` igodard at pacbell dot net
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: bangerth at dealii dot org @ 2005-07-21 23:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2005-07-21 23:11 -------
With Andrew's little testcase, I get 
 
g/x> cat > x.cc 
include "core.hh" 
typedef unsigned int size_t; 
namespace std 
{ 
  using ::size_t; 
} 
 
g/x> /home/bangerth/bin/gcc-4.1-pre/bin/c++ -c x.cc 
x.cc:1: error: expected constructor, destructor, or type conversion before 
string constant 
x.cc:5: error: ‘::size_t‘ has not been declared 
 
I guess that's as good as it gets: it doesn't understand your include 
statement 
(understandably so) and then keeps reading. Since there is no semicolon 
after the botched include, it skips the rest of the presumed statement 
until after your declaration of ::size_t. The next error is where you 
use ::size_t, which of course it doesn't know. 
 
What's wrong with this?  
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING


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


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

* [Bug c++/22590] parser does not recover well after error
  2005-07-21 14:31 [Bug c++/22590] New: parser hosed igodard at pacbell dot net
                   ` (5 preceding siblings ...)
  2005-07-21 23:18 ` bangerth at dealii dot org
@ 2005-07-22  2:30 ` igodard at pacbell dot net
  2005-07-22  3:37 ` bangerth at dealii dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: igodard at pacbell dot net @ 2005-07-22  2:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From igodard at pacbell dot net  2005-07-22 01:25 -------
Then Andrew's test case is not showing the problem. In the original, although
the message is the same as Andrew's, the line/file reference is deep inside a
system include that contains the first program text after the point of error:

In file included from
/mnt/export/local/bin/../lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/cstddef:48,
                 from /home/ivan/ootbc/common/include/comtype.hh:6,
                 from ../../members/include/opClock.hh:4,
                 from opClock.cc:2:
/mnt/export/local/bin/../lib/gcc/i686-pc-linux-gnu/3.4.0/include/stddef.h:151:
error: expected constructor, destructor, or type conversion before string constant 

The cited line in stddef.h does not contain a string constant, as the message
seems to assert. The actual error was four files away in opClock.cc, and pretty
hard to find. In Andrew's test, ithe compiler reports:

x.cc:1: error: expected constructor, destructor, or type conversion before 
string constant 

Note that here the cited line is line 1, i.e. the line where the cited string
constant appears and so Andrew's case gives the right line/file, whereas the
original does not.

If in the original the same message had given the line/file of the "string
constant" it mentions (which was the file name in what was intended to be a
#include) I'd be happy, but it doesn't.

I don't know what the difference is between the original report code and
Andrew's as far as the parser is concerned, but the location in the message in
the original is lousy while in Andrew's it's fine. I surmise that the line/file
reporting system is confused when the parser scans over an #include boundary (or
several); that happens in the original and not in Andrew's.

Ivan


-- 


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


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

* [Bug c++/22590] parser does not recover well after error
  2005-07-21 14:31 [Bug c++/22590] New: parser hosed igodard at pacbell dot net
                   ` (6 preceding siblings ...)
  2005-07-22  2:30 ` igodard at pacbell dot net
@ 2005-07-22  3:37 ` bangerth at dealii dot org
  2005-07-22  5:51 ` igodard at pacbell dot net
  2005-07-22 13:07 ` bangerth at dealii dot org
  9 siblings, 0 replies; 11+ messages in thread
From: bangerth at dealii dot org @ 2005-07-22  3:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2005-07-22 03:16 -------
I believe you, though I can't reproduce with a simple set of include files. 
Can you try to reduce your program to something more reasonable that still 
shows the same problem? 
 
W. 

-- 


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


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

* [Bug c++/22590] parser does not recover well after error
  2005-07-21 14:31 [Bug c++/22590] New: parser hosed igodard at pacbell dot net
                   ` (7 preceding siblings ...)
  2005-07-22  3:37 ` bangerth at dealii dot org
@ 2005-07-22  5:51 ` igodard at pacbell dot net
  2005-07-22 13:07 ` bangerth at dealii dot org
  9 siblings, 0 replies; 11+ messages in thread
From: igodard at pacbell dot net @ 2005-07-22  5:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From igodard at pacbell dot net  2005-07-22 05:50 -------
# 1 "opClock.cc"
# 1 "/home/ivan/ootbc/members/src//"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "opClock.cc"
include "core.hh"
# 1 "../../members/include/opClock.hh" 1
# 1 "/mnt/export/local/bin/../lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../includ
e/c++/3.4.0/cstddef" 1 3
# 1 "/mnt/export/local/bin/../lib/gcc/i686-pc-linux-gnu/3.4.0/include/stddef.h"
1 3 4
# 151 "/mnt/export/local/bin/../lib/gcc/i686-pc-linux-gnu/3.4.0/include/stddef.h
" 3 4
typedef int ptrdiff_t;


-- 


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


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

* [Bug c++/22590] parser does not recover well after error
  2005-07-21 14:31 [Bug c++/22590] New: parser hosed igodard at pacbell dot net
                   ` (8 preceding siblings ...)
  2005-07-22  5:51 ` igodard at pacbell dot net
@ 2005-07-22 13:07 ` bangerth at dealii dot org
  9 siblings, 0 replies; 11+ messages in thread
From: bangerth at dealii dot org @ 2005-07-22 13:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2005-07-22 12:53 -------
I think I now get why I had less problems: this is already fixed in 4.0: 
 
g/x> /home/bangerth/bin/gcc-3.4*-pre/bin/c++ -c x.ii 
In file included 
from /mnt/export/local/bin/../lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/cstddef:1, 
                 from ../../members/include/opClock.hh:1, 
                 from opClock.cc:2: 
/mnt/export/local/bin/../lib/gcc/i686-pc-linux-gnu/3.4.0/include/stddef.h:151: 
error: expected constructor, destructor, or type conversion before string 
constant 
/mnt/export/local/bin/../lib/gcc/i686-pc-linux-gnu/3.4.0/include/stddef.h:151: 
error: expected `,' or `;' before string constant 
 
 
g/x> /home/bangerth/bin/gcc-4.0*-pre/bin/c++ -c x.ii 
In file included from ../../members/include/opClock.hh:2, 
                 from opClock.cc:3: 
opClock.cc:1: error: expected constructor, destructor, or type conversion 
before string constant 
 
 
So the error is now shown for the line of the .cc file. 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.0.0


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


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

end of thread, other threads:[~2005-07-22 12:53 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-21 14:31 [Bug c++/22590] New: parser hosed igodard at pacbell dot net
2005-07-21 14:32 ` [Bug c++/22590] " igodard at pacbell dot net
2005-07-21 14:49 ` igodard at pacbell dot net
2005-07-21 14:50 ` igodard at pacbell dot net
2005-07-21 16:56 ` pinskia at gcc dot gnu dot org
2005-07-21 17:59 ` [Bug c++/22590] parser does not recover well after error pinskia at gcc dot gnu dot org
2005-07-21 23:18 ` bangerth at dealii dot org
2005-07-22  2:30 ` igodard at pacbell dot net
2005-07-22  3:37 ` bangerth at dealii dot org
2005-07-22  5:51 ` igodard at pacbell dot net
2005-07-22 13:07 ` bangerth at dealii dot 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).