[lug] Something tweaked in RH 7.1 g++?

Keith C. Herold herold at cslr.Colorado.EDU
Thu Sep 20 08:45:07 MDT 2001


Well, interestingly enough, the problem went away.  I wasn't working with
any serious code, like 64 bit code, but I ended up deleting the function in
question, rewriting it (exactly the same), and it compiles and works fine.
Somehow, an iterator into the internal list was being initialized to the
beginning of the list, but not keeping that initialization when I used it in
*that* function.  I thought perhaps that the list was being changed
incorrectly, invalidating the iterator, but I double checked the other
methods, and nothing changed the list without resetting the pointer.

Sigh.  I suppose the most likely explanation is that the first version of
the function had some extra parentheses or something misplaced, and I had a
bad case of sign blindness.  I know better than to blame the compiler, but
it was only that function, and identical code in another function worked
perfectly (cut and paste).  But, after awhile, I lose track of changes, so
who knows.

I have had trouble compiling code (some language modeling software from sri)
in linux, which more or less refuses to compile on anything after 2.8.1,
even though sri has had no reports of the problem (miscast pointer
somewhere).  Usually I find a 2.8 compiler, compile the code, and then ftp
the binaries over.

If, as D. Stimits says (and I believe him and you guys over my texts at this
point), the compiler in 7.1 is better (excpet as noted by D., I can call you
D., right? :) ), why did Torvald reportedly blast RH for releasing the
experimental version?

I suppose if it were that bad, then 7.1 wouldn't have shipped with it.

Anyway, thanks for the quick responses (I think I will start archiving stuff
on this machine; I need to lean how to use mg anyway (mg is an IR index and
retrieval engine).  If I manage to replicate the problem in smaller code, I
will post it.

--Keith

> -----Original Message-----
> From: lug-admin at lug.boulder.co.us [mailto:lug-admin at lug.boulder.co.us]On
> Behalf Of Scott A. Herod
> Sent: Thursday, September 20, 2001 8:14 AM
> To: lug at lug.boulder.co.us
> Subject: Re: [lug] Something tweaked in RH 7.1 g++?
>
>
> Hi Keith,
>
>   I can't comment on Dan's response.  However, I have had problems
> running code that was compiled with gcc 2.96 that was also linked with
> code compiled with 2.95 or 2.91.  I've not dug for details but most
> often have problems when trying to do dynamic_casts of classes that
> contain STL data types.  The typical error is a segfault somewhere deep
> in the dynamic_cast code.  It works when I restrict to one compiler. The
> problem can still occur even when everything is compilied -g -O.
>
>   I only understand the details of how the compiler works enough to make
> dangerous speculations but since I believe that the vtable layout
> changed between 2.91 and 2.96, I wonder how how a dynamic_cast can work
> at all.
>
>   Anyway, a thing to check is what you are linking against.  Can you
> reproduce the problem in a simple example that does not link against
> external libs other than the gcc standard ones?
>
> Scott
>
> "Keith C. Herold" wrote:
> >
> > I have a curious problem.  I know that 7.1 shipped with an
> "experimental"
> > version of the gcc, but what problems exist beyond just trying
> to compile
> > the kernel?  I ask because I am having a tremendous amount of trouble
> > compiling simple code, that seems to work correctly.  I have also had
> > trouble compiling code that is supposedly tested against 7.1 (no missing
> > libraries, either).
> >
> > For example, I am trying to retrieve an Entry from a class
> called Dataset.
> > The copy and assignment constructors for Entry are implemented correctly
> > (according to my testing :) ), and Dataset stores them in a
> list.  When I
> > try to retrieve one item from the list using a list iterator in one
> > particular function, it segfaults.  Every other function seems
> to operate
> > correctly, and the various lists are populated with valid data.
> >
> > Is there something about the 7.1 gcc that you folks know of
> that causes this
> > problem?  I have looked on the gnu web site, but nothing jumps out.
> >
> > --Keith
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
>




More information about the LUG mailing list