public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/8442: Wrongful compiler error - file available
@ 2002-11-04  7:55 bangerth
  0 siblings, 0 replies; 6+ messages in thread
From: bangerth @ 2002-11-04  7:55 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, jcab, nobody

Synopsis: Wrongful compiler error - file available

State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Mon Nov  4 07:55:10 2002
State-Changed-Why:
    I can confirm the messages on Linux from your preprocessed 
    sources, but it is very hard to tell whether they are justfied
    or not, as the file has some 59,000 lines and invokes all
    kinds of template stuff (not that I would be unused to that
    but this seems messy). Could you try to condense the
    problem into a smaller testcase where it is simpler to
    see whether the error is justified or not?
    
    Thanks
      Wolfgang

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8442


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

* Re: c++/8442: Wrongful compiler error - file available
@ 2002-11-05  6:46 Reichelt
  0 siblings, 0 replies; 6+ messages in thread
From: Reichelt @ 2002-11-05  6:46 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/8442; it has been noted by GNATS.

From: Reichelt <reichelt@igpm.rwth-aachen.de>
To: jcab@JCABs-Rumblings.com, gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org,
        nobody@gcc.gnu.org
Cc:  
Subject: Re: c++/8442: Wrongful compiler error - file available
Date: Tue, 5 Nov 2002 16:33:19 +0100

 Hi,
 
 here's a little cleaned-up testcase:
 
 --------------------------------snip here-----------------------------
 template <typename T> struct A {};
 
 template <typename T> struct B
 {
     template <typename U> struct C {};
     template <typename U> A<C<U> > foo(U);
 };
 
 B<void> b;
 --------------------------------snip here-----------------------------
 
 With gcc 2.95.x and gcc 3.0.x the code compiles fine. With mainline
 we get the following ICE
 
 PR8442.cc: In instantiation of `B<void>':
 PR8442.cc:9:   instantiated from here
 PR8442.cc:6: error: type/value mismatch at argument 1 in template parameter 
    list for `template<class T> struct A'
 PR8442.cc:6: error:   expected a type, got `C'
 PR8442.cc:6: internal compiler error: tree check: expected var_decl, have 
    error_mark in tsubst_decl, at cp/pt.c:5793
 Please submit a full bug report, [etc.]
 
 which is replaced by an "confused by earlier errors" on the 3.2 branch
 (checked on i686-pc-linux-gnu and mips-sgi-irix6.5).
 
 Since this a regression, I rated the PR "high priority".
 
 Greetings,
 Volker
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8442
 
 


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

* Re: c++/8442: Wrongful compiler error - file available
@ 2002-11-05  0:36 Juan Carlos Arevalo-Baeza
  0 siblings, 0 replies; 6+ messages in thread
From: Juan Carlos Arevalo-Baeza @ 2002-11-05  0:36 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/8442; it has been noted by GNATS.

From: Juan Carlos Arevalo-Baeza <jcab@JCABs-Rumblings.com>
To: <bangerth@ticam.utexas.edu>
Cc: <gcc-bugs@gcc.gnu.org>, <gcc-prs@gcc.gnu.org>,
	<nobody@gcc.gnu.org>, <gcc-gnats@gcc.gnu.org>
Subject: Re: c++/8442: Wrongful compiler error - file available
Date: Tue, 5 Nov 2002 00:36:05 -0800

 On Mon, 4 Nov 2002 10:58:35 -0600 (CST), Wolfgang Bangerth=
  wrote:
 >
 >>Yes, Spirit is a complex beast. I'm sorry about that. I've=
  tried
 >>extracting the error bits, but I've been uncuccessful so far.=
  It seems
 >
 >Start from the .ii file you have. First delete all the # lines,=
  I use the
 >following perl script for that usually
 >perl -pi -s 's/^#.*\n//g;' your_file.ii
 >(This way, gcc tells you the real location in the file where=
  something is
 >happening, not the location in the file from which you generated=
  the .ii
 >file.) Then start deleting parts of the file that are not=
  necessary to
 >show the problem. (Function bodies, classes that are only=
  referenced in
 >the function bodies you deleted, classes and namespaces that=
  were only
 >used in classes and namespaces you deleted, etc). In the=
  beginning, the
 >pieces you scrap are usually small, but the blocks can become=
  very large
 >at the end, so don't be scared if you don't make much progress=
  in the
 >beginning.
 >
 >This is a tedious task, and may take an hour or two, but in the=
  end you
 >usually end up with something that has 10-50 lines of code and=
  still shows
 >the problem. With such an example, it is also possible for=
  someone who is
 >not used to your code to see whether this is wrong or right.=
  Otherwise, it
 >is very hard to see...
 
    Ok. I managed to do as you say (turned out step by step as you=
  say <g>), and boiled it down to this code:
 
 ---
 template < class FunctorT >
 struct functor_parser {
 };
 
 template < typename ScannerT >
 struct definition
 {
     template < typename ParserT >
     struct brace_block_functor {
     };
 
     template < typename ParserT >
     static
     functor_parser<brace_block_functor<ParserT> >*
     brace_block(ParserT const& parser) { // line 15
         return 0;
     };
 };
 
 definition<char const*> def; // line 20
 ---
 
    Error spew:
 
 ---
 bug.ii: In instantiation of `definition<const char*>':
 bug.ii:20:   instantiated from here
 bug.ii:15: type/value mismatch at argument 1 in template=
  parameter list for `
    template<class FunctorT> struct functor_parser'
 bug.ii:15:   expected a type, got `brace_block_functor'
 bug.ii:15: confused by earlier errors, bailing out
 ---
 
    This is clearly wrong.
 
 =A0=A0=A0Salutaciones,
 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0JCAB
 email: jcab@JCABs-Rumblings.com
 ICQ: 10913692 @WORK: 101728263
 WWW: http://www.JCABs-Rumblings.com
 


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

* Re: c++/8442: Wrongful compiler error - file available
@ 2002-11-04  8:56 Juan Carlos Arevalo-Baeza
  0 siblings, 0 replies; 6+ messages in thread
From: Juan Carlos Arevalo-Baeza @ 2002-11-04  8:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/8442; it has been noted by GNATS.

From: Juan Carlos Arevalo-Baeza <jcab@JCABs-Rumblings.com>
To: <bangerth@dealii.org>, <gcc-bugs@gcc.gnu.org>,
	<gcc-prs@gcc.gnu.org>, <jcab@JCABs-Rumblings.com>,
	<nobody@gcc.gnu.org>, <gcc-gnats@gcc.gnu.org>,
	<gcc-bugs@gcc.gnu.org>, <gcc-prs@gcc.gnu.org>, <nobody@gcc.gnu.org>
Cc:  
Subject: Re: c++/8442: Wrongful compiler error - file available
Date: Mon, 4 Nov 2002 08:48:05 -0800

 On 4 Nov 2002 15:55:11 -0000, bangerth@dealii.org wrote:
 >Synopsis: Wrongful compiler error - file available
 >
 >I can confirm the messages on Linux from your preprocessed
 >sources, but it is very hard to tell whether they are justfied
 >or not, as the file has some 59,000 lines and invokes all
 >kinds of template stuff (not that I would be unused to that
 >but this seems messy).
 
    Yes, Spirit is a complex beast. I'm sorry about that. I've=
  tried extracting the error bits, but I've been uncuccessful so=
  far. It seems to me that something in the chain of template=
  instantiations is fooling the compiler into thinking that either=
  brace_block_functor is not in scope, or something like that.
 
 >Could you try to condense the
 >problem into a smaller testcase where it is simpler to
 >see whether the error is justified or not?
 
    Maybe I can condense the error as I see it here. The code=
  looks like this:
 
 (line 2304.cpp, line 60573.ii)
 template < typename ParserT >
 static
 functor_parser<this_t::brace_block_functor<ParserT> >
 brace_block(ParserT const& parser) {
     return brace_block_functor<ParserT>(parser);
 };
 
 functor_parser is a template class that takes a single type=
  parameter, and can be implicitly constructed from that type.=
  Defined in line 50729.ii.
 
 brace_block_functor is defined in the same scope as the=
  brace_block file above, as a template class that takes a single=
  template parameter.
 
 this_t is the current scope (class scope), but it is=
  inconsequential (it was a test trying to track down this=
  problem). You get the same error without it.
 
    For some reason, according to the error messages, the compiler=
  thinks that brace_block_functor should be a type, instead of a=
  template.
 
    I tried generating similar situations using simpler code,=
  without success. The problem is that the call to this function=
  is generated kind of deep into the template instantiations, and=
  extracting the call doesn't seem to show the problem.
 
    I'll keep trying. Thanx!
 
 =A0=A0=A0Salutaciones,
 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0JCAB
 email: jcab@JCABs-Rumblings.com
 ICQ: 10913692 @WORK: 101728263
 WWW: http://www.JCABs-Rumblings.com
 


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

* Re: c++/8442: Wrongful compiler error - file available
@ 2002-11-04  8:56 Wolfgang Bangerth
  0 siblings, 0 replies; 6+ messages in thread
From: Wolfgang Bangerth @ 2002-11-04  8:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/8442; it has been noted by GNATS.

From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: Juan Carlos Arevalo-Baeza <jcab@JCABs-Rumblings.com>
Cc: gcc-bugs@gcc.gnu.org, <gcc-prs@gcc.gnu.org>, <nobody@gcc.gnu.org>,
   <gcc-gnats@gcc.gnu.org>
Subject: Re: c++/8442: Wrongful compiler error - file available
Date: Mon, 4 Nov 2002 10:58:35 -0600 (CST)

 >    Yes, Spirit is a complex beast. I'm sorry about that. I've tried
 > extracting the error bits, but I've been uncuccessful so far. It seems
 
 Start from the .ii file you have. First delete all the # lines, I use the 
 following perl script for that usually
   perl -pi -s 's/^#.*\n//g;' your_file.ii
 (This way, gcc tells you the real location in the file where something is 
 happening, not the location in the file from which you generated the .ii 
 file.) Then start deleting parts of the file that are not necessary to 
 show the problem. (Function bodies, classes that are only referenced in 
 the function bodies you deleted, classes and namespaces that were only 
 used in classes and namespaces you deleted, etc). In the beginning, the 
 pieces you scrap are usually small, but the blocks can become very large 
 at the end, so don't be scared if you don't make much progress in the 
 beginning.
 
 This is a tedious task, and may take an hour or two, but in the end you
 usually end up with something that has 10-50 lines of code and still shows
 the problem. With such an example, it is also possible for someone who is
 not used to your code to see whether this is wrong or right. Otherwise, it
 is very hard to see...
 
 Regards
   Wolfgang
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth              email:           bangerth@ticam.utexas.edu
                                www: http://www.ticam.utexas.edu/~bangerth
 
 


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

* c++/8442: Wrongful compiler error - file available
@ 2002-11-03 17:56 jcab
  0 siblings, 0 replies; 6+ messages in thread
From: jcab @ 2002-11-03 17:56 UTC (permalink / raw)
  To: gcc-gnats


>Number:         8442
>Category:       c++
>Synopsis:       Wrongful compiler error - file available
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Sun Nov 03 17:56:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     jcab@JCABs-Rumblings.com
>Release:        MinGW 2.0.0-3 (GCC 3.2)
>Organization:
>Environment:
Windows 2000, MinGW 2.0.0-3, Spirit 1.5.1 (latest CVS)
>Description:
You can download the file from here:

http://home.JCABs-Rumblings.com/ftp/cpp_grammar_error.zip

It's a ZIP archive including the preprocessed .ii file, the original C++ source file, and the error spew.

You can read the tracking of the bug so far on the MinGW pages in SourceForge:

https://sourceforge.net/tracker/?func=detail&atid=102435&aid=632454&group_id=2435

Basically, when compiling the file, using this command: 

c:\mingw\bin\g++ -O2 -ftemplate-depth-500 -o 
cpp_grammar.o -c cpp_grammar.ii 

I get an error in a piece of code that looks like this: 

--- 
struct cpp_grammar: grammar<cpp_grammar> { 

... 

template <typename ScannerT> 
struct definition: 
cpp_expressions<ScannerT> 
{ 
... 
template < typename ParserT > 
struct brace_block_functor { 
... 
}; 

template < typename ParserT > 
static 
functor_parser<brace_block_functor<ParserT> > // 
line 2306 
brace_block(ParserT const& parser) { 
return brace_block_functor<ParserT>(parser); 
}; 
... 
}; 
... 
}; 
--- 

The error (sans the "instantiated from" super-spew) says 
this: 

--- 
cpp_grammar.cpp:2306: type/value mismatch at 
argument 1 in template parameter 
list for `template<class FunctorT> struct 
spirit::functor_parser' 
cpp_grammar.cpp:2306: expected a type, got 
`brace_block_functor' 
cpp_grammar.cpp:2306: confused by earlier errors, 
bailing out 
--- 

This is patently wrong. In fact, I have a CygWin with 
GCC 3.0.3 that compiles this program perfectly. 

In tracking this with the MinGW people, they've tried this file with the newest 3.3 compiler, and gotten other errors.
>How-To-Repeat:
Compile the cpp_grammar.ii file from the ZIP file above, using the following command line:

c:\mingw\bin\g++ -O2 -ftemplate-depth-500 -o 
cpp_grammar.o -c cpp_grammar.ii 
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2002-11-05 14:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-04  7:55 c++/8442: Wrongful compiler error - file available bangerth
  -- strict thread matches above, loose matches on Subject: below --
2002-11-05  6:46 Reichelt
2002-11-05  0:36 Juan Carlos Arevalo-Baeza
2002-11-04  8:56 Juan Carlos Arevalo-Baeza
2002-11-04  8:56 Wolfgang Bangerth
2002-11-03 17:56 jcab

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