Closed Bug 15777 Opened 20 years ago Closed 20 years ago

Some gcc versions have compilation problems

Categories

(Core :: Layout, defect, P3)

x86
Linux
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: drepper, Assigned: akkzilla)

References

Details

Attachments

(1 file)

I've reported the same problem for other parts of the source tree already
(see 15773 and 15776).  The layout code also contains one instance of this
problem and it can be fixed with the following patch.

Index: layout/base/src/nsDocumentEncoder.cpp
===================================================================
RCS file: /cvsroot/mozilla/layout/base/src/nsDocumentEncoder.cpp,v
retrieving revision 1.20
diff -u -u -r1.20 nsDocumentEncoder.cpp
--- nsDocumentEncoder.cpp       1999/09/14 21:32:06     1.20
+++ nsDocumentEncoder.cpp       1999/10/07 21:18:53
@@ -236,12 +236,12 @@

     nsIParser* parser;

-    static NS_DEFINE_IID(kCParserIID, NS_IPARSER_IID);
-    static NS_DEFINE_IID(kCParserCID, NS_PARSER_IID);
+    static NS_DEFINE_IID(kCParserIID2, NS_IPARSER_IID);
+    static NS_DEFINE_IID(kCParserCID2, NS_PARSER_IID);

-    rv = nsComponentManager::CreateInstance(kCParserCID,
+    rv = nsComponentManager::CreateInstance(kCParserCID2,
                                             nsnull,
-                                            kCParserIID,
+                                            kCParserIID2,
                                             (void **)&parser);

     if (NS_SUCCEEDED(rv)) {
Assignee: troy → akkana
Akkana, looks like you're the owner
Status: NEW → ASSIGNED
Target Milestone: M11
Here's the comment from bug 15773 (just so I don't have to keep going to that
bug for the description of the problem):

Some gcc versions (I'm using the current development version of gcc) have
a bug when it comes to static variables in C++ functions which have an
extern "C" struct type.  gcc errorneously emits a name without a special
prefix to distinguish the variable.  In the case where in the same source
file there are two static variable definitions with the same name the
assembler will complain about multiple definitions of the same symbol.

Does this imply that we define the static symbol twice?  If so, fixing it that
way would be better.  But I'll fix it one way or the other.  Unfortunately, I'm
going on vacation for a week (but if someone else wants to check it in in the
meantime, you have my approval), but I'll fix this when I get back (if no one
beats me to it).
Okay, I get it -- the same function-static is defined in two different
functions.  That seems like a pretty serious compiler bug, not being able deal
with something that simple and common ...  but there's no reason the statics
can't be moved to the top of the file, defined in the normal way.  Attaching a
patch to this bug, and I'll try to get it checked in today.
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Blocks: 16654
Akkana, since this is a code fix, could you please mark as verified fixed. I
don't have a way of checking for the fix. thanks.
Status: RESOLVED → VERIFIED
I wish the original poster would comment on whether this fixed the problem,
since I don't have a version of gcc which has the problem.  But I'll mark it
verified to get it off your radar; if the original poster is still having
problems, please reopen!
You need to log in before you can comment on or make changes to this bug.