Bug 49188 - C++ type conversion bug (gcc-2.96-85)
C++ type conversion bug (gcc-2.96-85)
Status: CLOSED NEXTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
7.1
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-07-16 14:58 EDT by Mumit Khan
Modified: 2007-04-18 12:34 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-10-05 14:20:46 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Mumit Khan 2001-07-16 14:58:36 EDT
Bug details:
============

GCC 2.96 20000731 fails for the following C++ code. It is a regression from
GCC 2.95.x, and it doesn't fail for FSF GCC 3.0 release.

System and GCC RPM information
===============================
$ cat /etc/issue
Red Hat Linux release 7.1 (Seawolf)
Kernel 2.4.3-12 on an i686

[ All packages up-to-date as of 2001-07-12 using up2date ]

$ rpm -qa|grep gcc
gcc-objc-2.96-85
gcc-2.96-85
gcc-g77-2.96-85
gcc-c++-2.96-85
gcc-chill-2.96-85
gcc-java-2.96-85
$ rpm -qa|grep libstdc++
libstdc++-2.96-85
libstdc++-devel-2.96-85

Source
======
$ cat cxx-parse-bug.cc
struct
Foo
{
public:
  typedef void* (*copier_fn)(void const*);
  void foo() const;
  void bar(char const*, void const*) const;

private:
  struct
  Bar
  {
    char const* key;
    void const* item;
  };
};

void
Foo::foo() const
{
  Bar* cp = 0;                          // doesn't matter what it points
to.
  copier_fn copyfn = 0;                 // Likewise.

  bar(cp->key, cp->item);                               // Works as
expected.
  bar(cp->key, (copyfn) ? (*copyfn)(cp) : 0);           // Likewise.
  bar(cp->key, (copyfn) ? (*copyfn)(0) : 0);            // Likewise.
 
  bar(cp->key, (copyfn) ? (*copyfn)(0) : cp->item);     // Doesn't work.
  bar(cp->key, (copyfn) ? (*copyfn)(cp) : cp->item);    // Likewise.
}
 
 
Compiler invocation and error output
====================================
 
$ gcc -c -v cxx-parse-bug.cc
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-85)
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/cpp0 -lang-c++ -D__GNUG__=2
-D__EXCEPTIONS -v -D__GNUC__=2 -D__GNUC_MINOR__=96 -D__GNUC_PATCHLEVEL__=0
-D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix
-D__linux -Asystem(posix) -D__NO_INLINE__ -Acpu(i386) -Amachine(i386)
-Di386 -D__i386 -D__i386__ -D__tune_i386__ cxx-parse-bug.cc
/tmp/cc3MbEz4.ii
GNU CPP version 2.96 20000731 (Red Hat Linux 7.1 2.96-85) (cpplib) (i386
Linux/ELF)
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/g++-3
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/cc1plus /tmp/cc3MbEz4.ii -quiet
-dumpbase cxx-parse-bug.cc -version -o /tmp/ccebb390.s
GNU C++ version 2.96 20000731 (Red Hat Linux 7.1 2.96-85)
(i386-redhat-linux) compiled by GNU C version 2.96 20000731 (Red Hat Linux
7.1 2.96-85).
cxx-parse-bug.cc: In method `void Foo::foo () const':
cxx-parse-bug.cc:28: could not convert `cp->Foo::Bar::item' to `void *'
cxx-parse-bug.cc:29: could not convert `cp->Foo::Bar::item' to `void *'
Comment 1 Jakub Jelinek 2001-07-17 03:42:25 EDT
Patch is in my tree, will be fixed in gcc-c++-2.96-95.
Comment 2 Miloslav Trmac 2004-03-08 08:53:20 EST
Fix confirmed in gcc-3.3.2-1.
Comment 3 Vladimir Makarov 2004-10-05 14:20:46 EDT
gcc-2.96 is too old.  Its release cycle was finished long ago.  Also
Jakub wrote about fixing it in gcc-2.96-95.  I can confirm that it was
fixed in redhat gcc-3.2 branch too.  So I am closing the case.  If it
is still important, we could reopen it.

Note You need to log in before you can comment on or make changes to this bug.