This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/13663] [3.3/3.4/3.5 regression] gcc segfaults on/accepts invalid use of member


------- Additional Comments From reichelt at gcc dot gnu dot org  2004-01-23 21:29 -------
The source seems to be buggy. Line 61037 should read

     for ( accts.first(); accts.current(); accts.next() ) {

instead of

     for ( accts.first(); accts.current(); accts.next ) {
     
With this fix the file compiles without problems.

But of course the compiler shouldn't go into an infinite loop
on the buggy code. Here's a reduced testcase:

========================================
struct A {};

struct B : A
{
    int foo();
};

struct C
{
    B b;
    C() { for ( ;; b.foo ) ; }
};
========================================

GCC 2.95.x issues an error message:

PR13663.cc: In method `C::C()':
PR13663.cc:11: invalid use of member (did you forget the `&' ?)

GCC 3.3.x goes into an endless loop.

GCC 3.0-3.2.3 and GCC 3.4 and mainline accept the code.
IMHO GCC 2.95.x is right and the code should be rejected
(however, I'm not really sure about that).


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reichelt at gcc dot gnu dot
                   |                            |org
           Severity|normal                      |critical
           Keywords|ice-on-valid-code           |accepts-invalid, ice-on-
                   |                            |invalid-code, monitored
            Summary|[3.3 Regression] g++        |[3.3/3.4/3.5 regression] gcc
                   |segfaults in cc1plus        |segfaults on/accepts invalid
                   |                            |use of member


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]